clacour_hc Posted June 16, 2017 Share Posted June 16, 2017 Hello, On prestashop 1.6, i used this code to show an image or another thing only in a specific category. {if $category->id == "25" } But, with Prestashop 1.7, i don't found the code to use. Anyone to help me.. I know, i'm a noob! :-) (and sorry for my english) Thanks a lot ! Clément Link to comment Share on other sites More sharing options...
Rus_3ds Posted January 22, 2018 Share Posted January 22, 2018 This is work for Prestashop 1.7 {if $category.id == 3} { some action } {/if} 1 1 Link to comment Share on other sites More sharing options...
Sasha Chirico Posted March 8, 2019 Share Posted March 8, 2019 (edited) On 1/22/2018 at 1:33 PM, Rus_3ds said: This is work for Prestashop 1.7 {if $category.id == 3} { some action } {/if} Bro, you're code is wrong. I'm looking for the right one. EDIT {if $category->id == 3} Some action {/if} Edited March 8, 2019 by Sasha Chirico Right code (see edit history) Link to comment Share on other sites More sharing options...
Kogkalidis Posted March 27, 2019 Share Posted March 27, 2019 Guys both can be right or wrong. If we talk about children categories in a category controller, category.id is proper. If we talk about the category itself, category->id is proper. 1 Link to comment Share on other sites More sharing options...
chris821 Posted November 22, 2022 Share Posted November 22, 2022 Hi guys, I'll stick to it. For example, how can I integrate the following condition in version 1.7.8 on a Productcategorie-Page: If category ID =2 then output <p>Hello</p> alternatively with several categories If category ID =2,3,4,5 then output <p>Hello</p> I've tried all of the above examples. 🤔 Link to comment Share on other sites More sharing options...
Kogkalidis Posted November 22, 2022 Share Posted November 22, 2022 Can you share screenshot or even better a link in order to assist you further? Link to comment Share on other sites More sharing options...
chris821 Posted November 22, 2022 Share Posted November 22, 2022 Sure, i am trying, to set the content width on specific categories to 12 columns. For example, in Category 6 or Category 6 and 9 In the Screenshot i said "all Category Pages", that is not what i want ... Link to comment Share on other sites More sharing options...
Kogkalidis Posted November 22, 2022 Share Posted November 22, 2022 (edited) You really should study more the extension system between the template parts. For example you have catalog/listing/category.tpl which extends catalog/listing/product-list.tpl You have to add a block like this {block name='right_column'}{/block} But with a UNIQUE name e.g. {block name='greek_mod'}{/block} Then you call it in category.tpl and make the respective alteration.NOT tested, but it should work. Always backup 😎 Edited November 22, 2022 by Kogkalidis (see edit history) Link to comment Share on other sites More sharing options...
chris821 Posted November 22, 2022 Share Posted November 22, 2022 OK, I'll take a closer look again, thanks. But how do I get a query as described above, .. if category ID == xx ... (or more catgoreises) is that even possible in prestashop 1.7? Link to comment Share on other sites More sharing options...
Kogkalidis Posted November 22, 2022 Share Posted November 22, 2022 https://www.igorkromin.net/index.php/2016/05/16/using-php-in_array-function-with-smarty/ {if $category.id|in_array:['1', '5', '9', '18' .....]} Do your thing {else} Do something else {/if} 2 Link to comment Share on other sites More sharing options...
chris821 Posted November 22, 2022 Share Posted November 22, 2022 Yes sir .. it works. That´s exactly what i was looking for, thank you!!! 😃 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now