@@ -8,6 +8,8 @@ use Magento\Framework\App\Action\Action;
8
8
?>
9
9
<?php
10
10
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
11
+ // phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
12
+ // phpcs:disable Generic.Files.LineLength.TooLong
11
13
12
14
/**
13
15
* Product list template
@@ -21,13 +23,15 @@ $_productCollection = $block->getLoadedProductCollection();
21
23
/** @var \Magento\Catalog\Helper\Output $_helper */
22
24
$ _helper = $ this ->helper (Magento \Catalog \Helper \Output::class);
23
25
?>
24
- <?php if (!$ _productCollection ->count ()) :?>
25
- <div class="message info empty"><div><?= $ escaper ->escapeHtml (__ ('We can \'t find products matching the selection. ' )) ?> </div></div>
26
- <?php else :?>
26
+ <?php if (!$ _productCollection ->count ()): ?>
27
+ <div class="message info empty">
28
+ <div><?= $ escaper ->escapeHtml (__ ('We can \'t find products matching the selection. ' )) ?> </div>
29
+ </div>
30
+ <?php else : ?>
27
31
<?= $ block ->getToolbarHtml () ?>
28
32
<?= $ block ->getAdditionalHtml () ?>
29
33
<?php
30
- if ($ block ->getMode () == 'grid ' ) {
34
+ if ($ block ->getMode () === 'grid ' ) {
31
35
$ viewMode = 'grid ' ;
32
36
$ imageDisplayArea = 'category_page_grid ' ;
33
37
$ showDescription = false ;
@@ -46,7 +50,7 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
46
50
<div class="products wrapper <?= /* @noEscape */ $ viewMode ?> products-<?= /* @noEscape */ $ viewMode ?> ">
47
51
<ol class="products list items product-items">
48
52
<?php /** @var $_product \Magento\Catalog\Model\Product */ ?>
49
- <?php foreach ($ _productCollection as $ _product ) : ?>
53
+ <?php foreach ($ _productCollection as $ _product ): ?>
50
54
<li class="item product product-item">
51
55
<div class="product-item-info" data-container="product-<?= /* @noEscape */ $ viewMode ?> ">
52
56
<?php
@@ -63,13 +67,15 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
63
67
<?= $ productImage ->toHtml () ?>
64
68
</a>
65
69
<div class="product details product-item-details">
66
- <?php
67
- $ _productNameStripped = $ block ->stripTags ($ _product ->getName (), null , true );
68
- ?>
70
+ <?php $ _productNameStripped = $ block ->stripTags ($ _product ->getName (), null , true ); ?>
69
71
<strong class="product name product-item-name">
70
72
<a class="product-item-link"
71
73
href="<?= $ escaper ->escapeUrl ($ _product ->getProductUrl ()) ?> ">
72
- <?= /* @noEscape */ $ _helper ->productAttribute ($ _product , $ _product ->getName (), 'name ' ) ?>
74
+ <?= /* @noEscape */ $ _helper ->productAttribute (
75
+ $ _product ,
76
+ $ _product ->getName (),
77
+ 'name '
78
+ ) ?>
73
79
</a>
74
80
</strong>
75
81
<?= $ block ->getReviewsSummaryHtml ($ _product , $ templateType ) ?>
@@ -79,7 +85,7 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
79
85
<div class="product-item-inner">
80
86
<div class="product actions product-item-actions"<?= strpos ($ pos , $ viewMode . '-actions ' ) ? $ escaper ->escapeHtmlAttr ($ position ) : '' ?> >
81
87
<div class="actions-primary"<?= strpos ($ pos , $ viewMode . '-primary ' ) ? $ escaper ->escapeHtmlAttr ($ position ) : '' ?> >
82
- <?php if ($ _product ->isSaleable ()) : ?>
88
+ <?php if ($ _product ->isSaleable ()): ?>
83
89
<?php $ postParams = $ block ->getAddToCartPostParams ($ _product ); ?>
84
90
<form data-role="tocart-form"
85
91
data-product-sku="<?= $ escaper ->escapeHtml ($ _product ->getSku ()) ?> "
@@ -88,7 +94,8 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
88
94
<input type="hidden"
89
95
name="product"
90
96
value="<?= /* @noEscape */ $ postParams ['data ' ]['product ' ] ?> ">
91
- <input type="hidden" name="<?= /* @noEscape */ Action::PARAM_NAME_URL_ENCODED ?> "
97
+ <input type="hidden"
98
+ name="<?= /* @noEscape */ Action::PARAM_NAME_URL_ENCODED ?> "
92
99
value="<?= /* @noEscape */ $ postParams ['data ' ][Action::PARAM_NAME_URL_ENCODED ] ?> ">
93
100
<?= $ block ->getBlockHtml ('formkey ' ) ?>
94
101
<button type="submit"
@@ -97,23 +104,31 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
97
104
<span><?= $ escaper ->escapeHtml (__ ('Add to Cart ' )) ?> </span>
98
105
</button>
99
106
</form>
100
- <?php else :?>
101
- <?php if ($ _product ->isAvailable ()) :?>
102
- <div class="stock available"><span><?= $ escaper ->escapeHtml (__ ('In stock ' )) ?> </span></div>
103
- <?php else :?>
104
- <div class="stock unavailable"><span><?= $ escaper ->escapeHtml (__ ('Out of stock ' )) ?> </span></div>
107
+ <?php else : ?>
108
+ <?php if ($ _product ->isAvailable ()): ?>
109
+ <div class="stock available">
110
+ <span><?= $ escaper ->escapeHtml (__ ('In stock ' )) ?> </span>
111
+ </div>
112
+ <?php else : ?>
113
+ <div class="stock unavailable">
114
+ <span><?= $ escaper ->escapeHtml (__ ('Out of stock ' )) ?> </span>
115
+ </div>
105
116
<?php endif ; ?>
106
117
<?php endif ; ?>
107
118
</div>
108
119
<div data-role="add-to-links" class="actions-secondary"<?= strpos ($ pos , $ viewMode . '-secondary ' ) ? $ escaper ->escapeHtmlAttr ($ position ) : '' ?> >
109
- <?php if ($ addToBlock = $ block ->getChildBlock ('addto ' )) : ?>
120
+ <?php if ($ addToBlock = $ block ->getChildBlock ('addto ' )): ?>
110
121
<?= $ addToBlock ->setProduct ($ _product )->getChildHtml () ?>
111
122
<?php endif ; ?>
112
123
</div>
113
124
</div>
114
- <?php if ($ showDescription ) : ?>
125
+ <?php if ($ showDescription ): ?>
115
126
<div class="product description product-item-description">
116
- <?= /* @noEscape */ $ _helper ->productAttribute ($ _product , $ _product ->getShortDescription (), 'short_description ' ) ?>
127
+ <?= /* @noEscape */ $ _helper ->productAttribute (
128
+ $ _product ,
129
+ $ _product ->getShortDescription (),
130
+ 'short_description '
131
+ ) ?>
117
132
<a href="<?= $ escaper ->escapeUrl ($ _product ->getProductUrl ()) ?> "
118
133
title="<?= /* @noEscape */ $ _productNameStripped ?> "
119
134
class="action more"><?= $ escaper ->escapeHtml (__ ('Learn More ' )) ?> </a>
@@ -127,7 +142,7 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
127
142
</ol>
128
143
</div>
129
144
<?= $ block ->getToolbarHtml () ?>
130
- <?php if (!$ block ->isRedirectToCartEnabled ()) : ?>
145
+ <?php if (!$ block ->isRedirectToCartEnabled ()): ?>
131
146
<script type="text/x-magento-init">
132
147
{
133
148
"[data-role=tocart-form], .form.map.checkout": {
0 commit comments