true, 'display_mode' => 'PRODUCTS', 'is_anchor' => true, 'path' => '1/2', 'store_id' => 1 ); public function putCategories ( $categories ) { foreach ( $categories as $category ) { if ( $category->getIdAttribute() ) { $attr = $category->getIdAttribute(); $existing = Mage::getModel('catalog/category')->getCollection() ->addFieldToFilter( $attr, $category->getData($attr) ); } if ( $existing && $existing->count() ) { foreach ( $existing as $category ) { if ( $this->_saveCategories ) $this->_categories[$category->getId()] = $category; } } else { $magentoCategory = Mage::getModel('catalog/category'); $newData = $category->getData(); foreach ( $this->_defaultCategoryData as $key => $value ) { if ( !$category->hasData ($key) ) $magentoCategory->setData ( $key, $value ); else { $magentoCategory->setData ( $key, $category->getData ( $key ) ); unset ( $newData[$key] ); } } foreach ( $newData as $key => $value ) { $magentoCategory->setData ( $key, $value ); } $magentoCategory->save(); if ( $this->_saveCategories ) $this->_categories[$magentoCategory->getId()] = $magentoCategory; } } } }