| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Side Menu with less HTML in the page | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Side Menu with less HTML in the page
On our site we have a side menu that looks like this:
This menu (based on the flyout menu I think) is created by taking the whole category structure, creating HTML from this and then hiding via CSS the parts that shouldn't be shown. This means that there is superfluous HTML in the code. We have a lot of categories and depth so that's a lot of HTML! So.. I've tried to recode the menu but rather than starting with the whole category structure, I take the path of the current location and then add in the siblings of each level to make my array. Code:
Which is used with this twig code Code:
Which all works. However.. I have some questions that I'll put in subsequent posts to keep this readable.
__________________
Core version: 5.5.xx |
|||||||
#2
|
|||||||
|
|||||||
Re: Side Menu with less HTML in the page
First question... How do I improve the Twig code. It really should be recursive rather than the 4 loops that I have.
I tried using Macros from here: https://stackoverflow.com/questions/8326482/how-to-render-a-tree-in-twig but it couldn't make it work.
__________________
Core version: 5.5.xx |
|||||||
#3
|
|||||||
|
|||||||
Re: Side Menu with less HTML in the page
Second question...
The current menu works better when you are in a parent category. Currently when I'm in the Pressure category it shows the immediate children... but in my new version the children aren't shown (as they aren't in the path)... I'm not sure if I should somehow add children to the array in this case or maybe the class method should work with parents and children rather than the siblings?
__________________
Core version: 5.5.xx |
|||||||
|
|||
X-Cart forums © 2001-2020
|