|
8 | 8 |
|
9 | 9 | /* @var $block \Magento\Catalog\Block\Product\Compare\ListCompare */
|
10 | 10 | ?>
|
11 |
| -<?php $_total = $block->getItems()->getSize() ?> |
12 |
| -<?php if ($_total): ?> |
| 11 | +<?php $total = $block->getItems()->getSize() ?> |
| 12 | +<?php if ($total): ?> |
13 | 13 | <a href="#" class="action print hidden-print" title="<?= /* @escapeNotVerified */ __('Print This Page') ?>">
|
14 | 14 | <span><?= /* @escapeNotVerified */ __('Print This Page') ?></span>
|
15 | 15 | </a>
|
|
24 | 24 | <caption class="table-caption"><?= /* @escapeNotVerified */ __('Compare Products') ?></caption>
|
25 | 25 | <thead>
|
26 | 26 | <tr>
|
27 |
| - <?php $_i = 0 ?> |
28 |
| - <?php foreach ($block->getItems() as $_item): ?> |
29 |
| - <?php if ($_i++ == 0): ?> |
| 27 | + <?php $index = 0 ?> |
| 28 | + <?php foreach ($block->getItems() as $item): ?> |
| 29 | + <?php if ($index++ == 0): ?> |
30 | 30 | <th scope="row" class="cell label remove"><span><?= /* @escapeNotVerified */ __('Remove Product') ?></span></th>
|
31 | 31 | <?php endif; ?>
|
32 | 32 | <td class="cell remove product hidden-print">
|
33 |
| - <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> |
34 |
| - <a href="#" data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataRemove($_item) ?>' |
| 33 | + <?php $compareHelper = $this->helper(\Magento\Catalog\Helper\Product\Compare::class);?> |
| 34 | + <a href="#" data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataRemove($item) ?>' |
35 | 35 | class="action delete" title="<?= /* @escapeNotVerified */ __('Remove Product') ?>">
|
36 | 36 | <span><?= /* @escapeNotVerified */ __('Remove Product') ?></span>
|
37 | 37 | </a>
|
|
41 | 41 | </thead>
|
42 | 42 | <tbody>
|
43 | 43 | <tr>
|
44 |
| - <?php $_i = 0; ?> |
45 |
| - <?php $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?> |
46 |
| - <?php /** @var $_item \Magento\Catalog\Model\Product */ ?> |
47 |
| - <?php foreach ($block->getItems() as $_item): ?> |
48 |
| - <?php if ($_i++ == 0): ?> |
| 44 | + <?php $index = 0; ?> |
| 45 | + <?php $helper = $this->helper(\Magento\Catalog\Helper\Output::class); ?> |
| 46 | + <?php /** @var $item \Magento\Catalog\Model\Product */ ?> |
| 47 | + <?php foreach ($block->getItems() as $item): ?> |
| 48 | + <?php if ($index++ == 0): ?> |
49 | 49 | <th scope="row" class="cell label product"><span><?= /* @escapeNotVerified */ __('Product') ?></span></th>
|
50 | 50 | <?php endif; ?>
|
51 | 51 | <td data-th="<?= $block->escapeHtml(__('Product')) ?>" class="cell product info">
|
52 |
| - <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" title="<?= /* @escapeNotVerified */ $block->stripTags($_item->getName(), null, true) ?>"> |
53 |
| - <?= $block->getImage($_item, 'product_comparison_list')->toHtml() ?> |
| 52 | + <a class="product-item-photo" href="<?= /* @escapeNotVerified */ $block->getProductUrl($item) ?>" title="<?= /* @escapeNotVerified */ $block->stripTags($item->getName(), null, true) ?>"> |
| 53 | + <?= $block->getImage($item, 'product_comparison_list')->toHtml() ?> |
54 | 54 | </a>
|
55 | 55 | <strong class="product-item-name">
|
56 |
| - <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($_item) ?>" title="<?= /* @escapeNotVerified */ $block->stripTags($_item->getName(), null, true) ?>"> |
57 |
| - <?= /* @escapeNotVerified */ $_helper->productAttribute($_item, $_item->getName(), 'name') ?> |
| 56 | + <a href="<?= /* @escapeNotVerified */ $block->getProductUrl($item) ?>" title="<?= /* @escapeNotVerified */ $block->stripTags($item->getName(), null, true) ?>"> |
| 57 | + <?= /* @escapeNotVerified */ $helper->productAttribute($item, $item->getName(), 'name') ?> |
58 | 58 | </a>
|
59 | 59 | </strong>
|
60 |
| - <?= $block->getReviewsSummaryHtml($_item, 'short') ?> |
61 |
| - <?= /* @escapeNotVerified */ $block->getProductPrice($_item, '-compare-list-top') ?> |
| 60 | + <?= $block->getReviewsSummaryHtml($item, 'short') ?> |
| 61 | + <?= /* @escapeNotVerified */ $block->getProductPrice($item, '-compare-list-top') ?> |
62 | 62 | <div class="product-item-actions hidden-print">
|
63 | 63 | <div class="actions-primary">
|
64 |
| - <?php if ($_item->isSaleable()): ?> |
65 |
| - <form data-role="tocart-form" action="<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddToCartUrl($_item) ?>" method="post"> |
| 64 | + <?php if ($item->isSaleable()): ?> |
| 65 | + <form data-role="tocart-form" action="<?= /* @escapeNotVerified */ $this->helper(\Magento\Catalog\Helper\Product\Compare::class)->getAddToCartUrl($item) ?>" method="post"> |
66 | 66 | <?= $block->getBlockHtml('formkey') ?>
|
67 | 67 | <button type="submit" class="action tocart primary">
|
68 | 68 | <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span>
|
69 | 69 | </button>
|
70 | 70 | </form>
|
71 | 71 | <?php else: ?>
|
72 |
| - <?php if ($_item->getIsSalable()): ?> |
| 72 | + <?php if ($item->getIsSalable()): ?> |
73 | 73 | <div class="stock available"><span><?= /* @escapeNotVerified */ __('In stock') ?></span></div>
|
74 | 74 | <?php else: ?>
|
75 | 75 | <div class="stock unavailable"><span><?= /* @escapeNotVerified */ __('Out of stock') ?></span></div>
|
76 | 76 | <?php endif; ?>
|
77 | 77 | <?php endif; ?>
|
78 | 78 | </div>
|
79 |
| - <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> |
| 79 | + <?php if ($this->helper(\Magento\Wishlist\Helper\Data::class)->isAllow()) : ?> |
80 | 80 | <div class="secondary-addto-links actions-secondary" data-role="add-to-links">
|
81 |
| - <a href="#" data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($_item) ?>' class="action towishlist" data-action="add-to-wishlist"> |
| 81 | + <a href="#" data-post='<?= /* @escapeNotVerified */ $block->getAddToWishlistParams($item) ?>' class="action towishlist" data-action="add-to-wishlist"> |
82 | 82 | <span><?= /* @escapeNotVerified */ __('Add to Wish List') ?></span>
|
83 | 83 | </a>
|
84 | 84 | </div>
|
|
89 | 89 | </tr>
|
90 | 90 | </tbody>
|
91 | 91 | <tbody>
|
92 |
| - <?php foreach ($block->getAttributes() as $_attribute): ?> |
93 |
| - <tr> |
94 |
| - <?php $_i = 0 ?> |
95 |
| - <?php foreach ($block->getItems() as $_item): ?> |
96 |
| - <?php if ($_i++ == 0): ?> |
97 |
| - <th scope="row" class="cell label"> |
98 |
| - <span class="attribute label"> |
99 |
| - <?= $block->escapeHtml($_attribute->getStoreLabel() ? $_attribute->getStoreLabel() : __($_attribute->getFrontendLabel())) ?> |
100 |
| - </span> |
101 |
| - </th> |
102 |
| - <?php endif; ?> |
103 |
| - <td class="cell product attribute"> |
104 |
| - <div class="attribute value"> |
105 |
| - <?php switch ($_attribute->getAttributeCode()) { |
106 |
| - case "price": ?> |
107 |
| - <?php |
108 |
| - /* @escapeNotVerified */ echo $block->getProductPrice( |
109 |
| - $_item, |
110 |
| - '-compare-list-' . $_attribute->getCode() |
111 |
| - ) |
112 |
| - ?> |
113 |
| - <?php break; |
114 |
| - case "small_image": ?> |
115 |
| - <?php $block->getImage($_item, 'product_small_image')->toHtml(); ?> |
| 92 | + <?php foreach ($block->getAttributes() as $attribute): ?> |
| 93 | + <?php $index = 0; ?> |
| 94 | + <?php if ($block->hasAttributeValueForProducts($attribute)): ?> |
| 95 | + <tr> |
| 96 | + <?php foreach ($block->getItems() as $item): ?> |
| 97 | + <?php if ($index++ == 0): ?> |
| 98 | + <th scope="row" class="cell label"> |
| 99 | + <span class="attribute label"> |
| 100 | + <?= $block->escapeHtml($attribute->getStoreLabel() ? $attribute->getStoreLabel() : __($attribute->getFrontendLabel())) ?> |
| 101 | + </span> |
| 102 | + </th> |
| 103 | + <?php endif; ?> |
| 104 | + <td class="cell product attribute"> |
| 105 | + <div class="attribute value"> |
| 106 | + <?php switch ($attribute->getAttributeCode()) { |
| 107 | + case "price": ?> |
| 108 | + <?php |
| 109 | + /* @escapeNotVerified */ echo $block->getProductPrice( |
| 110 | + $item, |
| 111 | + '-compare-list-' . $attribute->getCode() |
| 112 | + ) |
| 113 | + ?> |
| 114 | + <?php break; |
| 115 | + case "small_image": ?> |
| 116 | + <?php $block->getImage($item, 'product_small_image')->toHtml(); ?> |
| 117 | + <?php break; |
| 118 | + default: ?> |
| 119 | + <?= /* @escapeNotVerified */ $helper->productAttribute($item, $block->getProductAttributeValue($item, $attribute), $attribute->getAttributeCode()) ?> |
116 | 120 | <?php break;
|
117 |
| - default: ?> |
118 |
| - <?= /* @escapeNotVerified */ $_helper->productAttribute($_item, $block->getProductAttributeValue($_item, $_attribute), $_attribute->getAttributeCode()) ?> |
119 |
| - <?php break; |
120 |
| - } ?> |
121 |
| - </div> |
122 |
| - </td> |
123 |
| - <?php endforeach; ?> |
124 |
| - </tr> |
| 121 | + } ?> |
| 122 | + </div> |
| 123 | + </td> |
| 124 | + <?php endforeach; ?> |
| 125 | + </tr> |
| 126 | + <?php endif; ?> |
125 | 127 | <?php endforeach; ?>
|
126 | 128 | </tbody>
|
127 | 129 | </table>
|
|
0 commit comments