我剛剛使用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