Magento Dataflow - Optimized Product Import [Part 3]

Magento Dataflow module comes with standard product adapter (see Magento Dataflow - Default Adapters [Part 2]). Sometimes though, default solution is not enough and you may want to create your own adapter processing products.

Creating own adapter is not hard, but if you forget two lines of code, you may be very surprised with its performance. These two lines you should add before calling $product->save():


First line sets $data variable 'is_massupdate', which can be later checked to save some postprocessing actions time. Some observers watching for catalog_product_save_after event check this value (i.e. CatalogRule module's Observer, which skips action of applying catalog rules on products if  $product->getIsMassupdate() returns  true )

Second line also sets $data variable 'exclude_url_rewrite', which is used by afterSave method of Mage_Catalog_Model_Product_Attribute_Backend_Urlkey to check if catalog url rewrite cache should be refreshed.

Those two lines allow you to save few seconds per each row of processed products, so keep in mind to not forget about them

4 comments on "Magento Dataflow - Optimized Product Import [Part 3]"

Christian's picture
Christian (visitor) - Thu, 01/10/2009 - 08:48:

Great tips!

Bluetooth Marketing's picture
Bluetooth Marketing (visitor) - Wed, 24/08/2011 - 09:59:


can I ask about the event:

should this event return a result? for example in the case of errors?

Lingerie's picture
Lingerie (visitor) - Sat, 03/12/2011 - 15:42:

Good post i will keep this in mind when doing a Magento Import.

Anonymous's picture
Anonymous (visitor) - Tue, 10/01/2012 - 12:08: