Jump to content

Display on sale image when product on special.


Recommended Posts

I want to have the on sale image or a special image when a product is on special. I know I can just check the on sale check box in the back office but when a special expires I will have to manually uncheck this box.

If the sale check box is checked and can be automatically unchecked when special ends it will solve my issue.

Is there a way to accomplish this?

  • Like 1
Link to comment
Share on other sites

Change line 189 of product.tpl in your theme's from:

{if $product->on_sale}



to:

{if $product->on_sale && ($product->reduction_from == $product->reduction_to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $product->reduction_to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $product->reduction_from))}



This should display the "On sale" icon only if the current time is between the reduction times. You will need to do a similar change in product-list.tpl.

Link to comment
Share on other sites

  • 5 months later...

I'm interested in this also..

I've set up my template to show a 'On Sale' image if an item is on sale, otherwise if it's New it will show a 'new' image, and then otherwise it will show nothing. (Using IF statements of course)

Some of my sale items ended and they still show my 'On Sale' image (obviously because the checkbox in product setup is ticked to show the 'On sale' image.

Like gofer, I'd like this to be automatic so the checkbox effectively says "if you check this, the product will display the 'On sale" image while the product is on sale. And to that end it would be nice to set this to the default checkbox state so I don't have to check it on every product.

I'll give rocky's code a go aswell and report back..

Link to comment
Share on other sites

  • 2 weeks later...

Nah, didn't work for me either.

My product still showed by 'On Sale' image despite the sale having ended.

Anyone got any ideas??
Seems a bit silly to have to remember to check a box to show my 'On Sale' images when the item is on sale for a limited period?!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...