shared.phtml 4.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. // @codingStandardsIgnoreFile
  7. /** @var \Magento\Wishlist\Block\Share\Wishlist $block */
  8. ?>
  9. <?php if ($block->hasWishlistItems()): ?>
  10. <form class="form shared wishlist" action="<?= $block->escapeUrl($block->getUrl('wishlist/index/update')) ?>" method="post">
  11. <div class="wishlist table-wrapper">
  12. <table class="table data wishlist" id="wishlist-table">
  13. <caption class="table-caption"><?= $block->escapeHtml(__('Wish List')) ?></caption>
  14. <thead>
  15. <tr>
  16. <th class="col product" scope="col"><?= $block->escapeHtml(__('Product')) ?></th>
  17. <th class="col comment" scope="col"><?= $block->escapeHtml(__('Comment')) ?></th>
  18. <th class="col actions" scope="col"><?= $block->escapeHtml(__('Add to Cart')) ?></th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. <?php foreach ($block->getWishlistItems() as $item): ?>
  23. <?php
  24. $product = $item->getProduct();
  25. $isVisibleProduct = $product->isVisibleInSiteVisibility();
  26. ?>
  27. <tr>
  28. <td data-th="<?= $block->escapeHtmlAttr(__('Product')) ?>" class="col product">
  29. <a class="product photo" href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>" title="<?= $block->escapeHtmlAttr($product->getName()) ?>">
  30. <?= $block->getImage($product, 'customer_shared_wishlist')->toHtml() ?>
  31. </a>
  32. <strong class="product name">
  33. <a href="<?= $block->escapeUrl($block->getProductUrl($item)) ?>">
  34. <?= $block->escapeHtml($product->getName()) ?>
  35. </a>
  36. </strong>
  37. <?php
  38. echo $block->getProductPriceHtml(
  39. $product,
  40. 'wishlist_configured_price',
  41. \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST,
  42. ['item' => $item]
  43. );
  44. ?>
  45. <?= $block->getDetailsHtml($item) ?>
  46. </td>
  47. <td data-th="<?= $block->escapeHtmlAttr(__('Comment')) ?>" class="col comment"><?= /* @noEscape */ $block->getEscapedDescription($item) ?></td>
  48. <td data-th="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>" class="col actions" data-role="add-to-links">
  49. <?php if ($product->isSaleable()): ?>
  50. <?php if ($isVisibleProduct): ?>
  51. <button type="button"
  52. title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"
  53. data-post='<?= /* @noEscape */ $block->getSharedItemAddToCartUrl($item) ?>'
  54. class="action tocart">
  55. <span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
  56. </button>
  57. <?php endif ?>
  58. <?php endif; ?>
  59. <a href="#" data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($item) ?>' onclick="location.assign(this.href); return false;" class="action towishlist" data-action="add-to-wishlist">
  60. <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span>
  61. </a>
  62. </td>
  63. </tr>
  64. <?php endforeach ?>
  65. </tbody>
  66. </table>
  67. </div>
  68. <div class="actions-toolbar">
  69. <?php if ($block->isSaleable()):?>
  70. <div class="primary">
  71. <button type="button"
  72. title="<?= $block->escapeHtmlAttr(__('Add All to Cart')) ?>"
  73. data-post='<?= $block->escapeUrl($block->getSharedAddAllToCartUrl()) ?>'
  74. class="action tocart primary">
  75. <span><?= $block->escapeHtml(__('Add All to Cart')) ?></span>
  76. </button>
  77. </div>
  78. <?php endif;?>
  79. <div class="secondary">
  80. <a href="<?= $block->escapeUrl($block->getBackUrl()) ?>" class="action back">
  81. <span><?= $block->escapeHtml(__('Back')) ?></span>
  82. </a>
  83. </div>
  84. </div>
  85. </form>
  86. <?php else: ?>
  87. <div class="message info empty"><div><?= $block->escapeHtml(__('Wish List is empty now.')) ?></div></div>
  88. <?php endif ?>