4

How can I solve this :

Unsupported operand types in C:\wamp\www\abc\app\code\core\Mage\ImportExport\Model\Export\Entity\Product.php on line 875

It occurs when trying to export products via the admin panel system -> import/export menu.

  • What version of php are you running? – Jon Holland Apr 28 '16 at 8:25
  • my current php version 5.5.12 – Gem Apr 28 '16 at 8:41
  • scrap my answer then...:) What version of Magento is it? – Jon Holland Apr 28 '16 at 8:44
  • magento 1.9.2.3 – Gem Apr 28 '16 at 8:47
  • that line does stand out as being different to all the others in that function so have posted an answer I think will work as a fix. – Jon Holland Apr 28 '16 at 8:58
6

Magento have a patch for this issue as SUPEE-6511.

Ask magento support for the official patch file, however the change provided is simple enough. Around line 875-ish in app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php you should update as follows.

-    $dataRow += $stockItemRows[$productId];
+    if (isset($stockItemRows[$productId])) {
+        $dataRow = array_merge($dataRow, $stockItemRows[$productId]);
+    }
  • Where can we find the official patch file for SUPEE-6511? We are having the same issue on CE 1.9.2.4 which doesn't offer Magento support. However, I would prefer to have the official patch on file if there is one. – Scruffy Paws Sep 15 '16 at 16:47
  • No official patch on hand sorry. Magento only generally hand out security patches. The only other source of patches would be github.com/brentwpeterson/magento-patches – Luke Rodgers Sep 15 '16 at 22:41
  • Fix mentioned here is correct, but issue still exists in 1.9.3.7 github.com/firegento/magento/blob/… – Marcel Lange Feb 7 '18 at 14:58
2

Assuming that the problem line (as you didn't specify your Magento version) looks something like this:

875:    $dataRow += $stockItemRows[$productId];

My first thing to check would be the version of php you are using. I do not think that, for pre PHP v5.2 (and some of v5.2...), the += operand is not supported for arrays, which this action is.

2

Looking at the rest of the $dataRow manipulations that line does look odd.

Try replacing

875:    $dataRow += $stockItemRows[$productId];

with

$dataRow = array_merge($dataRow,$stockItemRows[$productId]);

However, directly modifying core files is bad so you should override it but a quick test should show if it is working.

1

This worked great: $dataRow = array_merge($dataRow,$stockItemRows[$productId]);

0

This is perfectly work for me. Thanks.

$dataRow = array_merge($dataRow,$stockItemRows[$productId]);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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