Post by madmikefalkirk » Tue Dec 12, 2017 2:55 am

Hello!
Yes, i know there are extentions that will do what i need, but they cover everything when i need a specific thing, and am trying to get the hang of coding stuff for myself!
Anyway, I am trying to customise a cash on delivery payment.
All I need it to do is not take payment straight away (which it does) but only be accessible to a specific customer group.
No matter what I try, it mostly does not work, or occasionally, works but is not hidden.... so i am missing something.
I spat the dummy last night, and must have deleted it, so am starting again from scratch! Anyway, if i figure it out i will update here, any pointers would be great.

New member

Posts

Joined
Fri Nov 06, 2015 6:53 pm

Post by madmikefalkirk » Tue Dec 12, 2017 3:02 am

I have been trying this
1. EDIT: catalog/model/payment/cod.php

2. FIND:
Code: Select all

$method_data = array();
3. AFTER, ADD:
Code: Select all

if ($this->customer->getCustomerGroupId() != '2') {
$status = false;
}

Change "2" to the id of the customer group you want to allow.

But i think its for an older version, i cannot find the corresponding code on my OC 3.

New member

Posts

Joined
Fri Nov 06, 2015 6:53 pm

Post by straightlight » Tue Dec 12, 2017 11:46 pm

But i think its for an older version, i cannot find the corresponding code on my OC 3.
I am not sure what you mean ... catalog/model/extension/payment/cod.php file:

Code: Select all

$method_data = array();
does exist on line 20.

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 madmikefalkirk » Wed Dec 13, 2017 1:34 am

DOH!
I could not see it for looking for it!!

Now....
I get internal server error if i add that code snippet..... need to check whats going on

New member

Posts

Joined
Fri Nov 06, 2015 6:53 pm

Post by straightlight » Wed Dec 13, 2017 1:39 am

I get internal server error if i add that code snippet..... need to check whats going on
Look at your access logs on your host console's most recent lines for index 500. What do the details provide?

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

Users browsing this forum: No registered users and 8 guests