Post by mred » Fri Jan 26, 2024 2:32 am

OC Version: 4.0.2.3
Theme: Default
Extension/Mods: Square Intergration 4.0.2, TMD Options/Dependent Options, TMD Live Update.

I installed the Square Intregration 4.0.2 for my Opencart store. And have been getting an error in the error logs. I contacted ISenseLabs and they have not been responsive to the issue. Looking into the logs I see that it may not be related to the Square extension but it may be related to OC and they way PHP 8.1 looks at a float. Here is the errors from the logs.

2024-01-25 11:02:09 - PHP Warning: Undefined array key "value"
File: /home/itsabbiz/public_html/testing/extension/squareup/admin/controller/payment/squareup.php
Line: 335 <---As a result form currency.php line 48

2024-01-25 11:02:09 - PHP Warning: Undefined array key "currency_code"
File: /home/itsabbiz/public_html/testing/extension/squareup/admin/controller/payment/squareup.php
Line: 335<---As a result form currency.php line 48

2024-01-25 11:02:09 - PHP Warning: Undefined array key "currency_value"
File: /home/itsabbiz/public_html/testing/extension/squareup/admin/controller/payment/squareup.php
Line: 335<---As a result form currency.php line 48

2024-01-25 11:02:09 - 0: Opencart\System\Library\Cart\Currency::format(): Argument #1 ($number) must be of type float, null given, called in /home/itsabbiz/public_html/testing/extension/squareup/admin/controller/payment/squareup.php on line 335<---As a result form currency.php line 48
File: /home/itsabbiz/public_html/testing/system/library/cart/currency.php
Line: 48<---seems to be causing the issue.

As you can see on the bottom error, Line 48 is not happy with the ($number) as being float. Which in turn causes the above errors of an "Undefined array key ..."

Here is where I could use some help. The currency.php is Opencarts code. How can I get this resolved so that the error is not present and the Square extentsion code can execute and not error?

Here is the line of code in suspect from Opencart currentcy.php (line 48)

public function format(float $number, string $currency, float $value = 0, bool $format = true): string {
if (!isset($this->currencies[$currency])) {
return '';
}

A link to your site: itsab.biz/testing

Is it a single or multistore setup? single store.

Newbie

Posts

Joined
Fri Jan 26, 2024 2:09 am

Post by ADD Creative » Sun Jan 28, 2024 3:54 am

The issue is with the payment extension passing the wrong values to the currency format.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 3 guests