Jump to content

different product tpl for each category


Recommended Posts

This will required a whole lot of modifications. Basically, you want to edit the product controller, especially the initContent function, so that you ccan return a different template based on the id_category_default.

 

Of course, if you are not happy in setting this up manually, you have to override the category class as well, add a new column to ps_category like template_name, then create a back office override as well to manage the template selection

 

 

So, tons of stuff involved! :)

Link to comment
Share on other sites

  • 2 weeks later...

Did you manage to achieve what you were after ?

If not, I have done something similar, and probably easier.

 

In the header.tpl, start your body tag like this...

 

<body  class="{if isset($category)}cat{$category->id|escape:'htmlall':'UTF-8'}{/if}

 

which will set the body class as "cat1, cat2" etc

 

Then in your category.css you can target .cat1 .inline_list  {

 

and so on :)

 

Ive just done this to place different background for each cat, and it worked fine.

 

Hope it helps

  • Like 1
Link to comment
Share on other sites

yes, my solution is just for design.

Although they could add extra stuff in a div and 'hide' it off pages that its not needed on ?

I know it will still be loaded, but hidden from view :)

 

Im going to use different layouts for categories.

Some using grid view, and some list view.

Ill see how it goes

Link to comment
Share on other sites

  • 2 years later...

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