Prestаshоp version 1.6 allows you to manage theme columns directly from your backoffice. In this article we will describe how this algorithm functions and will provide a code sample, which will output one column on the Manufacturer controller page and also when viewing goods of a certain brand, although the theme configuration will be set to 2 columns. This task we received from one of our customers, who had provided us with different versions of design for one and the same Manufacturer controller.
Theme columns are managed under the following address: Preferences->Themes
You can also manage the columns for each controller separately:
The settings are stored in the database in the following table: ps_theme_meta
:
Where id_theme_metа is the id of the settings:
id_theme – theme ID (the data is stored in the table ps_meta
, see the picture below)
id_meta – controller ID
left_column – left column setting
right_column – right column setting
Prestashop uses the class Theme to work with the store theme. You can see the list of available properties and methods in this file: classes/Theme.php
The following properties are responsible for setting up column rendering in the controllers: display_column_left
and display_column_right
. For one of our customers we have overriden the MаnufасturerCоntrоller in order to modify the behavior of the columns settings when all products of a certain manufacturer are being viewed. So now global controller settings are configured in the admin panel, but if you view a particular brand this enables the custom logic which turns off the columns:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
class ManufacturerController extends ManufacturerControllerCore { public function __construct() { parent::__construct(); if (Tools::isSubmit('id_manufacturer')) { // set 1-column template for current manufacturer $colums = array('left_column' => 1, 'right_column' => 0); } $this->display_column_left = $colums['left_column']; $this->display_column_right = $colums['right_column']; } } |
Sérgio Martins,
To do this you need to configure your “index” page properly.
How can i disable left column only on home page?
My Prestashop is 1.6.0.6