zjean Posted December 17, 2011 Share Posted December 17, 2011 Hi all, I am working on a prestashop site, and see that it is possible to show that a product is on a discount, on the product list-page. (product_list.php). It shows me the discounted price. I would like to see the price it originates from also. I have the following code in the foreach of product (copied from the product.tpl) which does not work: {if isset($product.reduction) && $product.reduction} <span class="old_price"> {if !$priceDisplay} {$product->getPriceWithoutReduct(false, $smarty.const.NULL)} {else} {$product->getPriceWithoutReduct(true, $smarty.const.NULL)} {/if} </span> {/if} The template does not compile correctly: it shows one product in stead of the full page. So it looks like it failes on executing the getPriceWithoutReduct function. Can anyone advise on this? Link to comment Share on other sites More sharing options...
doekia Posted December 17, 2011 Share Posted December 17, 2011 Hi, Yes this is because in product list the $product is not an object, but an array - hence the presence of $product.reduction rather than $product->reduction you might see on other template. Not too sure which version you are using but something like this should point you to the right direction: <span id="old_price_display">{convertPrice price=$product.price}</span> Link to comment Share on other sites More sharing options...
zjean Posted January 14, 2012 Author Share Posted January 14, 2012 Hi, sorry for my late reply. When I use the code you show, I get the new price. Say my products price is reduced from €30 -> €15. Now when ?I use $product.price, i see €15. I want to show the old price (€30) too. How to achieve that, because I don't have the propduct object to ask the old price. Link to comment Share on other sites More sharing options...
doekia Posted January 14, 2012 Share Posted January 14, 2012 Sure let's do it with <span id="old_price_display">{convertPrice price=$product.price_without_reduction}</span> 4 Link to comment Share on other sites More sharing options...
Aldeag Posted January 15, 2012 Share Posted January 15, 2012 Can it solve the problem linked at the end of this thread?: http://www.prestashop.com/forums/topic/99248-change-sub-category-view-to-grids-instead-of-list-v14/page__fromsearch__1 Link to comment Share on other sites More sharing options...
Carisma Posted January 26, 2012 Share Posted January 26, 2012 This will appear only with the product with reduced price! {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE} <span id="old_price_display" style="text-decoration:line-through">{convertPrice price=$product.price_without_reduction}</span> {/if} 2 Link to comment Share on other sites More sharing options...
Aldeag Posted January 27, 2012 Share Posted January 27, 2012 Have a look here and tell if it helps: http://www.prestashop.com/forums/topic/152439-showing-orginal-and-reduced-price-when-onsale-and-only-orgprice-when-not-onsale Link to comment Share on other sites More sharing options...
goodsan40 Posted March 5, 2012 Share Posted March 5, 2012 I have done so: {if $product.reduction} <span id="old_price_display" style="text-decoration:line-through;">{convertPrice price=$product.price_without_reduction}</span> {/if} It's work fine. 1 Link to comment Share on other sites More sharing options...
mux Posted October 2, 2012 Share Posted October 2, 2012 Thanks all.... it works Link to comment Share on other sites More sharing options...
alabasta Posted December 31, 2012 Share Posted December 31, 2012 Thanks... {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE} <span id="old_price_display" style="text-decoration:line-through">{convertPrice price=$product.price_without_reduction}</span> {/if} It still works for 1.5.2 ... you save my day! Link to comment Share on other sites More sharing options...
Suthichai Posted January 20, 2013 Share Posted January 20, 2013 Thank you. It works for 1.5.3.1 {if isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE} <span id="old_price_display">{convertPrice price=$product.price_without_reduction}</span> {/if} 1 Link to comment Share on other sites More sharing options...
JesseNaylor Posted May 29, 2013 Share Posted May 29, 2013 (edited) Great code! I'm using PrestaShop™ 1.4.8.3 and I used a similar code based on yours and worked fine for me: {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE} <span class="price-discount">{displayWtPrice p=$product.price_without_reduction}</span> {/if} This code can be placed in "product-list.tpl" but it also works for me in modules like "homefeatured.tpl". Edited May 29, 2013 by JesseNaylor (see edit history) 2 Link to comment Share on other sites More sharing options...
PrestaFanBoy Posted September 5, 2013 Share Posted September 5, 2013 Thank you. It works for 1.5.3.1 {if isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE} <span id="old_price_display">{convertPrice price=$product.price_without_reduction}</span> {/if} Hi, Thanks for solution. This is working for me too. However, im not getting the percentage reduction display right there along with original price and reduced price. I tried copying this. But didnt work. <span id="reduction_percent_display">{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}</span> Can anyone help me how to tweak it. Thanks for any suggestion. PrestaFanBoy Link to comment Share on other sites More sharing options...
raptor_00 Posted January 9, 2014 Share Posted January 9, 2014 Hi I use PrestaShop™ 1.5.6.1, this code don't work, any idea..? Link to comment Share on other sites More sharing options...
oracle178 Posted March 7, 2014 Share Posted March 7, 2014 Hi raptor_00, I use PrestaShop™ 1.5.6.1 too, and this code is by default in product-list.tpl file, between 69 and 74 lines, looks like : {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE} <span class="old_price">{convertPrice price=$product.price_without_reduction}</span> {elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE} <span class="old_price">{convertPrice price=$product.price_without_reduction}</span> {/if} Link to comment Share on other sites More sharing options...
LaneButz Posted October 23, 2014 Share Posted October 23, 2014 This is a great thread. I need this for 1.6 as well. Any ideas? Or maybe it's already built in and I'm just not seeing the option? Lane Link to comment Share on other sites More sharing options...
Totti Posted October 24, 2014 Share Posted October 24, 2014 convertPrice price=$product.price convertPrice is a function ? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now