Post by Zanato » Thu Jul 06, 2017 3:10 am

Hi, I'm a total PHP noob so please be patient with me...

I'm trying to link to some css in the template that is only called for a specific customer group (called 'Trade'). Basically I want to display:none; for the class "price-old". ie. I want to hide the striked out original price and only show the reduced price applied to this customer group.

In the <head> I've placed the following,

Code: Select all

<?php if ($this->customer->isLogged() && ($customer_group['name'] == "Trade")):  ?>
<link rel="stylesheet" href="/catalog/view/theme/custom/trade_customers.css">
<?php endif; ?>
But I'm getting "Undefined variable: customer_group".

Can anyone point me in the right direction?
Last edited by Zanato on Fri Jul 07, 2017 4:48 pm, edited 1 time in total.

New member

Posts

Joined
Fri Oct 04, 2013 4:58 am
Location - Dublin, Ireland

Post by artcore » Thu Jul 06, 2017 4:26 am

In controller/common/header.php

if($this->customer->isLogged() && $this->customer->getGroupId() === '2') {//your wholesale cust. group id
$this->document->addStyle('catalog/view/...css');
}
No need to touch the tpl/twig

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

Post by Zanato » Fri Jul 07, 2017 4:48 pm

Worked a charm. Thanks Artcore!

New member

Posts

Joined
Fri Oct 04, 2013 4:58 am
Location - Dublin, Ireland

Post by artcore » Fri Jul 07, 2017 5:49 pm

You're welcome ;D

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
Who is online

Users browsing this forum: No registered users and 150 guests