Luis C Posted December 4, 2019 Share Posted December 4, 2019 Hey everyone: I'm having some trouble setting up ps_categorytree module in my store. I hooked the module to a custom hook in order to display it in a different place as per default. I'd like to show it in every page, but I'm getting errors depending on what page I'm accessing. Product page throws an exception: Cannot use object of type Category as array and CMS pages (obviously) throw a no declared "Category" index error Any idea if this can be attained without messing with the core to much? I'm using Prestashop 1.7.6.1 Cheers! Link to comment Share on other sites More sharing options...
joseantgv Posted December 4, 2019 Share Posted December 4, 2019 Could you paste the complete error? Link to comment Share on other sites More sharing options...
Luis C Posted December 4, 2019 Author Share Posted December 4, 2019 28 minutes ago, joseantgv said: Could you paste the complete error? Oh wow... surprisingly enough, the error does not occur right at the top of the template (page). Not even at the beginning of the ps_categorytree template, but after showing the main categories, as it tries to load all subcategories. OMG! Right as I was typing the response I found my answer and my 'oopsie', and I've corrected it. My bad. Kids, do NOT be me. Think before posting. For anyone wanting to know what happened, here's why you should NOT use $category without knowing what you're doing: I tried to call $category.id from within ps_categorytree.tpl to determine current category and apply a class to my li and a elements. It obviously works on categories page, but not on the rest of the pages. Corrected it by conditioning it to certain pages, now it works just fine. Thanks joseantgv for trying to help this fool. 1 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