natebc Posted September 14, 2012 Share Posted September 14, 2012 Hello How can I added sale Icons on photos, in the Categories? like this one 15% off Link to comment Share on other sites More sharing options...
yewster Posted September 15, 2012 Share Posted September 15, 2012 Hello How can I added sale Icons on photos, in the Categories? like this one 15% off This won't be exactly what you want but to get you started, you can edit "product-list.tpl" file in your prestashop's "themes" folder. I will show you an example with the default theme for (ver 1.4.9...) Goto line 33 in product-list.tpl file: You will see this code <a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} /></a> Insert the bold code below into the code above so it will look like below: <a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}"> {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<div style="background:#000;position:absolute;z-index:999;">{l s='On sale!'}</div>{/if} <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} /></a> In Backoffice, under product page, you need to check the checkbox with the label: "Display "on sale" icon on product page and text on product listing" for the product that you want to display onsale. To display percentage, I found a post in the forum http://www.prestashop.com/forums/topic/148801-how-to-add-reduction-percentage-to-product-list-page/ with the solution: Just insert the code below: {if $product.price_without_reduction neq $product.price} <span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span> {if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices} {if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))} (-{$pro_specific_prices.reduction * 100|floatval}%) {/if} {/if} {/if} Good luck! Hope you can work it out. Link to comment Share on other sites More sharing options...
natebc Posted September 16, 2012 Author Share Posted September 16, 2012 Hi yewster, Thank for your help. I open that file (product-list.tpl) but found the code on line 5 not line 33. <a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" /></a> Can you tell me if that's OK? Also the "To display percentage with the solution code below" Do I insert the code any where? Thanks Nate Link to comment Share on other sites More sharing options...
sickshot Posted September 30, 2012 Share Posted September 30, 2012 I also need this feature . please anyone help with this.... Link to comment Share on other sites More sharing options...
Recommended Posts