Jump to content

Prestashop 1.7 left / right Columns display for Module


wiscem

Recommended Posts

Hi,

 

I ask if someone knows how to enable/disable displaying left/right columns for a module using PHP.

 

In 1.5 & 1.6 Prestashop versions, I used the following PHP code for controller:

 

class MySearchModuleFrontController extends ModuleFrontController
{

    public $display_column_left = true;
    public $display_column_right = true;

    public function initContent()

    {
      $this->display_column_left = false;
      $this->display_column_right = false;

 

        ....

     }

}

But now, on PS 1.7, it does not work. I tried many approachs but without result.

 

Thanks for help

 

Best regards

Wissem

 

 

Link to comment
Share on other sites

  • 11 months later...

Hello,
A working solution is to overwrite the FrontController::getLayout() function to return the layout you want to use.

 

class YourModuleFrontController extends ModuleFrontController
{
    public function getLayout()
    {
        return 'layouts/layout-left-column.tpl';
    }
    
    [...]
}

Available layouts are located in [YOUR_THEME_DIR/templates/layouts] directory.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...