检查OpenCart 2.0中的模块位置 [英] Check module position in OpenCart 2.0

查看:55
本文介绍了检查OpenCart 2.0中的模块位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码检查模块位置.因此,它在OpenCart 1.5.6中运行良好. 何时模块在左侧的内容中启用&右面板,所以我想在OpenCart中隐藏javascript代码

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

但是,它在Opencart 2.0中不起作用

but, it is not working in Opencart 2.0

如何在Opencart 2.0中实现?

How can be achieved in Opencart 2.0?

.tpl文件中的

<?php if ($module['position'] == 'content_bottom' || $module['position'] == 'content_top') { ?>
//add your code Here
<?php } ?>

添加.php文件

$this->data['module'] = $setting;

推荐答案

我找到了简单的解决方案.这就像魅力一样.

I have found simple solution. This is working like charm.

. (您要使用该模块.featured.tpl等...)

in .tpl file. (You want to that module. featured.tpl etc...)

<?php if ($module['position'] == 'content_bottom' || $module['position'] == 'content_top') { ?>
//add your code Here
<?php } ?>

步骤2

添加.php文件(您要添加到该模块.featured.php等...)

Step 2

add in .php file (You want to that module. featured.php etc...)

$data['module'] = $setting;


catalog/controller/common/{ content_top,content_bottom,content_right,content_left }.php,

catalog/controller/common/{content_top, content_bottom, content_right, content_left}.php,

找到下面的代码

if (isset($part[1]) && isset($setting[$part[1]])) {

并在下面添加以下代码

$setting[$part[1]]['position'] = basename(__FILE__, '.php');


catalog/controller/common/{ content_top,content_bottom,content_right,content_left }.php,

catalog/controller/common/{content_top, content_bottom, content_right, content_left}.php,

找到下面的代码

$setting_info = $this->model_extension_module->getModule($part[1]);

并在下面添加以下代码

$setting_info['position'] = basename(__FILE__, '.php');

这篇关于检查OpenCart 2.0中的模块位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆