cancel
Showing results for 
Search instead for 
Did you mean: 

Drop Down Column Configuration

SOLVED

Drop Down Column Configuration

Hi Smart Magento peeps,

I've had a magento site for sometime, a fashion website, and I have always had a 2 column drop down for my designer/brands in the main menu. My original developer some how( probably coded) had those 2 columns "responsive" ( might be using the wrong word here) so that when I would add  or delete a designer  it would "equalize" the number of designers in each column, so at worst, one column would have 1 extra if i had an odd number. My NEW developer up dated me to 2.4.7 at the beginning of the year and I now have 2 columns that  do not do that anymore.  So I end up with 5 in one column and 10 in the 2nd column. It seems to break on alphabet at G.   2 is the perfect number of columns, 1 is too long, 3 is confusing.  My developer says it can not  be done, which is frustrating, because it was done!  Any help or thoughts? I'm also not sure exactly what that feature would be called as you can tell, so not sure if there are modules. TIA   Barb

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Drop Down Column Configuration

It sounds like you had some custom code previously that would evenly distribute the menu items between the two columns in your dropdown navigation. This type of functionality is not built-in to Magento out of the box.

There are a couple ways this could be achieved:

1. Custom module with an observer: An observer could help for events like layout_load_before and then do some logic to count the total menu items, divide by 2, and assign the items to the columns accordingly.

2. Javascript: On page load, use JS to count the navigation items, figure out the halves, and move elements between the columns.

 

The function you require is achievable but would require some custom code. I would suggest your developer look into one of these options. An observer would probably be the cleanest approach. The key is just dividing the total number of items by 2, then assigning the first half to column 1, second half to column 2. Some additional logic may be needed to handle any leftovers if total items is an odd number. But this should give you a good starting point to implement the responsive multi-column nav you want.

View solution in original post

1 REPLY 1

Re: Drop Down Column Configuration

It sounds like you had some custom code previously that would evenly distribute the menu items between the two columns in your dropdown navigation. This type of functionality is not built-in to Magento out of the box.

There are a couple ways this could be achieved:

1. Custom module with an observer: An observer could help for events like layout_load_before and then do some logic to count the total menu items, divide by 2, and assign the items to the columns accordingly.

2. Javascript: On page load, use JS to count the navigation items, figure out the halves, and move elements between the columns.

 

The function you require is achievable but would require some custom code. I would suggest your developer look into one of these options. An observer would probably be the cleanest approach. The key is just dividing the total number of items by 2, then assigning the first half to column 1, second half to column 2. Some additional logic may be needed to handle any leftovers if total items is an odd number. But this should give you a good starting point to implement the responsive multi-column nav you want.