Page 1 of 1

Getting fatal error with payment module

Posted: Thu Jun 09, 2016 3:27 am
by murrayg
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

Re: Getting fatal error with payment module

Posted: Thu Jun 09, 2016 8:06 am
by Qphoria
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'])

Re: Getting fatal error with payment module

Posted: Fri Jun 10, 2016 6:14 am
by murrayg
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?

Re: Getting fatal error with payment module

Posted: Sat Jun 11, 2016 5:53 am
by Cue4cheap
murrayg wrote: if (!in_array(strtoupper($this->session->data['currency'])), $currencies)) {

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

Mike

Re: Getting fatal error with payment module

Posted: Sat Jun 11, 2016 8:30 pm
by murrayg
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!

Re: Getting fatal error with payment module

Posted: Fri Aug 26, 2016 7:01 am
by HealthGeek
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 :-)))