6

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.

7
  • What version of php are you running? Apr 28, 2016 at 8:25
  • my current php version 5.5.12
    – Gem
    Apr 28, 2016 at 8:41
  • scrap my answer then...:) What version of Magento is it? Apr 28, 2016 at 8:44
  • magento 1.9.2.3
    – Gem
    Apr 28, 2016 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. Apr 28, 2016 at 8:58

5 Answers 5

9

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]);
+    }
4
  • 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. Sep 15, 2016 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 Sep 15, 2016 at 22:41
  • Fix mentioned here is correct, but issue still exists in 1.9.3.7 github.com/firegento/magento/blob/… Feb 7, 2018 at 14:58
  • Thanks, I confirm that it worked from my end using Magento 1.9.2.1 Sep 23, 2019 at 5:32
4

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.

3

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.

1

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

0

This is perfectly work for me. Thanks.

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

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.