It's possible for Magento to automatically add a sticker or flash animation that says ''new'' on a product. And if it is, can it automatically remove this sticker after a period of time? hope my question is understandable.

  • Hey could you make it work? – Klettseb Sep 5 '16 at 9:53
  • Nope :/ sending message to the page developer as we speak, i'm still new to magento and web developing as such. – Kristofers Gulbis Sep 8 '16 at 10:14
  • ok, keep me updated – Klettseb Sep 8 '16 at 10:17

On products you can set the product as new from and to dates, you can then check these dates within a module block and then output html for the sticker based on if the current date is between the new from/to dates.

enter image description here

Then once these are set you should be able to do something like

    public function isProductNew($product)
        $newsFromDate = $product->getNewsFromDate();
        $newsToDate   = $product->getNewsToDate();
        $currentDate = date('d/m/Y');
        if (!$newsFromDate && !$newsToDate) {
            return false;
        if($currentDate > $newsFromDate && $currentDate < $newsToDate) {
            return true;

And then just call the above function, true = new, false = not new

|improve this answer|||||

You could do it based on the 'Set Product as New from Date' and 'Set Product as New to Date'. You could a boolean too though, just create an attribute with the Yes/No input type and add it to your default attribute set. In my example the attribute is called Showcase. Then in the product you could just choose "Yes/No" and the label we create below would come up.

In your template files (templates/catalog/product/list.phtml and templates/catalog/product/view/media.phtml if you want it on the product view page) you would add a piece of conditional code that will add the image in case the product is labeled "NEW".

As an example:

<div class="product-image">

   <?php if($_product->getShowcase()) { ?>
       <div class="newLabel"></div>
   <?php } ?>

       $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
       echo $_helper->productAttribute($_product, $_img, 'image');


and then you would create specific css for the label like the following to produce the new icon in the top corner;

.products-grid .product-image { 
    position: relative;
    display: block; 
    width: 244px; 
    height: 156px; 
    margin: 0 0 10px;

.newLabel {
    position: absolute;
    right: 0;
    top: 0;
    width: 65px;
    height: 66px;
    display: block;
    z-index: 2;
    background: url(../images/yourlabel.png) no-repeat;

This is an example I did myself last week, so it uses my image sizes but you get the idea. Hope this helps.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.