Post by murrayg » Thu Jun 09, 2016 3:27 am

hi,

I am hoping someone could help. I get a fatal error when trying to test the Payfast payment module:

Fatal error: Call to undefined method Cart\Currency::getCode() in /home/diysotgx/public_html/catalog/model/payment/payfast.php on line 46

I get a similar error on the shipping module, also related to currencies which makes me think the error is not with the module but elsewhere?

Any help, please

Newbie

Posts

Joined
Thu Jun 09, 2016 3:16 am

Post by Qphoria » Thu Jun 09, 2016 8:06 am

This is due to the change from 2.1.x to 2.2.x

EDIT: catalog/controller/payment/payfast.php

FIND:

Code: Select all

$this->currency->getCode()
REPLACE WITH:

Code: Select all

$this->session->data['currency'])

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by murrayg » Fri Jun 10, 2016 6:14 am

Hi There,

Thank you for the feedback.

I still have an issue, this is what the code on line 46 looked like before I changed it:

if (!in_array(strtoupper($this->currency->getCode()), $currencies)) {
$status = false;
}

This is what it looked like after I changed it:

if (!in_array(strtoupper($this->session->data['currency'])), $currencies)) {
$status = false;
}

Then I get this error:

Parse error: syntax error, unexpected ',' in /home/diysotgx/public_html/catalog/model/payment/payfast.php on line 46

I have tried a few things to fix the syntax error ( I know nothing about PHP) but just get different errors.

Please could you help?

Newbie

Posts

Joined
Thu Jun 09, 2016 3:16 am

Post by Cue4cheap » Sat Jun 11, 2016 5:53 am

murrayg wrote: if (!in_array(strtoupper($this->session->data['currency'])), $currencies)) {

Try:
if (!in_array(strtoupper($this->session->data['currency']), $currencies)) {

Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by murrayg » Sat Jun 11, 2016 8:30 pm

Hi Guys,

I got the payment module working after changing the code as advised- thanks for all the help!!!

I also had to change my payfast setting in the admin panel to "all zones" under the Geo Zone option.

After that I got this error:

Error: Could not load template /home/diysotgx/public_html/catalog/view/theme/default/template/default/template/payment/payfast.tpl! in /home/diysotgx/public_html/system/storage/modification/system/library/template/basic.php on line 26

I then searched, and found this:

http://forum.opencart.com/viewtopic.php?f=191&t=159306

I changed the code, and just changed payu to payfast, and it works!

You guys rock!

Now to try and get my courier extensions working!

Newbie

Posts

Joined
Thu Jun 09, 2016 3:16 am

Post by HealthGeek » Fri Aug 26, 2016 7:01 am

murrayg wrote:Hi Guys,

I got the payment module working after changing the code as advised- thanks for all the help!!!

I also had to change my payfast setting in the admin panel to "all zones" under the Geo Zone option.

After that I got this error:

Error: Could not load template /home/diysotgx/public_html/catalog/view/theme/default/template/default/template/payment/payfast.tpl! in /home/diysotgx/public_html/system/storage/modification/system/library/template/basic.php on line 26

I then searched, and found this:

http://forum.opencart.com/viewtopic.php?f=191&t=159306

I changed the code, and just changed payu to payfast, and it works!

You guys rock!

Now to try and get my courier extensions working!
Thank you SO MUCH !!!
I just installed Payfast this evening, and have been struggling with Internal Server Error. Eventually found the correct file to expose logs on (index.php on my OpenCart root dir), and the instructions and links on this thread helped me fix the errors.
Amazing people on this forum, I'm extremely grateful :-)))

Newbie

Posts

Joined
Wed Jul 20, 2016 12:44 am
Who is online

Users browsing this forum: No registered users and 14 guests