Hello,
I'm working on a large Magento site, where the previous development agency creates a load of custom variables, with static HTML dropdowns based on a category, it only came to light when we started making new sub-categories and these weren't updating on the frontend, and I found around 30 or so custom variables all with static html dropdown code in them.
Could someone point me in the right direction, on how to create these so they are handled dynamically building the dropdowns of sub-categories from a category?
Thanks in Advance.
Mal
I don't think anyone can actually help you without seeing the actual codebase and what was done and why.
Hello @mallongstoaf62,
You can utilize third-party mega menu modules or develop a custom module to replace the static conditional code. If the custom code originates from a specific module, consider disabling it. This allows you to leverage Magento's default menu functionality for the category dropdowns.
Thanks,
Here is a way to dynamically generate category dropdowns in Magento:
Use the Magento layer navigation block to output categories recursively. In your theme template, call:
{{block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/left.phtml"}}
This will render the category tree structure as defined in the Admin panel using the left.phtml template.
You can pass parameters like showing children levels, sorting, and maximum categories to display.
The key benefit over static HTML is this block automatically updates as you add/edit categories in the admin. No need to manually maintain dropdowns.