Jump to content

How to show some category in grid view and some as list view


Zen_j1

Recommended Posts

i think you can modify the product-list.tpl

<div {if isset($id) && $id} id="{$id}"{/if} class="display-items product_list product-list grid row{if isset($class) && $class} {$class}{/if} calc-items">
	{foreach from=$products item=product name=products}

you can set the grid view or list view  for different category id 

Link to comment
Share on other sites

i think you can modify the product-list.tpl

<div {if isset($id) && $id} id="{$id}"{/if} class="display-items product_list product-list grid row{if isset($class) && $class} {$class}{/if} calc-items">
	{foreach from=$products item=product name=products}

you can set the grid view or list view  for different category id 

Thanks for your reply can please tell me little more where to paste code in product-list.tpl and where and who to add Ids of category which needs to shown as list view. 

Link to comment
Share on other sites

hi,

in category.tpl  

add the code like


{if $category->id eq xxx1 }
    {assign var='view' value='list'}
{elseif $category->id eq xxx2 }
    {assign var='view' value='grid'}
{elseif}
      {assign var='view' value='grid'}  
{if}

then in   product-list.tpl


<div {if isset($id) && $id} id="{$id}"{/if} class="display-items product_list product-list grid row{if isset($class) && $class} {$class}{/if} calc-items">

remove the default view "grid" add the variable  view

 

the code will be like

<div {if isset($id) && $id} id="{$id}"{/if} class="display-items product_list product-list  row   {if isset($view) && $view} {$view}{/if}    {if isset($class) && $class} {$class}{/if} calc-items">
Edited by Irder (see edit history)
Link to comment
Share on other sites

 

hi,

in category.tpl  

add the code like


{if $category->id eq xxx1 }
    {assign var='view' value='list'}
{elseif $category->id eq xxx2 }
    {assign var='view' value='grid'}
{elseif}
      {assign var='view' value='grid'}  
{if}

then in   product-list.tpl


<div {if isset($id) && $id} id="{$id}"{/if} class="display-items product_list product-list grid row{if isset($class) && $class} {$class}{/if} calc-items">

remove the default view "grid" add the variable  view

 

the code will be like

<div {if isset($id) && $id} id="{$id}"{/if} class="display-items product_list product-list  row   {if isset($view) && $view} {$view}{/if}    {if isset($class) && $class} {$class}{/if} calc-items">

i have add the code at bottom category.tpl

 

{if $category->id eq 4 }
    {assign var='view' value='list'}
{elseif $category->id eq 8 }
    {assign var='view' value='grid'}
{elseif}
      {assign var='view' value='grid'}  
{/if}
 
And in product list tpl
 
<ul{if isset($id) && $id} id="{$id}"{else} id="product_list"{/if} class="product_list row{if isset($class) && $class} {$class}{/if}">
 
I have version prestashop 1.6.1.13 for test
 
I am error 
 
This page isn’t working

HTTP ERROR 500

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