Items.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Wishlist block customer items
  8. *
  9. * @author Magento Core Team <core@magentocommerce.com>
  10. */
  11. namespace Magento\Wishlist\Block\Share\Email;
  12. /**
  13. * @api
  14. * @since 100.0.2
  15. */
  16. class Items extends \Magento\Wishlist\Block\AbstractBlock
  17. {
  18. /**
  19. * @var string
  20. */
  21. protected $_template = 'Magento_Wishlist::email/items.phtml';
  22. /**
  23. * Retrieve Product View URL
  24. *
  25. * @param \Magento\Catalog\Model\Product $product
  26. * @param array $additional
  27. * @return string
  28. */
  29. public function getProductUrl($product, $additional = [])
  30. {
  31. $additional['_scope_to_url'] = true;
  32. return parent::getProductUrl($product, $additional);
  33. }
  34. /**
  35. * Retrieve URL for add product to shopping cart
  36. *
  37. * @param \Magento\Catalog\Model\Product $product
  38. * @param array $additional
  39. * @return string
  40. */
  41. public function getAddToCartUrl($product, $additional = [])
  42. {
  43. $additional['nocookie'] = 1;
  44. $additional['_scope_to_url'] = true;
  45. return parent::getAddToCartUrl($product, $additional);
  46. }
  47. /**
  48. * Check whether wishlist item has description
  49. *
  50. * @param \Magento\Wishlist\Model\Item $item
  51. * @return bool
  52. */
  53. public function hasDescription($item)
  54. {
  55. $hasDescription = parent::hasDescription($item);
  56. if ($hasDescription) {
  57. return $item->getDescription() !== $this->_wishlistHelper->defaultCommentString();
  58. }
  59. return $hasDescription;
  60. }
  61. }