Cushbinshad Adbinad Posted July 25, 2014 Share Posted July 25, 2014 Hi, I am using prestashop 1.6 with new template zensation. on this template I am not able to display the discount percentage as in the default prestashop theme. Can any one please help to use this feature in my new theme? I am attaching the screenshots of new and default themes. This is my url: https://swissgrouponline.com Link to comment Share on other sites More sharing options...
vekia Posted July 26, 2014 Share Posted July 26, 2014 hello you have to use code to display this "badge" with percentage discount: in product-list.tpl {if $product.specific_prices.reduction_type == 'percentage'} <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span> {/if} 1 Link to comment Share on other sites More sharing options...
Cushbinshad Adbinad Posted July 26, 2014 Author Share Posted July 26, 2014 Hi, thanks for the reply... I applied the changes, but not able to test it due to some errors occurred while i tried to create another multiple future module on my site. will revert when its solved. Error loading the site: www.swissgrouponline.com Link to comment Share on other sites More sharing options...
Cushbinshad Adbinad Posted July 26, 2014 Author Share Posted July 26, 2014 Hi, The edit is not working, my friend... Attaching the product-list.tpl code, please help... {* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {if isset($products)} <!-- Products list --> <div class="product_list" id="product_list"> <ul id="product_list_lview" class="clear"> {foreach from=$products item=product name=products} <li class="ajax_block_product {if $smarty.foreach.products.first}first_item{elseif $smarty.foreach.products.last}last_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if} clearfix"> <div class="center_block"> {if isset($product.new) && $product.new == 1}<a href="{$product.link|escape:'html'}"><div class="new_list">{l s='New'}</div></a>{/if} {$more_imgs = Product::getProductsImgs($product.id_product)} {if $square_images == 0} {if count($more_imgs) > 1} <div class="imgs_list"><div class="front_image"><a href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'zen_list_default')|escape:'html'}" alt="{$product.name|escape:html:'UTF-8'}" class="small_shadow"/></a></div><div class="back_image">{foreach from=$more_imgs item=second_img}<a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $second_img.id_image, 'zen_list_default')}" alt="{$product.name|escape:html:'UTF-8'}" class="small_shadow"/></a>{/foreach}</div></div> {else} <div class="imgs_list"><div class="back_image"><a href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'zen_list_default')|escape:'html'}" alt="{$product.name|escape:html:'UTF-8'}" class="small_shadow"/></a></div></div> {/if} {else} {if count($more_imgs) > 1} <div class="imgs_list"><div class="front_image"><a href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'zen_list_default_square')|escape:'html'}" alt="{$product.name|escape:html:'UTF-8'}" class="small_shadow"/></a></div><div class="back_image">{foreach from=$more_imgs item=second_img}<a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $second_img.id_image, 'zen_list_default_square')}" alt="{$product.name|escape:html:'UTF-8'}" class="small_shadow"/></a>{/foreach}</div></div> {else} <div class="imgs_list"><div class="back_image"><a href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'zen_list_default_square')|escape:'html'}" alt="{$product.name|escape:html:'UTF-8'}" class="small_shadow"/></a></div></div> {/if} {/if} <div class="products_list_data"> <div class="s_title_block" style="margin-top:0px;float:none;"><a href="{$product.link|escape:'html'}" title="{$product.name|truncate:100:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:70:'...'|escape:'htmlall':'UTF-8'}</a>{if isset($product.online_only) && $product.online_only}<span class="online_only">{l s='Online only'}</span>{/if}{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>{/if}</div> <div class="s_title_block_mobile" style="margin-top:0px;float:none;"><a href="{$product.link|escape:'html'}" title="{$product.name|truncate:100:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:50:'...'|escape:'htmlall':'UTF-8'}</a>{if isset($product.online_only) && $product.online_only}<span class="online_only">{l s='Online only'}</span>{/if}{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>{/if}</div> {if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<div class="price_container">{if $product.specific_prices}<span class="price_hot">{else}<span class="price">{/if}{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="on_sale">{l s='On sale!'}</span> {elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount">{l s='Reduced price!'}</span>{/if}</div>{/if} {if $product.specific_prices.reduction_type == 'percentage'} <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span> {/if} <div class="product_desc"><a href="{$product.link|escape:'html'}" title="{l s='More'}">{$product.description_short|strip_tags}</a></div> </div> <div class="small_buttons_container_plist"> <a class="lnk_more" href="{$product.link|escape:'html'}" title="{l s='View'}">{l s='View'}</a> {if ($product.id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $product.available_for_order AND !isset($restricted_country_mode) AND $product.minimal_quantity == 1 AND $product.customizable != 2 AND !$PS_CATALOG_MODE} {if ($product.quantity > 0 OR $product.allow_oosp)} <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart')|escape:'html'}?qty=1&id_product={$product.id_product}&token={$static_token}&add" title="{l s='Add to cart'}">{l s='Add to cart'}</a> {/if} {/if} {if isset($comparator_max_item) && $comparator_max_item} <p class="compare"> <input type="checkbox" class="comparator" id="comparator_item_{$product.id_product}" value="comparator_item_{$product.id_product}" {if isset($compareProducts) && in_array($product.id_product, $compareProducts)}checked="checked"{/if} autocomplete="off"/> <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label> </p> {/if} </div> </div> </li> {/foreach} </ul> <ul id="product_list_gview" class="clear"> {foreach from=$products item=product name=products} <li class="product_box_carousel"> {if isset($product.new) && $product.new == 1}<a href="{$product.link|escape:'html'}"><div class="new">{l s='New'}</div></a>{/if} {$more_imgs = Product::getProductsImgs($product.id_product)} {if $square_images == 0} {if count($more_imgs) > 0} <div class="imgs"><div class="front_image"><a href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'zen_home_default')|escape:'html'}" alt="{$product.name|escape:html:'UTF-8'}" /></a></div><div class="back_image">{foreach from=$more_imgs item=second_img}<a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $second_img.id_image, 'zen_home_default')}" alt="{$product.name|escape:html:'UTF-8'}" /></a>{/foreach}</div></div> {else} <div class="imgs"><div class="back_image"><a href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'zen_home_default')|escape:'html'}" alt="{$product.name|escape:html:'UTF-8'}" /></a></div></div> {/if} {else} {if count($more_imgs) > 0} <div class="imgs"><div class="front_image"><a href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'zen_home_default_square')|escape:'html'}" alt="{$product.name|escape:html:'UTF-8'}" /></a></div><div class="back_image">{foreach from=$more_imgs item=second_img}<a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $second_img.id_image, 'zen_home_default_square')}" alt="{$product.name|escape:html:'UTF-8'}" /></a>{/foreach}</div></div> {else} <div class="imgs"><div class="back_image"><a href="{$product.link|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'zen_home_default_square')|escape:'html'}" alt="{$product.name|escape:html:'UTF-8'}" /></a></div></div> {/if} {/if} <div class="datas"> <div class="s_title_block"><a href="{$product.link|escape:'html'}" title="{$product.name|truncate:50:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:30:'...'|escape:'htmlall':'UTF-8'}</a></div> <div class="s_title_block_mobile"><a href="{$product.link|escape:'html'}" title="{$product.name|truncate:50:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:25:'...'|escape:'htmlall':'UTF-8'}</a></div> {if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<div class="price_container">{if $product.specific_prices}<span class="price_hot">{else}<span class="price">{/if}{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span></div>{/if} <div class="product_desc"><a href="{$product.link|escape:'html'}" title="{l s='More'}">{$product.description_short|strip_tags|truncate:100:'...'}</a></div> </div> <div class="home_featured_buttons"> <a class="lnk_more" href="{$product.link|escape:'html'}" title="{l s='View'}">{l s='View'}</a> {if ($product.id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $product.available_for_order AND !isset($restricted_country_mode) AND $product.minimal_quantity == 1 AND $product.customizable != 2 AND !$PS_CATALOG_MODE} {if ($product.quantity > 0 OR $product.allow_oosp)} <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart')|escape:'html'}?qty=1&id_product={$product.id_product}&token={$static_token}&add" title="{l s='Add to cart'}">{l s='Add to cart'}</a> {else} <span class="exclusive">{l s='Add to cart'}</span> {/if} {else} <div style="height:23px;"></div> {/if} </div> </li> {/foreach} </ul> </div> <!-- /Products list --> {/if} <script type="text/javascript"> jQuery.cookie = function (key, value, options) { // key and at least value given, set cookie... if (arguments.length > 1 && String(value) !== "[object Object]") { options = jQuery.extend({}, options); if (value === null || value === undefined) { options.expires = -1; } if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } value = String(value); return (document.cookie = [ encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } // key and possibly options given, get cookie... options = value || {}; var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; }; $(function() { var cc = $.cookie('list_grid'); if (cc == 'l') { $('#product_list_lview').removeClass('grid'); $('#grid').removeClass('view_active'); $('#list').addClass('view_active'); $('#product_list_gview').hide(); $('#product_list_lview').show(); } else { $('#product_list_lview').addClass('grid'); $('#list').removeClass('view_active'); $('#grid').addClass('view_active'); $('#product_list_gview').show(); $('#product_list_lview').hide(); } }); $(document).ready(function() { $('#grid').click(function() { $('#product_list_lview').fadeOut(300, function() { $('#product_list_gview').fadeIn(300) $('#list').removeClass('view_active'); $('#grid').addClass('view_active'); $.cookie('list_grid', null); $('#product_list_gview li:nth-child(3n+3)').css("margin-right","0px"); }); return false; }); $('#list').click(function() { $('#product_list_gview').fadeOut(300, function() { $('#product_list_lview').fadeIn(300) $('#grid').removeClass('view_active'); $('#list').addClass('view_active'); $.cookie('list_grid', 'l'); }); return false; }); $('#product_list_gview li:nth-child(3n+3)').css("margin-right","0px"); }); </script> Link to comment Share on other sites More sharing options...
vekia Posted July 26, 2014 Share Posted July 26, 2014 what you see instead of reduction sign? what you mean by "not working" errors? issues? Link to comment Share on other sites More sharing options...
Cushbinshad Adbinad Posted July 27, 2014 Author Share Posted July 27, 2014 Hi, After updating the code still I am getting the same output. No difference. Please see the attached screenshots. Site address:https://swissgrouponline.com/en/mobile-phones/1-samsung-mobile-g7102-grand-smartphone-3g-mobile.html regards Cushbin Link to comment Share on other sites More sharing options...
vekia Posted July 27, 2014 Share Posted July 27, 2014 code that i pasted is a code for product-list.tpl i checked sources of your category page and there is no code that i suggested to use 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