Jump to content

[SOLVED] Best Sellers Block - more items - how?


Recommended Posts

Hello,

I have this website www[dot]girl-fashion[dot]ro.

I'm trying to put 6 products in the best sellers block in the right.

Problem is it only shows 5 items and the 6th picture is a 404.gif and the link doesn't work either..

This is how the blockbestsellers.tpl looks like:

<!-- MODULE Block best sellers -->

{l s='Top sellers' mod='blockbestsellers'}

   {if $best_sellers|@count > 0}

getImageLink($best_sellers.0.link_rewrite, $best_sellers.0.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.0.legend}" />
           {if $best_sellers|@count > 1}getImageLink($best_sellers.1.link_rewrite, $best_sellers.1.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.1.legend}" />
getImageLink($best_sellers.2.link_rewrite, $best_sellers.2.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.2.legend}" />
getImageLink($best_sellers.3.link_rewrite, $best_sellers.3.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.3.legend}" />
getImageLink($best_sellers.4.link_rewrite, $best_sellers.4.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.4.legend}" />
getImageLink($best_sellers.5.link_rewrite, $best_sellers.5.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.5.legend}" />
     {/if}



{l s='All best sellers' mod='blockbestsellers'}
   {else}

{l s='No best sellers at this time' mod='blockbestsellers'}
   {/if}


<!-- /MODULE Block best sellers -->



What should I do?

Thanks

44712_E7F9g7tToNRtTKSwrhQq_t

Link to comment
Share on other sites

The product shows correctly everywhere.

I think I didn't modify the bestsellersbloc.tpl correctly.


This was the original code:

<!-- MODULE Block best sellers -->

{l s='Top sellers' mod='blockbestsellers'}

   {if $best_sellers|@count > 0}

getImageLink($best_sellers.0.link_rewrite, $best_sellers.0.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.0.legend}" />
           {if $best_sellers|@count > 1}getImageLink($best_sellers.1.link_rewrite, $best_sellers.1.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.1.legend}" />{/if}

{$product.name|escape:'htmlall':'UTF-8'}

{l s='All best sellers' mod='blockbestsellers'}
   {else}

{l s='No best sellers at this time' mod='blockbestsellers'}
   {/if}


<!-- /MODULE Block best sellers -->



I'm sure I didn't modify it correctly, I don't know much about php.

Again this is what it looks like now:

<!-- MODULE Block best sellers -->

{l s='Top sellers' mod='blockbestsellers'}

   {if $best_sellers|@count > 0}

getImageLink($best_sellers.0.link_rewrite, $best_sellers.0.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.0.legend}" />
           {if $best_sellers|@count > 1}getImageLink($best_sellers.1.link_rewrite, $best_sellers.1.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.1.legend}" />
getImageLink($best_sellers.2.link_rewrite, $best_sellers.2.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.2.legend}" />
getImageLink($best_sellers.3.link_rewrite, $best_sellers.3.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.3.legend}" />
getImageLink($best_sellers.4.link_rewrite, $best_sellers.4.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.4.legend}" />
getImageLink($best_sellers.5.link_rewrite, $best_sellers.5.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$best_sellers.5.legend}" />
     {/if}



{l s='All best sellers' mod='blockbestsellers'}
   {else}

{l s='No best sellers at this time' mod='blockbestsellers'}
   {/if}


<!-- /MODULE Block best sellers -->

Link to comment
Share on other sites

What I've noticed is that the link of that 404.gif image goes to the product page which I'm on at that time.

Like if I'm on Product #1 page that thumbnail with 404.gif goes to Product #1 page

If I'm on Product #5 page, it goes to Product #5 page.

Link to comment
Share on other sites

I guess you only retrieve 5 products, but try to display 6 products.
So you need to change the code to retrieve 6 products.

Change this line in /modules/blockbestsellers/blockbestsellers.php

FROM

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



TO

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



hope this helps

Link to comment
Share on other sites

  • 2 years later...
  • 8 months later...

An adition to this. If you want to change the number of items in Prestashop 1.5.4.1 in bestsellers block you have to edit the file in modules/blockbestsellers/blockbestellers-home.tpl and this line

{assign var='nbItemsPerLine' value=3}

Change value=3 for the number you want :) 

 

The one apported bye NOSaint works only if the numbers are the same. If not you have to change as I say 

Link to comment
Share on other sites

×
×
  • Create New...