Post by Kipras » Thu Mar 16, 2017 1:06 am

Hello,
I need help, I would like to make the "free checkout" payment method to be accessible only for a certain group, how would i do that?
I have this:

Code: Select all

if($customer_group_id == 2) {
			$status = true;
		}
But I get this error:

Code: Select all

Notice: Undefined variable: customer_group_id in .../public_html/catalog/model/payment/free_checkout.php on line 14
OC version 2.2.0.0
Thank you for your help in advance.

Newbie

Posts

Joined
Thu Jul 14, 2016 10:39 pm

Post by thekrotek » Thu Mar 16, 2017 2:17 am

That's because there's no such variable out there. You need to use this:

$this->customer->getGroupId()

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by Kipras » Thu Mar 16, 2017 2:43 am

thekrotek wrote:
Thu Mar 16, 2017 2:17 am
That's because there's no such variable out there. You need to use this:

$this->customer->getGroupId()
It works, thank you so much!

Newbie

Posts

Joined
Thu Jul 14, 2016 10:39 pm

Post by paulfeakins » Thu Mar 16, 2017 6:36 pm

If you need more control, look at something like this:
https://www.opencart.com/index.php?rout ... on_id=8390

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: No registered users and 6 guests