How to replace the 3rd product with an Image in product list for Perstashop?

Ad

For example, there are 9 products show at the category per page

I would like to replace the 3rd product to an image (just hardcode it is ok, no backend need), and so the 3rd product are now go to the next block

Are there any module for this purpose or how to customize it? Notice that the 3rd image need to remain there after sorting/ filtering the product list.

The product list template:

{foreach from=$products item=product name=products}
...
{/foreach}

Thanks a lot

Ad

Answer

Ad

There should be a variable called "nbItemsPerLine" in top of product-list.tpl. If that is not the case add this to the top of your template file

{assign var='nbItemsPerLine' value=3}

And then change the foreach loop like this :

{foreach from=$products item=product name=products}
  {if $smarty.foreach.products.iteration % $nbItemsPerLine == 0}
    <li>
      <img src="..." />
    </li>
  {else}
    [current code...]
  {/if}
{/foreach}
Ad
source: stackoverflow.com
Ad