How to add new layout and assign a module to a page using it in OpenCart
In order add a new layout and assign a module to a page, you should perform the following:
Step 1: Create a new layout.
Not all pages have layouts by default, f.e. the ‘Specials’ page. So, in order to assign any Module to the Specials page, the Layout has to be created.
To create the Layout (f.e. for the Specials page), please do the following:
- Navigate to System -> Design -> Layouts in your Opencart admin panel.
- Click the ‘Insert’ button at the top right.
- Specify the ‘Layout Name’.
- Click the ‘Add Route’ button and add the route for the Layout (f.e.’product/special’ for the ‘Specials’ page).
- Click ‘Save’ at the top right.
Step 2: Assign the Module to the page Layout.
- Navigate to Extensions -> Modules.
- Select the Module you would like to assign and click ‘Edit’.
- In the Layout field please select the Layout for the page you would like to assign the module to.
- Click ‘Save’ at the top right