2

Webshopapps has deprecated their much used matrix rate modules, so they won't support PHP7.1+, which means a lot of people cannot upgrade php to a secure version.

The issues are fx. the use of pushing strings to arrays shorthand ([]).

&$itemGroup = array()
$itemGroup[] = $item;

How do i fix these type of compability issues?

1 Answer 1

4

I've found a way to fix this on one our client's Magento 1.9 websites.

In the app/code/community/Webshopapps/Wsacommon/Helper/Shipping.php file, there is a function called getItemInclFreeTotals. We've found that it was breaking on the following line (around line 312 I believe):

self::processItemGroup($itemGroup, $item);

We added a check in to determine if the variable $itemGroup was an array or not. If you add the following lines of codes above the line earlier in the post:

// Applying fix for PHP 7.2
if (!is_array($itemGroup) && empty($itemGroup)) {
    $itemGroup = array();
}

We've been able to load in the relevant shipping rates on our website.

The final code for the whole function:

$freeMethodWeight = $totals->getFreeMethodWeight();

// Applying fix for PHP 7.2
if (!is_array($itemGroup) && empty($itemGroup)) {
    $itemGroup = array();
}

self::processItemGroup($itemGroup, $item);

return true;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.