Jump to content

Add hr clear to manufacturers block after every third manufacturer


Recommended Posts

Hi all, I m quite new to prestashop and smarty. I m trying to accomplish a following task (prestashop 1.4.6).

 

I have a list of manufacturers and i m displaying theirs logos in list with <li> left floated, the problem is that there should be just three manufacturers in a row. So I need to put a clearing element after every third manufacturer. Was trying to accomplish this with smarty in manufacturers block template like this:

 

<ul>
{$i=1}
{foreach from=$manufacturers item=manufacturer name=manufacturer_list}

 <li><a href="{$link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)}" title="{l s='More about' mod='blockmanufacturer2'} {$manufacturer.name}">
			 <img src="{$img_ps_dir}m/{$manufacturer.id_manufacturer}-manufa.jpg" alt="{$manufacturer.name|truncate:15:'...'|escape:'htmlall':'UTF-8'}" />
			 {*comment {$manufacturer.name|escape:'htmlall':'UTF-8'} *}</a></li>
  {$i++}
 {if $i is div by 4}
<hr class="cll" />
{/if[spam-filter]
{/foreach}
</ul>

 

I guess the problem will be somewhere around my if clause, but i get the numbers and { braces displayed in front end.

 

Anyone will help please .... Thanks

Link to comment
Share on other sites

Hi, thanks for quick answer, but i m not sure how to use it for my case. If understand right the example, i would have to add 3 classes, and the fourth as clearing or how ? Thanks and sorry, i m really lost in smarty and programming stuff.

 

The If clause is working allright the thing is that when i do

{$i++}

 

It displays variable in front end...... Any idea how to do it without displaying the i ?

 

Thanks

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