Mihai Rus
Mihai Rus

Reputation: 1

PrestaShop display subcategories from category ID

I use PrestaShop 1.6 and I want to display an image when I'm on a specific category page and I want the image to be visibile on subcategories of that category.

{if $subcategory->id == 15}
    style="background-position: 70% 72%; background-image: url(../img.jpg);"
{/if}

Upvotes: 0

Views: 641

Answers (2)

Knowband Plugins
Knowband Plugins

Reputation: 1317

You can add the following code to the category.tpl file of your store:

{if $category->id_parent == 15} //For example the category ID is 15
.your_element_selector { 
background-position: 70% 72%; background-image: url(../img.jpg);
}
{/if}

Note: You should create a separate element to show the image.

Upvotes: 1

Julien Lachal
Julien Lachal

Reputation: 1141

You could do something like this:

{if $subcategory->id == 15 || $subcategory->id_parent == 15}
    style="background-position: 70% 72%; background-image: url(../img.jpg);"
{/if}

Upvotes: 1

Related Questions