0

When we import the following CSV file using the standard Magento import method (not Dataflow Profiles), the inventory quantity (qty) field is unexpectedly being updated to a value of 4 for the SKU's listed below:

sku,dropship_cost
90352,5.5
90386,5.5

I have tested this repeatedly and it continues to update the qty field in addition to the fields above. As I understand it, only the fields in the CSV should be updated.

Does anyone know why this is happening or indeed how to prevent it from happening?

We are running Magento CE 1.7.0.2.

3
  • Cannot reproduce that. Can you tell us more about that "dropship_cost" attribute (it's not a default value)? Does this happen with other attributes too, and does it happen if you don't include any attribute besides dropship_cost? Feb 14, 2015 at 19:45
  • We were able to reproduce this with all attributes in Magento CE 1.7.0.2 and have now identified the bug which I will post as an answer to this question.
    – Chris
    Feb 16, 2015 at 11:15
  • @Marius How is this off-topic? We hired a Magento developer to fix this and he found a bug in the core coding for 1.7.0.2 as described in my answer. This behaviour can be reproduced on any 1.7.0.2 installation.
    – Chris
    Feb 18, 2015 at 11:38

1 Answer 1

1

We checked the Magento core coding thoroughly and found a bug in the following file which handles the import routine:

app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php

On line 1609 the array is not properly instantiated and therefore repeated loops over that array are not going to overwrite the existing data (hence the spurious import data).

The solution is to add the following line to the file above at line 1609:

$row = array(); // <--- this is the fix
$row['product_id'] = $this->_newSku[$rowData[self::COL_SKU]]['entity_id'];
$row['stock_id'] = 1;

Note: this problem only occurs in Magento CE 1.7.0.2, we have confirmed it is not present in Magento CE 1.9+,

0

Your Answer

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

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