PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

 

change background in category

8 replies to this topic
#1
jakubek

    PrestaShop Apprentice

  • Members
  • PipPip
  • 237 posts
hello
I want change background of center_column when i change category.
I made 4 diffrent id of column to change background.
            
{if $smarty.get.id_category == 3 OR $smarty.get.id_category == 17 OR $smarty.get.id_category == 18}

{/if}



its work but only static and only when i'm in category when i open porduct ( in this category) its not working, somebody know how can i do it?
Posted Image

#2
jakubek

    PrestaShop Apprentice

  • Members
  • PipPip
  • 237 posts
it's not posible ??
Posted Image

#3
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
Try the following instead:





This will allow you to set a different background in the center column for categories 3, 17 and 18. Use #center_column3 for category 3, $center_column17 for category 17, #center_column18 for category 18 and #center_column for all the other categories.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#4
jakubek

    PrestaShop Apprentice

  • Members
  • PipPip
  • 237 posts
this what i wrote is mainly category and 2 subcategory.
yes in know but i need change in category and subcategory and in produckt of this cat and sub.
if i open product of this category i want have still this same background what i have in maindly category.
Posted Image

#5
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
I've made it so that the background stays the same for both the category and product, assuming the product's default category is that category, by using the following code:


{if $smarty.get.id_category == 3 OR $product->id_category_default == 3}

Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#6
jakubek

    PrestaShop Apprentice

  • Members
  • PipPip
  • 237 posts
its not working in my maindly category, it is id.category = 2 and where im in this category its ok but when i go to subcategory its not working...

{if $smarty.get.id_category == 2 OR $product->id_category_default == 2}

{/if}


i try it with subcategory 11 its ok but in produkt not ;s

      {if $smarty.get.id_category == 11 OR $product->id_category_default == 11} 

{/if}


aa $product->id_category_default - dont show anythink ;|
Posted Image

#7
jakubek

    PrestaShop Apprentice

  • Members
  • PipPip
  • 237 posts
some idea to solve it?
Posted Image

#8
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
How do you have your categories and products set up? Are your products in multiple categories or just one? If they are in just one category, you will need to set the "Default category" of the product to the category it is in instead of Home for $product->id_category_default to work. If your products are in multiple categories, the method I described won't work. You can try using $cookie->last_visited_category instead:

{if $smarty.get.id_category == 2 OR $cookie->last_visited_category == 2}

Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#9
jakubek

    PrestaShop Apprentice

  • Members
  • PipPip
  • 237 posts
i have maindly category and in this category is many sub category and i want this same bg in sub category its posible to do it?
Posted Image