Jump to content

adding discount price to Home featured products


amnesiak

Recommended Posts

Hi,

Can someone tell me how to show both prices regular and discount price at Home featured product page and also on product list page. By default the both prices are displayed only when you are at a product detail page.

I know I should edit the home_featured-tlp But what would be the code?

Regards

Link to comment
Share on other sites

Hi amnesiak,

 

Add this in homefeatured.tpl:

	  {if ((isset($product.on_sale) && $product.on_sale) || (isset($product.reduction) && $product.reduction)) && $product.price_without_reduction > $product.price && $product.show_price AND !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
		<p class="price_container"><span class="old_price_home">
		  {convertPrice price=$product.price_without_reduction}
		</span></p>{else}<div style="height:21px;"></div>{/if}

Right above or below (depending on your preference) the display of current price from this code:

  {if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<p class="price_container"><span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span></p>{else}<div style="height:21px;"></div>{/if}

 

Add you own CSS class in global.css for original price (class="old_price_home" in example above).

 

For product lists, see this topic:

http://www.prestasho...roduct-listtpl/

  • Like 6
Link to comment
Share on other sites

  • 8 months later...

Hi amnesiak,

 

As you said above that you already got the solution for displaying both prices in homefeatured, so I will be really greatfull to you if you can share it with me as I am finding it difficult.

Regards,

Link to comment
Share on other sites

  • 1 month later...
hi @AKJV, after the modification you proposed, do i have to clear the cache? i'm afraid to do so because in "Force Compile" it says "not for a production site" and mine is. thanks

 

It is safe to use Force compile on production sites. What that description means, is that you shouldn't enable Force compile for an extended period of time. Because using Force compile will result in long loading times for you website since Prestashop will recompile the smarty code in tpl files every time a webpage is visited or refreshed. So it's best not to do this when you're expecting lots of visitors, but rather late in the evening or early morning. And don't forget to switch off Force compile immediately when you're done :)

Link to comment
Share on other sites

It is safe to use Force compile on production sites. What that description means, is that you shouldn't enable Force compile for an extended period of time. Because using Force compile will result in long loading times for you website since Prestashop will recompile the smarty code in tpl files every time a webpage is visited or refreshed. So it's best not to do this when you're expecting lots of visitors, but rather late in the evening or early morning. And don't forget to switch off Force compile immediately when you're done :)

Thanks for your reply. i used your suggestion for featured products but nothing happened. i even removed some of the "if conditions" but still no success.

Link to comment
Share on other sites

Are you sure that you first uploaded the file with modifiied code and enabled Force Compile, and then refreshed/reloaded your homepage in your browser? If so, disable Cache as well (option right below Force Compile) and try again with page refresh.

 

Also, my post with modified code is from last year so I have only tested it in an earlier version of Prestashop 1.4.x. Though it should likely work in recent versions as well.

Link to comment
Share on other sites

yes i'm sure. and to be completely honest i surely did it both ways.

anyway i tested again with the cache disabled but still no luck.

 

Me too i don't think there is problem with compatibility it's prety straightforward, but i am still a newbie with prestashop so it's also possible.

 

Anyway, thank you very much for your reply again. I will try again and let you know of the outcome.

Link to comment
Share on other sites

Hi dr.jupiter,

 

I just tested my modification described in post #4 in PS 1.4.8.2 and it still works.

 

But you mentioned that you didn't even see a change on your homepage when leaving out the conditional tags. So I wonder, do you use the prestashop_new theme or a third party theme? If so, then there's probably a folder /themes/yourtheme/modules/homefeatured that overrides the default homefeatured module in the /modules folder. In that case, make sure that you modify the code in homefeatured.tpl in the /themes/yourtheme/modules/homefeatured folder.

Link to comment
Share on other sites

Hi dr.jupiter,

 

I just tested my modification described in post #4 in PS 1.4.8.2 and it still works.

 

But you mentioned that you didn't even see a change on your homepage when leaving out the conditional tags. So I wonder, do you use the prestashop_new theme or a third party theme? If so, then there's probably a folder /themes/yourtheme/modules/homefeatured that overrides the default homefeatured module in the /modules folder. In that case, make sure that you modify the code in homefeatured.tpl in the /themes/yourtheme/modules/homefeatured folder.

yes it works. i was modifying the homefeatured.tpl in the /modules/homefeatured.

How can i add this to all the categories? in category view. ie when i choose a category i can see the list of the products under that category, but i want also to show the customers the old price as well. which files should i edit??

Edited by dr.jupiter (see edit history)
Link to comment
Share on other sites

How can i add this to all the categories? in category view. ie when i choose a category i can see the list of the products under that category, but i want also to show the customers the old price as well. which files should i edit??

You'll have to edit product-list.tpl for that.

See post #4, there's a link to another topic in which I have provided the code modification (see post #7 and onwards in that topic).

Link to comment
Share on other sites

  • 1 year later...

Hi amnesiak,

 

Add this in homefeatured.tpl:

		  {if ((isset($product.on_sale) && $product.on_sale) || (isset($product.reduction) && $product.reduction)) && $product.price_without_reduction > $product.price && $product.show_price AND !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
			<p class="price_container"><span class="old_price_home">
			  {convertPrice price=$product.price_without_reduction}
			</span></p>{else}<div style="height:21px;"></div>{/if}
Right above or below (depending on your preference) the display of current price from this code:

	  {if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<p class="price_container"><span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span></p>{else}<div style="height:21px;"></div>{/if}
Add you own CSS class in global.css for original price (class="old_price_home" in example above).

 

For product lists, see this topic:

http://www.prestasho...roduct-listtpl/

 

Hi AKJV,

 

I successfully managed to show the reduced price as well as the original price by making changes in productlist.tpl and productlist.css as you mentioned in the link you provided in this post. It is now perfect, the way I wanted, thanks to you.

I would be great if you could help me out with two things:

 

1. Product List is showing 'REDUCED PRICE!' in red. Is there a way I can change it to "You Save "amount or percentage" as it is on the product page?

 

2. I am still unable to make the mentioned changes on homefeatured products, I found out where to add the code mentioned on homefeatured.tpl but since I do not know any coding, I am unable to make any changes in global.css file. It would be great if you can help me with what precisely is to be added on the global.css and where? I just want original as well as discounted price on home featured products without 'Reduced Price' or 'You Save', just the original price with a cut over it and reduced price underneath in Red.

 

I am using PS 1.5.5.

 

Regards

Anurag. 

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

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...