|
33 | 33 | <?= /* @noEscape */ '<!-- ' . $image . '-->' ?>
|
34 | 34 | <div class="products-<?= /* @noEscape */ $mode ?> <?= /* @noEscape */ $mode ?>">
|
35 | 35 | <ol class="product-items <?= /* @noEscape */ $type ?>">
|
| 36 | + <?php $iterator = 1; ?> |
36 | 37 | <?php foreach ($items as $_item): ?>
|
37 |
| - <li class="product-item"> |
38 |
| - <div class="product-item-info"> |
39 |
| - <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo"> |
40 |
| - <?= $block->getImage($_item, $image)->toHtml() ?> |
41 |
| - </a> |
42 |
| - <div class="product-item-details"> |
43 |
| - <strong class="product-item-name"> |
44 |
| - <a title="<?= $block->escapeHtml($_item->getName()) ?>" |
45 |
| - href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" |
46 |
| - class="product-item-link"> |
47 |
| - <?= $block->escapeHtml($_item->getName()) ?> |
48 |
| - </a> |
49 |
| - </strong> |
50 |
| - <?php |
51 |
| - echo $block->getProductPriceHtml($_item, $type); |
52 |
| - ?> |
| 38 | + <?= /* @noEscape */ ($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?> |
| 39 | + <div class="product-item-info"> |
| 40 | + <a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo"> |
| 41 | + <?= $block->getImage($_item, $image)->toHtml() ?> |
| 42 | + </a> |
| 43 | + <div class="product-item-details"> |
| 44 | + <strong class="product-item-name"> |
| 45 | + <a title="<?= $block->escapeHtml($_item->getName()) ?>" |
| 46 | + href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" |
| 47 | + class="product-item-link"> |
| 48 | + <?= $block->escapeHtml($_item->getName()) ?> |
| 49 | + </a> |
| 50 | + </strong> |
| 51 | + <?php |
| 52 | + echo $block->getProductPriceHtml($_item, $type); |
| 53 | + ?> |
53 | 54 |
|
54 |
| - <?php if ($templateType): ?> |
55 |
| - <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> |
56 |
| - <?php endif; ?> |
| 55 | + <?php if ($templateType): ?> |
| 56 | + <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> |
| 57 | + <?php endif; ?> |
57 | 58 |
|
58 |
| - <?php if ($showWishlist || $showCompare || $showCart): ?> |
59 |
| - <div class="product-item-actions"> |
60 |
| - <?php if ($showCart): ?> |
61 |
| - <div class="actions-primary"> |
62 |
| - <?php if ($_item->isSaleable()): ?> |
63 |
| - <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> |
64 |
| - <button class="action tocart primary" data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> |
65 |
| - <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> |
66 |
| - </button> |
67 |
| - <?php else: ?> |
68 |
| - <?php |
69 |
| - $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); |
70 |
| - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) |
71 |
| - ?> |
72 |
| - <button class="action tocart primary" data-post='<?= /* @noEscape */ $postData ?>' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> |
73 |
| - <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> |
74 |
| - </button> |
75 |
| - <?php endif; ?> |
| 59 | + <?php if ($showWishlist || $showCompare || $showCart): ?> |
| 60 | + <div class="product-item-actions"> |
| 61 | + <?php if ($showCart): ?> |
| 62 | + <div class="actions-primary"> |
| 63 | + <?php if ($_item->isSaleable()): ?> |
| 64 | + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> |
| 65 | + <button class="action tocart primary" data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> |
| 66 | + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> |
| 67 | + </button> |
76 | 68 | <?php else: ?>
|
77 |
| - <?php if ($_item->getIsSalable()): ?> |
78 |
| - <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> |
79 |
| - <?php else: ?> |
80 |
| - <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> |
81 |
| - <?php endif; ?> |
| 69 | + <?php |
| 70 | + $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); |
| 71 | + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) |
| 72 | + ?> |
| 73 | + <button class="action tocart primary" data-post='<?= /* @noEscape */ $postData ?>' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> |
| 74 | + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> |
| 75 | + </button> |
82 | 76 | <?php endif; ?>
|
83 |
| - </div> |
84 |
| - <?php endif; ?> |
85 |
| - <?php if ($showWishlist || $showCompare): ?> |
86 |
| - <div class="actions-secondary" data-role="add-to-links"> |
87 |
| - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> |
88 |
| - <a href="#" |
89 |
| - data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> |
90 |
| - <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> |
91 |
| - </a> |
92 |
| - <?php endif; ?> |
93 |
| - <?php if ($block->getAddToCompareUrl() && $showCompare): ?> |
94 |
| - <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> |
95 |
| - <a href="#" class="action tocompare" data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> |
96 |
| - <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> |
97 |
| - </a> |
| 77 | + <?php else: ?> |
| 78 | + <?php if ($_item->getIsSalable()): ?> |
| 79 | + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> |
| 80 | + <?php else: ?> |
| 81 | + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> |
98 | 82 | <?php endif; ?>
|
99 |
| - </div> |
100 |
| - <?php endif; ?> |
101 |
| - </div> |
102 |
| - <?php endif; ?> |
103 |
| - </div> |
| 83 | + <?php endif; ?> |
| 84 | + </div> |
| 85 | + <?php endif; ?> |
| 86 | + <?php if ($showWishlist || $showCompare): ?> |
| 87 | + <div class="actions-secondary" data-role="add-to-links"> |
| 88 | + <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> |
| 89 | + <a href="#" |
| 90 | + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> |
| 91 | + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> |
| 92 | + </a> |
| 93 | + <?php endif; ?> |
| 94 | + <?php if ($block->getAddToCompareUrl() && $showCompare): ?> |
| 95 | + <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> |
| 96 | + <a href="#" class="action tocompare" data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> |
| 97 | + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> |
| 98 | + </a> |
| 99 | + <?php endif; ?> |
| 100 | + </div> |
| 101 | + <?php endif; ?> |
| 102 | + </div> |
| 103 | + <?php endif; ?> |
104 | 104 | </div>
|
105 |
| - </li> |
| 105 | + </div> |
| 106 | + <?= ($iterator == count($items) + 1) ? '</li>' : '' ?> |
106 | 107 | <?php endforeach ?>
|
107 | 108 | </ol>
|
108 | 109 | </div>
|
|
0 commit comments