In OpenCart 2.x, when putting a module in the Column Left space, the layout changes even when the module is empty on a particular page.
For instance, when adding the Filter module to the Category layout, if you've got a filter that only applies to one category, the layout is still affected in every other category, leaving a 1px tall column on the left side of the page.
In order to fix this, I've changed the first line in the common/column_left.tpl file to this:
Code: Select all
<?php if ($modules && (!in_array('',$modules))) { ?>
The original code is:
My modification checks to see if the $modules array actually has any content, as OpenCart still passes an empty array to the template even if there is no content, rather than passing false at some point earlier in the controller:
I'd be interested to see if anyone else has solved this problem in a different way, perhaps by modifying the controller file to detect when the queries come up empty. I feel like this solution is a bit hacky, and doesn't really fix the missed use case in the controller logic. I simply didn't have time this afternoon to try and understand the controller file.