Post by GilesM » Wed May 31, 2017 3:38 pm

Hi all - stuck again - finding the OpenCart learning curve fairly steep! MVC-L causing me all sorts of headaches!!

I understand from reading around that you cannot use $this in template file now.

So I have read quite a few posts and worked out that I think I need to define the $data['customer_group_id'] in the footer controller.

catalog/controller/common/footer.php

Code: Select all

if ($this->customer->isLogged()) {
     $data['customer_group_id'] = $this->customer->getGroupId();
} else {
     $data['customer_group_id'] = $this->config->get('config_customer_group_id');
}
Then I thought I would be able to use it in: catalog/view/theme/mytheme/template/common/footer.tpl

Code: Select all

if ($data['customer_group_id'] == 0) {
     // default customer
} else {
     // wholesale customer
}
I just get an undefined variable notice.

Sorry I am such a newb round here - making the leap from osCommerce is proving a bit of a shock to the system!
Last edited by GilesM on Wed May 31, 2017 5:48 pm, edited 1 time in total.

PGM

Don't pay for simple mods
My free modules: Filter resets in admin, Add extra flat shipping, Improved Admin Product Search and Canned Messages.
My site uses (free): Modification refresh button, Additional Alert Email Fix, TLT Structured Data
My site uses (paid): Journal2, Restrict catalog by customer group


New member

Posts

Joined
Mon May 29, 2017 8:28 pm

Post by artcore » Wed May 31, 2017 4:49 pm

Hi Giles,
The $data array is 'extracted' using php's extract() function meaning that the variable will be available as $customer_group_id; in your tpl
http://php.net/manual/en/function.extract.php

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

New member

Posts

Joined
Mon May 29, 2017 8:28 pm
Who is online

Users browsing this forum: No registered users and 5 guests