I was using following code for Check module position. So, It is working fine in OpenCart 1.5.6. When module Enabled in Content left & right panel so I want to hide javascript code in OpenCart
but, it is not working in Opencart 2.0
How can be achieved in Opencart 2.0?
in .tpl file
<?php if ($module['position'] == 'content_bottom' || $module['position'] == 'content_top') { ?>
//add your code Here
<?php } ?>
add in .php file
$this->data['module'] = $setting;
I have found simple solution. This is working like charm.
Step 1
in .tpl file. (You want to that module. featured.tpl etc...)
Step 2
add in .php file (You want to that module. featured.php etc...)
Step 3 (if, You are used OpenCart 2.0.0.0 version)
catalog/controller/common/{content_top, content_bottom, content_right, content_left}.php,
Find the below code
and add the below code after
Step 3 (if, You are used OpenCart 2.0.1.x. version)
catalog/controller/common/{content_top, content_bottom, content_right, content_left}.php,
Find the below code
and add the below code after
OC 2.0 is a major update so lots of things working on OC 1.5.X might not work on OC 2.X
Eg OC 1.5.x we used to add layout to module now in OC 2.0 we add Modules to layout So In 1.5.x we used to find Module and it's associated positions, Now we find Positions and it's associated Modules.
Suppose you are working on
\catalog\controller\common\content_top.php
After
$modules = $this->model_design_layout->getLayoutModules($layout_id, 'content_top');
Which fetches all the modules set on
content_top
of the particular layoutAdd
Now in
content_top.tpl
you can write scriptSimilarly You can do the same for
content_bottom
as well