Ad
How To Replace The 3rd Product With An Image In Product List For Perstashop?
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
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
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad