Post by mareksafranek » Wed Nov 08, 2017 4:58 am

How to make a display, appear, customer group on customer's logged in their home page?
Version 3.0.2.0
I want to make that when my customer logs in just display their group on next to their name.

Thus my customer can check and see their group(level) any time on website.

Please help.

Newbie

Posts

Joined
Fri Sep 08, 2017 6:10 am

Post by straightlight » Wed Nov 08, 2017 5:41 am

In catalog/controller/common/header.php file,

find:

Code: Select all

$data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', true), $this->customer->getFirstName(), $this->url->link('account/logout', '', true));
add above:

Code: Select all

$this->load->model('account/customer_group');

$customer_group = $this->model_account_customer_group->getCustomerGroup($this->config->get('config_customer_group_id'));
Then, replace:

Code: Select all

$data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', true), $this->customer->getFirstName(), $this->url->link('account/logout', '', true));
with:

Code: Select all

$data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', true), $this->customer->getFirstName(), html_entity_decode($customer_group['name'], ENT_QUOTES, 'UTF-8'), $this->url->link('account/logout', '', true));
Then. in your catalog/language/en-gb/common/header.php file, since the definition cannot be found anywhere in the platform nor on the Github master files, as this issue may be a bug, add the following at the bottom of the file:

Code: Select all

$_['text_logged'] = '<a href="%s">Welcome %s</a> (Group: %s) <a href="%s">Logout</a>';
This should resolved the problem.

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: oporelerboy and 27 guests