prestatent Posted July 18, 2013 Share Posted July 18, 2013 (edited) Prestashop 1.5.4.1 Hi How do I get the parent(s) of a category in blocklayered.php? The reason I ask is that I no matter what sub-category a user chooses from a sub-menu, I always want to display from the parent category downwards. for example: Parent-Category 1 - Sub-Category 1 - Sub-Sub-Category 1 - Sub-Sub-Category 2 - Sub-Sub-Category 3 - Sub-Category 2 - Sub-Sub-Category 2-1 - Sub-Sub-Category 2-2 - Sub-Sub-Category 2-3 - Sub-Category 3 By default, if I choose Sub-Category 1 the layered navigation block would only show the 3 sub-categories underneath, whereas I would like to show everything. In other words, no matter what sub-category I choose, every sub-category under the parent is shown. My thinking is that if I can get the parent or grandparent of the sub-category, then I should be able to achieve this. Is this possible with this approach? Thanks for reading. Edited July 19, 2013 by prestatent (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted July 19, 2013 Share Posted July 19, 2013 If you want to get the parent, given that you currently have the category object, you can use $category->id_parent Link to comment Share on other sites More sharing options...
prestatent Posted July 19, 2013 Author Share Posted July 19, 2013 Thank you Nemo1, I'll give this a try. Cheers Link to comment Share on other sites More sharing options...
prestatent Posted July 19, 2013 Author Share Posted July 19, 2013 Hi I tried this fix but did not work. The amendment had to be included in blocklayered.php. I created a function to get the parent of the category and return the parent/grandparent of the selected category. This does now seem to work. Thanks. 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