Page 1 of 1
A design decision has created a bug
Posted: Mon Nov 23, 2026 2:44 pm
by burt
A design decision I took when updating to Bootstrap 5 was to have the "cart icon" showing
at all times in the Navbar regardless of whether the Navbar is "expanded" (ie large screens) or "collapsed" (ie small screens such as mobile phone), as so;
Expanded
navbar-cart-lg.png
Collapsed
navbar-cart-sm.png
I think this looks ideal.
I think it is good UI to always have that cart icon showing.
Re: A design decision has created a bug
Posted: Mon Nov 23, 2026 2:45 pm
by burt
The problem
In the Content Module for the Navbar, shopowner can select to ALWAYS have the Navbar Expanded, put another way it will never Collapse on small screens. This would be ideal for Navbars that maybe only have 2 or 3 items (eg Search, Account, Cart or whatever).
Your Admin > Modules > Content > {select Navigation Bar} > Edit
Here you will see a number of options, the one that matters is "Collapse", which is the breakpoint at which the Navbar, guess what, collapses;
navbar-admin.png
Choosing "navbar-expand" keeps the Navbar expanded.
Re: A design decision has created a bug
Posted: Mon Nov 23, 2026 2:47 pm
by burt
Choosing this "navbar-expand" option, results in strange effects on the shop side, as so (note that I have removed a few of the Navbar Items (brand, specials, currencies) so that you can more clearly see the effect.
Expanded
This is perfectly fine and looks as expected.
navbar-expand-1.png
Collapsed
This is not. It has a strange effect of moving the Cart to the left, and being slightly off center.
navbar-expand-2.png
Re: A design decision has created a bug
Posted: Mon Nov 23, 2026 2:59 pm
by burt
Noting that this solution is only for those shopowners who want to use Navbar set to `navbar-expand`, which is likely very very few shopowners!
The Solution
Change the pseudo-code that creates the icons;
- Copy \includes\modules\content\navigation\templates\tpl_cm_navbar.php
to
\templates\{your template name}\includes\modules\content\navigation\tpl_cm_navbar.php
and remove (or comment out) this block of code:
Code: Select all
echo '<a class="nav-link d-block d-sm-none me-2" data-bs-toggle="offcanvas" href="#offcanvasCart" role="button" aria-controls="offcanvasCart">';
echo sprintf(NAVBAR_ICON_CART_CONTENTS, $_SESSION['cart']->count_contents(), '');
echo '</a>';
- Copy \includes\modules\navbar\templates\tpl_nb_shopping_cart.php
to
\templates\{your template name}\includes\modules\navbar\tpl_nb_shopping_cart.php
and remove this piece of code:
After doing this, the Navbar should look correct both;
Expanded
fix-expand-1.png
Collapsed
fix-expand-2.png
Re: A design decision has created a bug
Posted: Mon Nov 23, 2026 3:03 pm
by burt
TY to
@randers for finding this esoteric bug and reporting it to me.
I will address the bug in a more permanent fashion at some point in the future, but as it will affect hardly any shopowners it can go at the bottom of the list. Attached .zip of the two files above (using `override` template), with cart icon fixed for those of you wanting to use `navbar-expand` on the Navbar.