Jump to content

[SOLVED] How to change featured products block in displayHome from 4 columns to 3 columns [SOLVED]


Recommended Posts

USING PRESTASHOP 1.6 > Default Theme

 

Good day PrestaShop Vets!  I'm trying to figure out how to change the featured products from 4 columns per row to 3 columns per row in displayHome.  I'm using displayLeftColumn as a sidebar of sorts and 4 columns of products is just too much.

 

Following the instructions of another thread (it's a dead thread, so I'm starting a fresh one), I changed the following in modules/homefeatured/views/templates/hook/homefeatured.tpl to a value of '3' ...

{assign var='nbItemsPerLine' value=4}

Unfortunately, it made no change.  I then inspected element in chrome and noticed by the classes, that it's still thinking it's working with 4 columns....I say this because it still has the following class assigned to every 4th ajax_block_product li class...

 

'last-in-line'

 

I was hoping that wouldn't be the case, as I would just need to modify some css, but unfortunately, even if I do resize the product classes to fit 3 per column, I'm going to have to add a float to every fourth product to "hack" the css.  I want to avoid doing css hacks for the sake of hacking css and would much rather learn how to make this module function the way I desire.

 

Thanks in advance, I appreciate your assistance & guidance.

Edited by vegaskev (see edit history)
Link to comment
Share on other sites

what theme you use? everything depends on it

 

Original post updated a couple of days ago @vekia.  Any guidance, advice, code snippets, etc. would be greatly appreciated.  Thanks in advance.  :)  Using the prestashop 1.6 default-bootstrap theme

Link to comment
Share on other sites

Hi,

 

from what I can see it looks like you'll need to edit the product-list first...

{if isset($products) && $products}
	{include file="$tpl_dir./product-list.tpl" class='homefeatured tab-pane' id='homefeatured' active=$active_ul}
{else}
  • Like 1
Link to comment
Share on other sites

Open yourtheme/product-list.tpl and find this code:

{if $page_name !='index' && $page_name !='product'}
        {assign var='nbItemsPerLine' value=3}
        {assign var='nbItemsPerLineTablet' value=2}
        {assign var='nbItemsPerLineMobile' value=3}
    {else}
        {assign var='nbItemsPerLine' value=4}
        {assign var='nbItemsPerLineTablet' value=3}
        {assign var='nbItemsPerLineMobile' value=2}
    {/if}

change to:

{if $page_name !='index' && $page_name !='product'}
        {assign var='nbItemsPerLine' value=3}
        {assign var='nbItemsPerLineTablet' value=2}
        {assign var='nbItemsPerLineMobile' value=3}
    {else}
        {assign var='nbItemsPerLine' value=3}
        {assign var='nbItemsPerLineTablet' value=2}
        {assign var='nbItemsPerLineMobile' value=3}
    {/if}
  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...