Post by cableintel » Fri Mar 15, 2019 8:32 pm

I'm trying to call the customer group ID in the payment method and shipping method controllers.

I'm using the following code:

Code: Select all

//groupId
$this->load->language('account/account');

if ($this->customer->isLogged()) {
	      		$data['groupId'] = $this->customer->getGroupId();
} elseif ($this->config->get('config_customer_group_id')) {
	     		$data['groupId'] = $this->config->get('config_customer_group_id');
}
When called in the template like so:

Code: Select all

<p>GroupID: <?php echo (int)$groupId ?></p>
It returns as:

GroupID: 0

When the intended groupID is 4.

The signed in user is assigned to a group with the ID of 4.

Newbie

Posts

Joined
Tue Feb 26, 2019 10:50 pm

Post by joakimcom » Sat Mar 16, 2019 1:37 am

Your code is correct, so likely you are just going insane =(

More seriously, there is nothing notably wrong with your logic, double check that the controller is the actual controller being used, and that $data is being passed to the view?

Newbie

Posts

Joined
Sat Mar 16, 2019 12:48 am


Post by straightlight » Sat Mar 16, 2019 4:31 am

The signed in user is assigned to a group with the ID of 4.
Ensure the user is logged in and that the validated store in your query has been configured from your admin - > systems - > settings - > edit settings page.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by 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

Post by cableintel » Mon Mar 18, 2019 9:10 pm

straightlight wrote:
Sat Mar 16, 2019 4:31 am
The signed in user is assigned to a group with the ID of 4.
Ensure the user is logged in and that the validated store in your query has been configured from your admin - > systems - > settings - > edit settings page.
Can you elaborate on this?

Newbie

Posts

Joined
Tue Feb 26, 2019 10:50 pm
Who is online

Users browsing this forum: Google [Bot] and 8 guests