Home > Article > Backend Development > Magento adds "new" or discount quantity labels to products magento new label. discount label_PHP tutorial
文章最底部有效果图。
给新产品添加“new”的标签。给折扣产品,显示出折扣的数量。
这个可以自己写一段代码加在到模板文件夹下面的catalog/product/list.phtml中。 以下是代码
timestamp(time()); ?>
$new_str_tm = strtotime($_product->getNews_from_date());
$new_end_tm = strtotime($_product->getNews_to_date());
?>
After this is done. Also need to change the CSS. Let it appear in the appropriate location.
.products-grid .ico_percent_bg { height:33px; font-size:14px; line-height:24px; color:#ffffff; background:url("../images/ico_bg.png"); position:absolute; margin: -10px -10px 0; padding:0 10px 0; z-index:10; }
Add this CSS code below styles.css. Add it below /* View Type: Grid */. .products-grid li.item, add the last two lines of code after this line.
Adjust the margin position to suit your website.
http://www.bkjia.com/PHPjc/477287.html