Magento – Importing product weights when multiple rows in CSV per product

dataflowexportimportmagento-1.7

Currently, practically every Magento import is yielding a frustrating experience in this particular project.

Most product data is already in the system, configurables setup, each with all their associated simple products.

What we'd like to do is update all the product weights for all the products – quickest way is to bulk update in CSV.

First things first, we export our product data from the system.

Now, we'd like to think that the CSV format it spews out at of the system would be the correct format to reimport back in again but no – even Magento doesn't seem to be able to give us something to work with. If we reimport all the same CSV back into the system that it exports, none of the products show up on the front end (this is if we do it via dataflow).

As this store is a multistore, the CSV format we have is like the following:-

sku     _store     _attribute_set     _type     _category     _root_category    _product_websites     name     weight    
sku-01             Default            simple                  Default Category  retail                name-01  weight-01
                                                Category 1    Default Category  wholesale
sku-02             Default            simple                  Default Category  retail                name-02  weight-02
                                                Category 1    Default Category  wholesale
sku-03             Default            simple                  Default Category  retail                name-03  weight-03
                                                Category 1    Default Category  wholesale

So as can be seen from the above dummy sample, each product has a minimum of two rows, the majority of the rows for the wholesale store is always blank though – presumably because this store just uses the default config and has no wholesale store overrides.

In the event that a product has more than two rows, this is when it has multiple simple products associated to it or custom options set. One row per associated product (granted, the CSV sample above does not show configurables) and one additional row per product for each custom option that it has as well – which is somewhere like column QAZT of CSV!

All pretty normal stuff so far I gather, at least, I've always seen complex product data in a Magento export formatted this way.

The problem comes when we try to reimport back into the system and I'm guessing the issue lies somewhere between the multiple rows per product with options/associated products and additional store(s).

If I were to import the above back into the system, Magento returns:-

Skipping import row, required field “sku” is not defined.

For what seems like every product but I'm guessing, it is probably for every row that does not contain a SKU value – which in the event of complex CSV data, is more that doesn't contain a SKU value than does. Is this to be expected behaviour – the system often screws everything up come the end of this dataflow import when this error is being returned.

I'm after the most stable and recommended way of just simply importing product weights for all products and as per the sample above, I have a CSV in the format exported with all the product weights entered for all the relevant products. Importing as is just causes every product to disappear from the catalog (wtf).

What is the next step?
Normal import?
Dataflow import?
What is the bare minimum of column headers required for just importing weight? (Just importing the SKU column and the weights was a total disaster).

Your thoughts, opinions, feedback and recommendations greatly welcome. Thanks.

Best Answer

The file you generated through Magento Export (whether this is default import/export module or default dataflow profile) is NOT going to work if you import it back, because it doesn't preserve the format.

If you want to update weights, I would recommend this:
1) filter your CSV in Excel, filter only those which have "sku" field assigned
2) copy-paste the filtered rows into new spreadsheet
3) leave only 2 columns - "sku", "weight"
4) import it back.

I'm pretty sure it's the easiest flow to solve your concrete task.

For those who are looking for tool for Magento that allows both export and import while having similar format for both routines, check out this one.