Post by dzamanakos » 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 :

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,

Newbie

Posts

Joined
Tue Feb 24, 2015 5:59 am

Post by IP_CAM » Sat Mar 31, 2018 11:32 pm

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

For Sale: Top URL's, including an OpenCart V-Pro Installation, similar to:
http://www.bigmax.ch - http://www.ipcam.li - http://www.jti.li
For Information + URL's offered, please contact me at: jti@jacob.ch
I am NOT available for Custom Support in existing OC Installations!
My Github Repositories: https://github.com/IP-CAM
Image


User avatar
Guru Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 9 guests