A week early Opencart.com launched its new design and layout, and we were going through the website and found that it is using full-width layout but default OpenCart installation does not have full width in the content area. Thus we started to make the full-width position for different layout in OpenCart 2.2.
For OpenCart 3 full-width module visit below:
https://webocreation.com/opencart-free-extension-to-add-full-width-position-in-layout
Admin works
Find following code at admin/view/template/design/layout_form.tpl
Just below it, add the following code:
Now on the same page find:
$('#module-column-left, #module-column-right, #module-content-top, #module-content-bottomThen add #module-content-full just after that code above in two places and final JavaScript codes will look like below:
import App from './app.js'; const app = new App(); $('#module-column-left, #module-column-right, #module-content-top, #module-content-bottom, #module-content-full').delegate("select[name*='code']", 'change', function() { var part = this.value.split('.'); if (!part[1]) { $(this) .parent() .find('a') .attr( 'href', 'index.php?route=extension/module/' + part[0] + '&token=' ); } else { $(this) .parent() .find('a') .attr( 'href', 'index.php?route=extension/module/' + part[0] + '&token=&module_id=' + part[1] ); } }); $('#module-column-left, #module-column-right, #module-content-top, #module-content-bottom, #module-content-full').trigger('change');Admin works completed now we have to work in front end or presentation layer.
Front end works:
First, make the content full Controller and .tpl file to show the modules:
Create a file named content_full.tpl at catalog\view\theme\default\template\common folder and place the code below:
Similarly, create another file named content_full.php at catalog\controller\common folder and place the code below:
load->model('design/layout'); if (isset($this->request->get['route'])) { $route = (string)$this->request->get['route']; } else { $route = 'common/home'; } $layout_id = 0; if ($route == 'product/category' && isset($this->request->get['path'])) { $this->load->model('catalog/category'); $path = explode('_', (string)$this->request->get['path']); $layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path)); } if ($route == 'product/product' && isset($this->request->get['product_id'])) { $this->load->model('catalog/product'); $layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']); } if ($route == 'information/information' && isset($this->request->get['information_id'])) { $this->load->model('catalog/information'); $layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']); } if (!$layout_id) { $layout_id = $this->model_design_layout->getLayout($route); } if (!$layout_id) { $layout_id = $this->config->get('config_layout_id'); } $this->load->model('extension/module'); $data['modules'] = array(); $modules = $this->model_design_layout->getLayoutModules($layout_id, 'column_full'); foreach ($modules as $module) { $part = explode('.', $module['code']); if (isset($part[0]) && $this->config->get($part[0] . '_status')) { $module_data = $this->load->controller('extension/module/' . $part[0]); if ($module_data) { $data['modules'][] = $module_data; } } if (isset($part[1])) { $setting_info = $this->model_extension_module->getModule($part[1]); if ($setting_info && $setting_info['status']) { $output = $this->load->controller('extension/module/' . $part[0], $setting_info); if ($output) { $data['modules'][] = $output; } } } } return $this->load->view('common/content_full', $data); } }Now show this at the account/login layout
Open catalog\controller\account\login.php controller file and find the following line:
$data['column_right'] = $this->load->controller('common/column_right');Then below it add following code:
$data['content_full'] = $this->load->controller('common/content_full');Open catalog\view\theme\default\template\account\login.tpl file and find following code:
Below it adds the following line of code:
Ocmod file to add the full-width position to all layout at the front end:
Full Width Module Position 1.0 WebOCreation https://webocreation.comFull_Width_Position_1_1
load->controller('common/column_left'); ]]> load->controller('common/content_full'); ]]> ]]> ]]> Enjoy and let me know if there is any confusion so that we can move ahead to solve the problem.
Search terms: new module positions, opencart position, module positions, opencart layout, opencart layout tutorials
Rupak Nepali
Author of four Opencart book. The recent are Opencart 4 developer book and Opencart 4 user manualRelated Posts
eCommerce, Web 3.0, blockchain, nft and metaverse3 min readTop August Holidays and Their Usefulness for E-commerce Marketing
Drupal6 min readReflectionClass usage: Get all properties or methods of a Class in PHP
eCommerce, Web 3.0, blockchain, nft and metaverse3 min readJuly Holiday E-Commerce Marketing Calendar & Social Schedule for Online Retailers
eCommerce, Web 3.0, blockchain, nft and metaverse4 min readThe Ultimate Marketing Calendar for E-Commerce Stores (June 2025 Edition)
eCommerce, Web 3.0, blockchain, nft and metaverse4 min readE-Commerce Holiday Calendar for May: Sales & Marketing Ideas to Boost Revenue
Ecommerce Templates3 min readMay the Sales Be With You: Star Wars-Themed E-commerce Campaign Ideas
Comments
GGeorge
•Hi,
Did all the steps but:
1. Full Width module appears twice in the admin pannel
2. The content selcted for Full Width position is not shown on front endCan you help?
AAND
•Thanx… Rupak… that saved the day… nice… super…
RRupak Nepali
•Go to catalog\controller\common\content_full.php and at around 51 you will see
echo $layout_id;
And at line 54 you will see
print_r($modules);Remove these codes and you will be able to enjoy the module.
Or I have updated the download files. You can download it.
Thanks
RupakAAND
•Hi… thanks for the great tutorial… but i have one question… i did exactly as you describe here a even downloaded your ocmod at tried with it but i am constantly getting an error or message on the top of the page…
1Array ( [0] => Array ( [layout_module_id] => 111 [layout_id] => 1 [code] => layerslider.32 [position] => column_full [sort_order] => 0 ) )the position is working in admin and in front page to… but how can i get reed of this… something is not completly wright i guess sand i cant figure out what is it?
I am using OC 2.3.0.2 default template.
Thank you in advance
PPavel
•Hi! Thank you for this helpfull article. But I have another issue, maybe you know a way to make position in the footer that will be shown on all pages?
Thank you.RRupak Nepali
•Yes, similar step as for now
Iivang
•hello, Does it work on opencart 2.3?
RRupak Nepali
•Hi Avni,
Hope you have clicked the blue plus button and select module.
I was also one time confused by changing the Account to another module.Hope that can be one case.
If not then can you please provide me the Extensions Modifications error logs.
Thanks
RupakAAvni
•on saving the data for full width in admin side, it is not storing and getting back to the default one.
Featured Posts
Docker set up for Opencart for local development
Opencart 4 book: User manual to create a full-fledged eCommerce store
OpenAI ChatGPT uses in eCommerce business
40 cool final year college projects for students in 2025
OpenCart 4.1.0.0 Launch: New Features, Updates, and Fixes
Host LAMP stack in AWS Lightsail, Opencart hosting in AWS
25 SEO best practices for Opencart 4 & 3 with free SEO Opencart module
Categories
- Drupal
- Ecommerce Templates
- eCommerce, Web 3.0, blockchain, nft and metaverse
- Extensions
- Featured
- Internship
- Javascript
- Mongo DB Solution
- Opencart
- Opencart 3
- Opencart 4
- Opencart 4 tutorial, opencart 3 tutorials, custom module theme development
- Opencart extensions free download
- OpenCart Guide
- Opencart themes for free
- OpenCart Tips and Tricks
- Opencart Videos
- Other
- PHP development
- Programming