Hello,
Using OC 4.1.0.3
When adding sub-categories, I can get 5 to line up, up and down vertically in the drop down list.
When adding the 6th it starts a new column, and the text overflows the text area ( box )
How do I prevent the drop down list from starting a new column and keep all the sub-categories all lined up vertically ?
I hope this makes sense.
Thanks for your time,
Dan
Using OC 4.1.0.3
When adding sub-categories, I can get 5 to line up, up and down vertically in the drop down list.
When adding the 6th it starts a new column, and the text overflows the text area ( box )
How do I prevent the drop down list from starting a new column and keep all the sub-categories all lined up vertically ?
I hope this makes sense.
Thanks for your time,
Dan
Last edited by gunownergear on Wed Jul 09, 2025 8:31 pm, edited 1 time in total.
Are you talking about on the front-end or in the admin?gunownergear wrote: ↑Fri Jul 04, 2025 10:57 pmHow do I prevent the drop down list from starting a new column and keep all the sub-categories all lined up vertically ?
Perhaps give us a link to your site?
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Hi Paul,
Yes on the front end. If I put more than 5 sub-categories in a category, the 6th one will start a new column within the container. The whole sub-category container will double in width, which may be ok and that is how it's supposed to work. I was just wanting to know if there was a setting somewhere where that could be changed without too much trouble. Thought there might be a setting that has a limit of 5, which you could increase the limit.
Unfortunately I consolidated 3 sub-categories into 1 on my website and now it only shows the one column.
Thanks for your time,
Dan
Yes on the front end. If I put more than 5 sub-categories in a category, the 6th one will start a new column within the container. The whole sub-category container will double in width, which may be ok and that is how it's supposed to work. I was just wanting to know if there was a setting somewhere where that could be changed without too much trouble. Thought there might be a setting that has a limit of 5, which you could increase the limit.
Unfortunately I consolidated 3 sub-categories into 1 on my website and now it only shows the one column.
Thanks for your time,
Dan
Hi Dan, I think give us a link to your site so we can see what's going on.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Hi Paul,
https://gunownergear.com
Hover over the 1st one beside Home "Bags & Cases"
I made 5 test categories and the Range Bags category is supposed to be there .
I suppose the reason it does not overflow is because the name is short?
Thanks for your help,
Dan
https://gunownergear.com
Hover over the 1st one beside Home "Bags & Cases"
I made 5 test categories and the Range Bags category is supposed to be there .
I suppose the reason it does not overflow is because the name is short?
Thanks for your help,
Dan
In Opencart 3 for a the menu list without columns
in catalog/view/theme/default/template/common/menu.twig
Change
to
In Opencart 4 for a the menu list without columns
in catalog/view/theme/default/template/common/menu.twig
Change
to
Or something similar
in catalog/view/theme/default/template/common/menu.twig
Change
Code: Select all
<div class="dropdown-inner"> {% for children in category.children|batch(category.children|length / category.column|round(1, 'ceil')) %}
Code: Select all
<div class="dropdown-inner"> {% for children in category.children|batch(category.children|length / 1) %}
in catalog/view/theme/default/template/common/menu.twig
Change
Code: Select all
{% for category in categories %}
{% if total > 20 %}
{% set batch = (total / 4)|round(0, 'ceil') %}
{% set column = 1 %}
{% else %}
{% set batch = 100 %}
{% set column = (total / 5)|round(0, 'ceil') %}
{% endif %}
Code: Select all
{% if total > 20 %}
{% set batch = (total / 1)|round(0, 'ceil') %}
{% set column = 1 %}
{% else %}
{% set batch = 100 %}
{% set column = (total / 1)|round(0, 'ceil') %}
{% endif %}
Or something similar
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
YES ! Mona you did it !
I'm using version 4.1.0.3 and my code didn't quite look like that, but just changing the numbers did it.
Path was: catalog/view/template/common/menu.twig
You folks are the greatest !
Thank you,
Dan
UPDATE:
OK Mona,
Initially your code worked, on the first category, but as I hovered over the others, some drop down lists would line up under the category name as they should, but others would line up to the left of the page, or maybe the column grid that they are in, and were horizontal instead of vertical.
I found that if you just change two lines it seems to work as it should.
The code example above is the original code except for the bottom two lines.
It seems the percentage number has to match the total number, or it doesn't work.
I just went to 10 on my test, when adding the 11th sub-category it started a new column.
I tested with desktop, but It seems to work with all browser widths.
Again I'm working with version 4.1.0.3
Thanks
Dan
I'm using version 4.1.0.3 and my code didn't quite look like that, but just changing the numbers did it.
Path was: catalog/view/template/common/menu.twig
You folks are the greatest !
Thank you,
Dan
UPDATE:
OK Mona,
Initially your code worked, on the first category, but as I hovered over the others, some drop down lists would line up under the category name as they should, but others would line up to the left of the page, or maybe the column grid that they are in, and were horizontal instead of vertical.
I found that if you just change two lines it seems to work as it should.
Code: Select all
{% if total > 20 %}
{% set batch = (total / 4)|round(0, 'ceil') %}
{% set column = 4 %}
{% else %}
{% set batch = 10 %}
{% set column = (total / 10)|round(0, 'ceil') %}
It seems the percentage number has to match the total number, or it doesn't work.
I just went to 10 on my test, when adding the 11th sub-category it started a new column.
I tested with desktop, but It seems to work with all browser widths.
Again I'm working with version 4.1.0.3
Thanks
Dan
Glad you have it sorted and thank you for coming back with a working solution.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Who is online
Users browsing this forum: No registered users and 10 guests