|
20 | 20 | $showWishlist = true; |
21 | 21 | $showCompare = true; |
22 | 22 | $showCart = true; |
23 | | - $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::DEFAULT_VIEW; |
| 23 | + $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW; |
24 | 24 | $description = false; |
25 | 25 | ?> |
26 | 26 | <div class="block widget block-products-list <?= /* @noEscape */ $mode ?>"> |
|
48 | 48 | <?= $block->escapeHtml($_item->getName()) ?> |
49 | 49 | </a> |
50 | 50 | </strong> |
51 | | - <?php |
52 | | - echo $block->getProductPriceHtml($_item, $type); |
53 | | - ?> |
54 | | - |
55 | 51 | <?php if ($templateType): ?> |
56 | 52 | <?= $block->getReviewsSummaryHtml($_item, $templateType) ?> |
57 | 53 | <?php endif; ?> |
58 | | - |
| 54 | + <?php echo $block->getProductPriceHtml($_item, $type); ?> |
59 | 55 | <?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()->isPossibleBuyFromList($_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> |
| 56 | + <div class="product-item-inner"> |
| 57 | + <div class="product-item-actions"> |
| 58 | + <?php if ($showCart): ?> |
| 59 | + <div class="actions-primary"> |
| 60 | + <?php if ($_item->isSaleable()): ?> |
| 61 | + <?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item)): ?> |
| 62 | + <button class="action tocart primary" data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> |
| 63 | + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> |
| 64 | + </button> |
| 65 | + <?php else: ?> |
| 66 | + <?php |
| 67 | + $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper'); |
| 68 | + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) |
| 69 | + ?> |
| 70 | + <button class="action tocart primary" data-post='<?= /* @noEscape */ $postData ?>' type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"> |
| 71 | + <span><?= $block->escapeHtml(__('Add to Cart')) ?></span> |
| 72 | + </button> |
| 73 | + <?php endif; ?> |
68 | 74 | <?php else: ?> |
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> |
| 75 | + <?php if ($_item->getIsSalable()): ?> |
| 76 | + <div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div> |
| 77 | + <?php else: ?> |
| 78 | + <div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div> |
| 79 | + <?php endif; ?> |
76 | 80 | <?php endif; ?> |
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> |
| 81 | + </div> |
| 82 | + <?php endif; ?> |
| 83 | + <?php if ($showWishlist || $showCompare): ?> |
| 84 | + <div class="actions-secondary" data-role="add-to-links"> |
| 85 | + <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> |
| 86 | + <a href="#" |
| 87 | + data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"> |
| 88 | + <span><?= $block->escapeHtml(__('Add to Wish List')) ?></span> |
| 89 | + </a> |
| 90 | + <?php endif; ?> |
| 91 | + <?php if ($block->getAddToCompareUrl() && $showCompare): ?> |
| 92 | + <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> |
| 93 | + <a href="#" class="action tocompare" data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>"> |
| 94 | + <span><?= $block->escapeHtml(__('Add to Compare')) ?></span> |
| 95 | + </a> |
82 | 96 | <?php endif; ?> |
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; ?> |
| 97 | + </div> |
| 98 | + <?php endif; ?> |
| 99 | + </div> |
102 | 100 | </div> |
103 | 101 | <?php endif; ?> |
104 | 102 | </div> |
|
0 commit comments