Page 1 of 1

How to make a display customer group on customer homepage?

Posted: Wed Nov 08, 2017 4:58 am
by mareksafranek
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.

Re: How to make a display customer group on customer homepage?

Posted: Wed Nov 08, 2017 5:41 am
by straightlight
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.