Отображать значок продажи на PLP
Я пытаюсь отобразить значок "Распродажа" на страницах категорий товаров, если товары имеют специальную цену. Хотя это ничего не передает.
<?php if (_$product->getPriceInfo()->getPrice('special_price')->getValue()): ?>
<div class="product-abs-top w-100">
<div class="tags-wrapper">
<div class="tag sale">Sale</div>
</div>
</div>
<?php elseif ($_product->getResource()->getAttribute('badge')->getFrontend()->getValue($_product)): ?>
<div class="product-abs-top w-100">
<div class="tags-wrapper">
<div class="tag <?= /* @escapeNotVerified */ str_replace(' ', '_',strtolower($_product->getResource()->getAttribute('badge')->getFrontend()->getValue($_product))) ?>"><?= /* @escapeNotVerified */ $_product->getResource()->getAttribute('badge')->getFrontend()->getValue($_product) ?></div>
</div>
</div>
<?php endif; ?>
2
1 answers
Я думаю, что у вас есть опечатка в коде:
<?php if (_$product->getPriceInfo()->getPrice('special_price')->getValue()): ?>
Должно быть:
<?php if ($_product->getPriceInfo()->getPrice('special_price')->getValue()):
См. _$продукт
1
Author: Pawan, 2019-04-20 01:55:01