我刚刚使用hostjars启动器文件开发了我的第一个Opencart(1.5.6)插件。Opencart自定义模块没有显示在前端
管理部分工作得很好,并且所有的前端代码都被放置了。但是,由于某些原因,该模块并未在网页上显示,即使该位置已在管理员中定义。
以下是参考前端控制器代码(仅供参考,没有错误抛出这让我觉得,也许控制器不被调用或东西):
<?php class ControllerModulebevyspecials extends Controller {
protected function index($setting) {
//Load the language file
$this->language->load('module/bevy_specials');
//Load the models
$this->load->model('module/bevy_specials');
//Get the title from the language file
$this->data['heading_title'] = $this->language->get('heading_title');
//Retrieve Checkout Special Products
$products = $this->model_module_bevy_specials->getBevySpecials();
if(Count($products)>0){
foreach ($products as $product) {
$product_info = $this->model_catalog_product->getProduct($product['product_id']);
$this->data['title'] = $product['title'];
if (isset($product_info)) {
$this->data['products'][] = array(
'product_id' => $product_info['product_id'],
'name' => $product_info['name'],
'discount' => $product['discount']
);
}
}
}
else{
$this->data['noRecord'] = true;
}
//Choose which template to display this module with
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/bevy_specials.tpl')) {
$this->template = $this->config->get('config_template') . '/template/module/bevy_specials.tpl';
} else {
$this->template = 'default/template/module/bevy_specials.tpl';
}
//Render the page with the chosen template
$this->render();
} } ?>
我失去了任何特定的代码显示网页上的模块?
当谈到模块开发时,Opencart文档非常少,我试过在Web上搜索解决方案,但找不到确切的答案。
任何输入将不胜感激。提前致谢!
更多信息: 一个问题,虽然发现.....在管理面板,当我加2个或更多布局的模块(例如加入到“列左”的联系页面和“内容顶”对于帐户页面),前端则显示以下错误:
Warning: Invalid argument supplied for foreach() in D:\xampp171\htdocs\opencart\catalog\controller\common\column_left.php on line 49
你是否通过管理面板安装了你的模块? – Hassan
@Hassan ....绝对是,它的安装,配置和启用。您可以在此处看到管理面板的快照。http://www.bevysolutions.com/stackoverflow/snap-26jan2014.jpg –
您在哪里定义了安装/卸载方法。当你想要在opencart设置中插入它的条目时安装模块。你是怎么做到的 ? 来源:http://docs.opencart.com/pages/viewpage.action?pageId=754759 – Hassan