I want to add more Positions for modules. How can I add a new module position in opencart 2?
Here, I like this information. but, it is work only for OpenCart older version. http://www.opencartnews.com/tutorials/adding-new-modules-positions/
How can the same thing be achieved in Opencart 2?
Please help...!
I know it is bit late , but it might be helpful to others , also the above answer helped me but for newbie to understand easily i am writing this.
I am inserting the new position content_footer in it.
Tested For 2.3.0.2
We will edit the files for admin side first
1] Go to admin/view/template/design/layout_form.tpl
By Default opencart gives 4 position for modules find the below code
so after copy this whole section from start of the table to the table closing and paste it below and change the content_bottom to content_footer
2] Now find the function addModule() and find the below line
Now add #module-content-footer
Same way below line for trigger
3] In admin/controller/design/layout.php find the below function
and this line in it
4] Now add following line in admin/language/en-gb/layout.php
Front Side Files Changing
1] Create a new template file in catalog/view/theme/themename/template/common/content_footer.tpl
2] Create a new controller file in Catalog/controller/common/content_footer.php and place the below code
3] Now add the following line in catalog/controller/common/home.php
4] Finally , to show the position on the home page, you'll add
to catalog/view/theme/themename/template/common/home.tpl
You can achieve this by modifying the following core file.
admin/view/template/design/layout_form.tpl add your new position in this select tag
<select name="layout_module[<?php echo $module_row; ?>][position]"
and also in this method at the bottom of the file
function addModule() {
And then you have to add a template and a controller in catalog/view/theme/default/template/common you can use the same code as it is in content_top.php & content_top.tpl, just rename the file as your new position name.
And then in Home controller or any other page where this position is required, you have to add
$data['new_position'] = $this->load->controller('common/new_position');
After adding it to controller, you need to add it to the template files. Add to all the page templates you want to show the custom position on.
<?php echo $new_position; ?>
For example, to show the position on the home page, you'll add
<?php echo $new_position; ?>
tocatalog/view/theme/YOUR_THEME/template/common/home.tpl