Page 1 of 1

Help about adding some custom menu in header

Posted: Sat Mar 31, 2018 12:47 am
by dzamanakos
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 :

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=...
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,

Re: Help about adding some custom menu in header

Posted: Sat Mar 31, 2018 11:32 pm
by IP_CAM
Well, you are using a paid CUSTOM Theme, and this Theme uses Custom Files,
like the /headers/default.tpl, you therefore have to get in touch with
those, creating this theme, or creating the VqMod, to get some help, I assume.
But THIS Code still exists in later V-2 Versions as well, just to have it mentioned.
Just check the controller/product/category.php file, to find out about.

Code: Select all

$this->load->model('catalog/category');
$this->load->model('catalog/product');
Ernie