Jump to content

Blockbestsellers showing prices


simberak

Recommended Posts

Hello,

 

I modified my module bestsellers to show like this:

 

Product name

Product picture

Product price

--------------------

 

Product name

Product picture

Product price

--------------------

 

Product name

Product picture

Product price

--------------------

 

it shows 5 products...

 

And problem is, that in second and third product the price is "1" - wich is not the price of product :)

 

Here is code of blockbestsellers.tpl

<!-- MODULE Block best sellers -->
<div id="best-sellers_block_right" class="block productbests_block">
<h4><a href="{$link->getPageLink('best-sales.php')}">{l s='Top sellers' mod='blockbestsellers'}</a></h4>
<div class="block_content">
{if $best_sellers|@count > 0}

    {foreach from=$best_sellers item=productbest name=myLoop}
<div style="text-align:center; width: 100%;border-bottom: 1px dashed #0087CC; margin-bottom: 7px; padding-bottom: 10px; color: black; font-weight:bold;" class="noveprodukty">
<a href="{$productbest.link}" title="{$productbest.name|escape:htmlall:'UTF-8'}" class="title" style="color: black; text-shadow: white 1px 1px 1px; font-size:12px; font-weight:bold;">{$productbest.name|strip_tags|escape:htmlall:'UTF-8'}<br /><img src="{$link->getImageLink($productbest.link_rewrite, $productbest.id_image, 'home')}" alt="{$productbest.legend|escape:htmlall:'UTF-8'}" style="border: 1px solid #ffdfea; margin: 5px 0px 0px 0px" /></a>
<br />
{if !$priceDisplay || $priceDisplay == 2}
{convertPrice price=$productbest.price}{if $priceDisplay == 2} {l s='+Tx' mod='blockbestsellers'}{/if}
{/if}
				    {if $priceDisplay}
{convertPrice price=$productbest.price_tax_exc}{if $priceDisplay == 2} {l s='-Tx' mod='blockbestsellers'}{/if}
{/if}
</div>
    {/foreach}
<div><a href="{$link->getPageLink('best-sales.php')}" title="{l s='All best sellers' mod='blockbestsellers'}" class="button_large">{l s='All best sellers' mod='blockbestsellers'}</a></div>

   {else}

{l s='No best sellers at this time' mod='blockbestsellers'}
   {/if}
</div>
</div>
<!-- /MODULE Block best sellers -->

 

Can anyone help what is wrong with that prices? In First and fourth and fifth product it shows the price great...

 

Of course everybody can use this code for its shop :) But the prices are not shown well...

 

And sorry for thyt styling, I am going to add it to external css file after it will be working :)

 

 

Thanks

Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

I have a different problem though. For some reason, the prices in my blockbestsellers.tpl module are appearing rounded!!! So that you can understand exactly what I mean, I have for example a product that is supposed to cost 14,95€, but it displays the price of 14,00€! For some reason it is removing all the decimals from the real price (,95), but then displays the price with two zero decimals (,00).

 

This is probably because I edited my blockbestsellers.php file some time ago in order to display random best selling products. In my PrestaShop 1.4.8.3 I edited line 104 of my blockbestsellers.php file, where I took:

 

$bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 5);

 

and I replaced it with:

$bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 1, ($nb ? $nb : 10), NULL, NULL, false, true, true, 2);
shuffle($bestsellers);

 

Perhaps if somebody could explain to me what all the different part of that array are for, maybe I can solve the problem.

 

Is anybody else getting rounded decimals on their blockbestsellers module? Many thanks for any knowledge and input!

Link to comment
Share on other sites

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