Magento – Article inventory after import always wrong

It's curious: For obvious reasons, not really the stocks of many or all items are always wrong. One reason for this is not really comprehensible.

The reason is the import of product data. If you import some or all of (in a record, there is no problem, since the existence of the first-mentioned Article is adopted for all) Article on the Magento own Importer, which in the Magento backend system via > Import/Export > Import is to find, be changed all stocks for the imported products, regardless of whether the stocks are listed in the import file or not. Are the stocks in the import file available, only the existence of the first article taken and set for all other products, No stocks included in the file, are the stocks yet all changed.

The error is up in Magento 1.7 included and is located in the file product.php in the folder app / code / core / Mage / Import Export / Model / Import / Entity /.

Here one must, To resolve the error between the lines

// only SCOPE_DEFAULT can contain stock data
if (self::SCOPE_DEFAULT != $this->getRowScope($rowData)) {
continue;
}

and

$row['product_id'] = $this->_newSku[$rowData[self::COL_SKU]]['entity_id'];
$row['stock_id'] = 1;

yet the line

$row = array();

be inserted.

It looks like this:

                // only SCOPE_DEFAULT can contain stock data
                if (self::SCOPE_DEFAULT != $this->getRowScope($rowData)) {
                    continue;
                }

                $row = array();

                $row['product_id'] = $this->_newSku[$rowData[self::COL_SKU]]['entity_id'];
                $row['stock_id'] = 1;

Thus, the import runs correctly and then the stocks are not written wrong.

Used in Magento Version 1.7. Ask, Comments, Proposals? Us directly or as a comment.

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

Leave a Reply

Your email address will not be published. Required fields are marked *