在OpenCart 2中添加新模块位置 [英] Adding New Modules Positions to OpenCart 2

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

问题描述

我想为模块添加更多职位.如何在opencart 2中添加新的模块位置?

I want to add more Positions for modules. How can I add a new module position in opencart 2?

在这里,我喜欢这些信息.但是,它仅适用于旧版本的OpenCart. http://www.opencartnews.com/tutorials/adding-new-modules-职位/

Here, I like this information. but, it is work only for OpenCart older version. http://www.opencartnews.com/tutorials/adding-new-modules-positions/

如何在Opencart 2中实现同一目标?

How can the same thing be achieved in Opencart 2?

请帮助...!

推荐答案

您可以通过修改以下核心文件来实现.

You can achieve this by modifying the following core file.

  1. admin/view/template/design/layout_form.tpl 在此选择标签中添加新职位

  1. 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() {

然后您必须在catalog/view/theme/default/template/common中添加模板和控制器 您可以使用与content_top.php&中的相同代码content_top.tpl,只需将文件重命名为您的新职位名称即可.

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.

然后在Home控制器或需要此位置的任何其他页面中,您必须添加

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; ?>

例如,要显示主页上的位置,请将<?php echo $new_position; ?>添加到catalog/view/theme/YOUR_THEME/template/common/home.tpl

For example, to show the position on the home page, you'll add <?php echo $new_position; ?> to catalog/view/theme/YOUR_THEME/template/common/home.tpl

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

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