Hi, I have an issues with sale labels. They're not showing. I have configured catalog price rule, there are 2 prices under product (old and special), but label with percentage isn't there. I have Porto theme installed, there are product label options, I tried to turn on "Show sale label" and also to tun it off, nothing happen.
In public_html/app/design/frontend/Smartwave/porto_child/Magento_Catalog/templates/product/list.phtml is code for sale and new label:
<?php $product_label = ""; if($_product_label_config['sale_label']) { $orgprice = $_product->getPrice(); $specialprice = $_product->getSpecialPrice(); $specialfromdate = $_product->getSpecialFromDate(); $specialtodate = $_product->getSpecialToDate(); $today = time(); if(!$specialprice) $specialprice = $orgprice; if($specialprice < $orgprice) { if((is_null($specialfromdate) && is_null($specialtodate)) || ($today >= strtotime($specialfromdate) && is_null($specialtodate)) || ($today <= strtotime($specialtodate) && is_null($specialfromdate)) || ($today >= strtotime($specialfromdate) && $today <= strtotime($specialtodate))){ if($_product_label_config['sale_label_percent']) { $save_percent = 100-round(($specialprice/$orgprice)*100); $product_label .= '<div class="product-label sale-label">'.'-'.$save_percent.'%'.'</div>'; } else { $product_label .= '<div class="product-label sale-label">'.$_product_label_config['sale_label_text'].'</div>'; } } } } if($_product_label_config['new_label']) { $now = date("Y-m-d"); $newsFrom= substr($_product->getData('news_from_date')?$_product->getData('news_from_date'):'',0,10); $newsTo= substr($_product->getData('news_to_date')?$_product->getData('news_to_date'):'',0,10); if ($newsTo != '' || $newsFrom != ''){ if (($newsTo != '' && $newsFrom != '' && $now>=$newsFrom && $now<=$newsTo) || ($newsTo == '' && $now >=$newsFrom) || ($newsFrom == '' && $now<=$newsTo)) { $product_label .= '<div class="product-label new-label">'.$_product_label_config['new_label_text'].'</div>'; } } } if($product_label) echo '<div class="product-labels">'.$product_label.'</div>'; ?>
Can someone help me, please ? Thank you.