Magento adds 'new' or discount quantity labels to products magento new label. discount label_PHP tutorial

WBOY
Release: 2016-07-14 10:11:57
Original
969 people have browsed it

文章最底部有效果图。

给新产品添加“new”的标签。给折扣产品,显示出折扣的数量。

这个可以自己写一段代码加在到模板文件夹下面的catalog/product/list.phtml中。 以下是代码

timestamp(time()); ?>



                $new_str_tm = strtotime($_product->getNews_from_date());
                $new_end_tm = strtotime($_product->getNews_to_date());
                ?>
               


                   
                   
                   
               

                0): ?>
                $new_str_tm) && (!$new_end_tm) ) ): ?>
                   
NEW

               
               
               
                $spe_end_tm = strtotime($_product->getSpecial_to_date());
                    $spe_str_tm = strtotime($_product->getSpecial_from_date());
                    $spe_pri = $_product->getSpecial_price();
                ?>
                getResource()->getAttribute('price')->getFrontend()->getValue($_product) ?>
                $spe_str_tm) && (!$spe_end_tm) ) ): ?>
                   
                   
                   
%

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

Insert the above code into the corresponding location. . It’s best to put it after

After this is done. Also need to change the CSS. Let it appear in the appropriate location.

.products-grid .ico_new_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; }

.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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477287.htmlTechArticleThere is a rendering at the bottom of the article. Add the new tag to new products. For discounted products, show the discounted quantity. You can write a piece of code yourself and add it to the cata under the template folder...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template