Jump to content

[SOLVED] Different layouts for different categories in product list not working with shop search.


Recommended Posts

Hi,

 

I have two different ways a product list is displayed in my shop, one for "Articles" category and one for all the rest. The reason is that we have lots of information articles that we want to be searchable. the CMS in prestashop isn't searchable from the shop search function.

 

The issue I have is how to show a mixed layout when searching the shop.

 

To achieve the different layouts, I've used the following structure:

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

{if $category->name=="Articles"}

... display the "article" layout

{else}

... display the product layout

{/if}

{/foreach}

 

All that I can think of is that $category->name isn't passed to product-list.tpl when doing a search. What variable can I use?

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

I think I have sorted this out.

 

I put {debug} at the top of my product-list.tpl file and out spewed all the variables that the page was being passed.

 

the variable that was being passed was called

$product.category =="articles"

 

That seemed to work.

 

Amazing, in asking the question on the forum, made me discover the answer myself!

 

Nik

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