Help about adding some custom menu in header
Posted: Sat Mar 31, 2018 12:47 am
Hi, i'm new to how opencart works and i have a question.
In OC 2.0.31 i had a vqmod that made a custom menu.
The vqmod was in the form of :
after there was some code with foreach and html to make custom styling to the menu...
and finally i did a echo $my_menu at the end of the code...
after updating to OC 2.3.0.2 i have some php errors in this code, as i understand i cant use $this->load->language('module/category'); etc inside the tpl files anymore (i got errors of Uncaught Error: Call to a member function language() on null etc).
I'm thinking of moving the code to a controller file and just echo $my_menu to the template file, but i cant file which controller file will send this variable to the template.
I've tried for example to print_r the $data variable from catalog/controller/common/header.php to the template but the var is empty.
Do i have to move the code to a controller file, or there is another way to read this data in the template file? If i have to use a controller file which one is it?
best regards,
In OC 2.0.31 i had a vqmod that made a custom menu.
The vqmod was in the form of :
Code: Select all
<file name="catalog/view/theme/journal2/template/journal2/headers/default.tpl">
<operation>
<search position="after" offset="29"><![CDATA[<?php echo $this->journal2->settings->get('config_secondary_menu'); ?>]]></search>
<add><![CDATA[
$this->load->language('module/category');
$this->load->model('catalog/category');
$this->load->model('catalog/product');
$my_data['categories'] = array();
$categories = $this->model_catalog_category->getCategories(106);
$my_menu=...
and finally i did a echo $my_menu at the end of the code...
after updating to OC 2.3.0.2 i have some php errors in this code, as i understand i cant use $this->load->language('module/category'); etc inside the tpl files anymore (i got errors of Uncaught Error: Call to a member function language() on null etc).
I'm thinking of moving the code to a controller file and just echo $my_menu to the template file, but i cant file which controller file will send this variable to the template.
I've tried for example to print_r the $data variable from catalog/controller/common/header.php to the template but the var is empty.
Do i have to move the code to a controller file, or there is another way to read this data in the template file? If i have to use a controller file which one is it?
best regards,