Tamade Posted September 30, 2020 Share Posted September 30, 2020 (edited) Hello I have 3 categories: Kitchens Bedrooms Lounges I have a module that shows on category and subcategory pages. How do I get it to show only on the kitchen category and subcategory pages? Edited September 30, 2020 by Tamade (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted September 30, 2020 Share Posted September 30, 2020 ????????????? screenshot ????????????? PrestaShop version ????????????? Link to comment Share on other sites More sharing options...
Tamade Posted October 3, 2020 Author Share Posted October 3, 2020 I have succeeded but I want to improve it, I have v.1.7.6.5 classic In this way I say if the category id is number 6 if ($ category.id> = 6. How do I declare that if the category name is "bedrooms". Thank you Link to comment Share on other sites More sharing options...
Guest Posted October 4, 2020 Share Posted October 4, 2020 in module: if (Context::getContext()->category->name == 'Bedrooms') { /* your function */ } Link to comment Share on other sites More sharing options...
Guest Posted October 4, 2020 Share Posted October 4, 2020 or in module: $cat = array('Kitchens', 'Bedrooms', 'Lounges'); if (in_array(Context::getContext()->category->name, $cat)) { /* your function */ } Link to comment Share on other sites More sharing options...
Tamade Posted October 10, 2020 Author Share Posted October 10, 2020 I can't get him to show it. I have this set (it works but if I make a new category I have to modify here too) catalog/listing/category.tpl {if ($category.id >=6 && $category.id<=8) || $category.id ==23 || $category.id ==39 || $category.id ==40 || ($category.id >=10 && $category.id<=19 ) || $category.id ==44 || ($category.id >=50 && $category.id<=59) } {hook h='displayTopCategory1'} {/if} Link to comment Share on other sites More sharing options...
Guest Posted October 11, 2020 Share Posted October 11, 2020 (edited) And why do you write it to a tpl template? If you have a module, write it to the php module. Hook displayTopCategory1 is your own? After all, it is easy to display a list of categories in the configuration of your module, check the categories and add a condition for displaying your own tpl file as a hook. Sample module: Edited October 11, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
Tamade Posted October 13, 2020 Author Share Posted October 13, 2020 Yes, the hook is mine. It looks too nice to be able to choose the categories, but I don't have so much knowledge to be able to do it. I thought it would be easier. Thanks for your help. Link to comment Share on other sites More sharing options...
Guest Posted October 13, 2020 Share Posted October 13, 2020 Well, this is the easiest way. Clear, possibility in the category block and search, etc. Yes, good programming knowledge is needed. The module should have approx. 250 lines of code, approx. two hours of work, including testing. Link to comment Share on other sites More sharing options...
Tamade Posted October 14, 2020 Author Share Posted October 14, 2020 How much does a module like the one you show cost? 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