rokasv Posted March 25, 2011 Share Posted March 25, 2011 Hello,In my shop i tryed to change a standart view of Bestsellers block to a bit more adwanced, where all bestselling products in a block have a thumbnail, also the price is displayed.Edited modules/blockbestsellers/blockbestsellers.tpl file to: <!-- MODULE Block best sellers --> {l s='Top sellers' mod='blockbestsellers'} {if $best_sellers|@count > 0} {foreach from=$best-sellers item=product name=myLoop} getImageLink($best_sellers.0.link_rewrite, $best_sellers.0.id_image, 'medium')}" alt="{$best_sellers.0.legend|escape:htmlall:'UTF-8'}" />{$best_sellers.0.name|strip_tags|escape:htmlall:'UTF-8'|truncate:25:'...'} {t text=$best_sellers.0.description_short length='25' strip='true' encode='true'} {if !$priceDisplay || $priceDisplay == 2} {convertPrice price=$best_sellers.0.price}{if $priceDisplay == 2} {l s='+Tx' mod='blockbestsellers'}{/if}{/if} {if $priceDisplay} {convertPrice price=$best_sellers.0.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx' mod='blockbestsellers'}{/if}{/if} getImageLink($best_sellers.1.link_rewrite, $best_sellers.1.id_image, 'medium')}" alt="{$best_sellers.1.legend|escape:htmlall:'UTF-8'}" />{$best_sellers.1.name|strip_tags|escape:htmlall:'UTF-8'|truncate:25:'...'} {t text=$best_sellers.1.description_short length='25' strip='true' encode='true'} {if !$priceDisplay || $priceDisplay == 2} {convertPrice price=$best_sellers.1.price}{if $priceDisplay == 2} {l s='+Tx' mod='blockbestsellers'}{/if}{/if} {if $priceDisplay} {convertPrice price=$best_sellers.1.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx' mod='blockbestsellers'}{/if}{/if} getImageLink($best_sellers.2.link_rewrite, $best_sellers.2.id_image, 'medium')}" alt="{$best_sellers.2.legend|escape:htmlall:'UTF-8'}" />{$best_sellers.2.name|strip_tags|escape:htmlall:'UTF-8'|truncate:25:'...'} {t text=$best_sellers.2.description_short length='25' strip='true' encode='true'} {if !$priceDisplay || $priceDisplay == 2} {convertPrice price=$best_sellers.2.price}{if $priceDisplay == 2} {l s='+Tx' mod='blockbestsellers'}{/if}{/if} {if $priceDisplay} {convertPrice price=$best_sellers.2.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx' mod='blockbestsellers'}{/if}{/if} {/foreach} {l s='All best sellers' mod='blockbestsellers'} {else} {l s='No new products at this time' mod='blocknewproducts'} {/if} <!-- /MODULE Block new products --> Edited themes/prestashop/css/modules/blockbestsellers/blockbestsellers.css file to: /* Block best sellers */ #best-sellers_block_right li { height: 90px; } #best-sellers_block_right li a { color: #898989; text-decoration: none; font-weight: normal;} #best-sellers_block_right li a:hover, #best-sellers_block_right li a.title:hover { text-decoration: underline; } #best-sellers_block_right li a.title { font-weight:normal; color: black; font-size: 13px; text-decoration: none; } #best-sellers_block_right p { color: black; padding-left: 10px; } #best-sellers_block_right p.price_container { text-align: left; font-size: 13px; } #best-sellers_block_right span.price { font-weight: normal; font-size: 13px; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; } The way a block looks at the moment is ok (see attached images, block PERKAMIAUSIEJI on the left column), but i have two problems with prices:1. Prices in a block is rounded (see #1 in a attached picture rounded.jpg)2. If a price of a bestselling product is more then 1000, in a block it is displayed as 1 (see #3 in a picture price.jpg), if i reduce the price of the same product to less then 1000 (f.e. 999,9) it shows the price almost ok (see #2 ina picture rounden.jpg), but rounded.Could you please help me to find where i made an error in my code, or i need to add some additional rows to it?CheersRokas Link to comment Share on other sites More sharing options...
jordiob Posted April 7, 2011 Share Posted April 7, 2011 I have the same problem and couldn't find a solution. Anyone please? Link to comment Share on other sites More sharing options...
ufikas Posted May 2, 2011 Share Posted May 2, 2011 Same issue here. How can this be fixed? Link to comment Share on other sites More sharing options...
Artizzz Posted May 15, 2011 Share Posted May 15, 2011 I have fix for this problem. So if anyone still needed it, I attached my best seller block module(there are 2 files what I modify). I change design of default design of module and in my version doesn't have description but I add discount % and amount(like special module). blockbestsellers.php Link to comment Share on other sites More sharing options...
jordiob Posted May 15, 2011 Share Posted May 15, 2011 I have fix for this problem. So if anyone still needed it, I attached my best seller block module(there are 2 files what I modify). I change design of default design of module and in my version doesn't have description but I add discount % and amount(like special module). Thanks Artizzz! I tried your code but I get the same error Link to comment Share on other sites More sharing options...
Artizzz Posted May 15, 2011 Share Posted May 15, 2011 I have fix for this problem. So if anyone still needed it, I attached my best seller block module(there are 2 files what I modify). I change design of default design of module and in my version doesn't have description but I add discount % and amount(like special module). Thanks Artizzz! I tried your code but I get the same error In previous post I can't upload secound image. :/So I can write 2 things what I do.in blockbestsellers.tpl:from:$bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 5); to: $bestsellers = ProductSale::getBestSales((int)($params['cookie']->id_lang), 0, 5); and my blockbestsellers.tlp looks like: <!-- MODULE Block best sellers --> getPageLink('best-sales.php')}" title="{l s='Top sellers' mod='blockbestsellers'}">{l s='Top sellers' mod='blockbestsellers'} {if $best_sellers !== false} {foreach from=$best_sellers item=topproduct name=myLoop} getImageLink($topproduct.link_rewrite, $topproduct.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$topproduct.legend|escape:html:'UTF-8'}" /> {$topproduct.name|truncate:30:'...'|escape:html:'UTF-8'} {if (!$PS_CATALOG_MODE AND ((isset($topproduct.show_price) && $topproduct.show_price) || (isset($topproduct.available_for_order) && $topproduct.available_for_order)))} {if $topproduct.specific_prices} {if !$priceDisplay}{displayWtPrice p=$topproduct.price_without_reduction}{else}{displayWtPrice p=$priceWithoutReduction_tax_excl}{/if} {assign var='specific_prices' value=$topproduct.specific_prices} {if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))} (-{$specific_prices.reduction*100|floatval}%) {/if} {/if} {if isset($topproduct.show_price) && $topproduct.show_price && !isset($restricted_country_mode)}{if !$priceDisplay}{$topproduct.price}{else}{$topproduct.price_tax_exc}{/if} {/if} {/if} {/foreach} getPageLink('best-sales.php')}" title="{l s='All best sellers' mod='blockbestsellers'}" class="button_large">{l s='All best sellers' mod='blockbestsellers'} {else} {l s='No best sellers at this time' mod='blockbestsellers'} {/if} <!-- /MODULE Block best sellers --> [EDITED]If you want to add description take it from default module .tlp file, in my code it isn't included because I don't need it and I added option if product have price lowered or reduced it shows up like special module block. Link to comment Share on other sites More sharing options...
jordiob Posted May 15, 2011 Share Posted May 15, 2011 Thanks man! Will try! 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