I have created a custom category attribute.
Now i need to access it’s value in the _getHtml() function from Topmenu.php.
Can anyone tell me how to do this?:)
Any help is appreciated 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You won’t be able to get that kind of data inside the TopMenu block, unless you make some changes.
The Navigation is built up using a generic tree structure which doesn’t have an concept of what a category is, however this is built up elsewhere using the categories.
If you look inside Topmenu.php you will see where the Navigation is built up:
This will fire off an event, which has an observer attached which will build up the navigation items for us, which happens to be:
You can then add your new attribute into the Node data, which will then be available inside Topmenu.php
Example:
You should then be able to use this inside Topmenu::_getHtml()