Hire Magento Developer - I am available now
15
Jun

Today I was stuck with importing category tree to Magento store. The task seemed quite straightforward and I decided to use the catalog_category API to be able to update both the dev and live site directly from my local machine. As the tree was quite complex (about 300 categories nested in 3-level tree) the performance of the script was just terrible. Creating a local module (still with the use of API classes but with no necessity of establishing SOAP connection) made the task almost possible. I tried to import all categories as children of root and then adding tree structure with the use of

Mage_Catalog_Model_Category_Api::move()

method. It made total mess in my database (I guess due to slow queries). Finally I sorted categories by level before adding them to the tree so I was able to set proper parent_id parameter in

Mage_Catalog_Model_Category_Api::create()

method. Yeah, this worked like a charm.

,

Add reply