0
votes

I have a rather weird problem. I have to create a webshop in magento.

The problem is in the navigation menu. My client wants to have a list item with a dropdown which has all the categories. But he also wants to choose a couple of the categories to display seperately in the nav bar as well.

Of course i could use a url rewrite for this. But the problem is. The client can change the chosen categories at any time. And these categories can have subcategories too.

So far i created a new category attribute which has a dropdown with all the categories. I want to make it so that if this attribute is set. Then the category which it will load on this listitem will change (the value of the dropdown items are the ID's of the categories).

I hope i'm making sense so far.

I have no idea how to fix this problem though.

Hope someone can point me in the right direction.

Any help is appreciated :)

2

2 Answers

1
votes

I would suggest using a new boolean attribute for the category model, which shows/hides the category in the navbar. Quite easy to add using the setup model. For the dropdown, my solution would be to fetch the subtree for the specific category with an AJAX call and update the dropdown. And I would add a little caching of subtrees, to avoid excessive db action. Not sure if I fully understand what you are trying to achieve though ;)

This way the client can en/disable the displayed categories and rearrange everything else without problems in the future.

0
votes

Novalis answer above here works fine. But i solved it a little different in the end.

I added a new field to the create category page. This field had a dropdown list of all the categories. If you create a category and select something in the dropdown. It would load all information of the selected category in the dropdown.

So i created three categories for the client. (featured category 1,2 and 3). And in all three i selected something in this dropdown. So now it shows: Jeans accessoiries and bags.