Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
Import category structure with products using DataFlow (how to guide)
 
chaddro
Jr. Member
 
Total Posts:  25
Joined:  2007-12-20
 

Here is a plug in that works pretty well through Magento Connect… and free:

http://www.magentocommerce.com/module/2940/import-category-product-and-gallery

and a thread to help you with this product:

http://www.magentocommerce.com/boards/viewthread/76922/

This IS pretty much the method listed here. Note my last posts in the above thread to get galleries to also import using the first XML example.

I only wish import was faster! These are taking about 1 per second on a nice VPS box with plenty of RAM. Don\’t make sense. I can import the same 3600 products into a zencart store in about 30 seconds. Magento take a FULL HOUR! WTF? 1 second per product import?

I even changed the indexes to manual update, but I\’m beginning to think that the import function is still calling the index ... I found another thread on that here:

http://www.magentocommerce.com/boards/viewthread/101402/

but I haven\’t looked into this to see if it applies to 1.4.0.1

 
Magento Community Magento Community
Magento Community
Magento Community
 
Strattas
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-12-07
California
 

Is there a product.php file for Enterprise? I’ve tried the one for community and I get errors. I can’t believe Enterprise doesn’t have this feature. What are we paying all that money for?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Luciano Elias
Jr. Member
 
Total Posts:  2
Joined:  2009-02-11
 

Hello,

I’m trying to use this method but I’m getting this error:

Method “parse” not defined in adapter catalog/convert_adapter_products

I have added a Category.php file to local/Mage/Catalog/Model/Convert/Adapter and core/Mage/Catalog/Model/Conver/Parser and core/Mage/Catalog/Model/Conver/Adapter.

Here’s the code:

class Mycomp_Catalog_Model_Convert_Adapter_Category
    
extends Mage_Eav_Model_Convert_Adapter_Entity
{
    
protected $_categoryCache = array();

    protected 
$_stores;

    
/**
     * Category display modes
     */
    
protected $_displayModes = array( 'PRODUCTS''PAGE''PRODUCTS_AND_PAGE');

    public function 
parse()
    
{
        $batchModel 
Mage::getSingleton('dataflow/batch');
        
/* @var $batchModel Mage_Dataflow_Model_Batch */

        
$batchImportModel $batchModel->getBatchImportModel();
        
$importIds $batchImportModel->getIdCollection();

        foreach (
$importIds as $importId{
            
//print '<pre>'.memory_get_usage().'</pre>';
            
$batchImportModel->load($importId);
            
$importData $batchImportModel->getBatchData();

            
$this->saveRow($importData);
        
}
    }

    
/**
     * Save category (import)
     *
     * @param array $importData
     * @throws Mage_Core_Exception
     * @return bool
     */
    
public function saveRow(array $importData)
    
{
        
if (empty($importData['store'])) {
            
if (!is_null($this->getBatchParams('store'))) {
                $store 
$this->getStoreById($this->getBatchParams('store'));
            
else {
                $message 
Mage::helper('catalog')->__('Skip import row, required field "%s" not defined''store');
                
Mage::throwException($message);
            
}
        } 
else {
            $store 
$this->getStoreByCode($importData['store']);
        
}

        
if ($store === false{
            $message 
Mage::helper('catalog')->__('Skip import row, store "%s" field not exists'$importData['store']);
            
Mage::throwException($message);
        
}

        $rootId 
$store->getRootCategoryId();
        if (!
$rootId{
            
return array();
        
}
        $rootPath 
'1/'.$rootId;
        if (empty(
$this->_categoryCache[$store->getId()])) {
            $collection 
Mage::getModel('catalog/category')->getCollection()
                ->
setStore($store)
                ->
addAttributeToSelect('name');
            
$collection->getSelect()->where("path like '".$rootPath."/%'");

            foreach (
$collection as $cat{
                $pathArr 
explode('/'$cat->getPath());
                
$namePath '';
                for (
$i=2$l=sizeof($pathArr); $i<$l$i++) {
                    $name 
$collection->getItemById($pathArr[$i])->getName();
                    
$namePath .= (empty($namePath) ? '' '/').trim($name);
                
}
                $cat
->setNamePath($namePath);
            
}

            $cache 
= array();
            foreach (
$collection as $cat{
                $cache[strtolower
($cat->getNamePath())$cat;
                
$cat->unsNamePath();
            
}
            $this
->_categoryCache[$store->getId()$cache;
        
}
        $cache 
=& $this->_categoryCache[$store->getId()];

        
$importData['categories'preg_replace('#\s*/\s*#''/'trim($importData['categories']));
        if (!empty(
$cache[$importData['categories']])) {
            
return true;
        
}

        $path 
$rootPath;
        
$namePath '';

        
$i 1;
        
$categories explode('/'$importData['categories']);
        foreach (
$categories as $catName{
            $namePath 
.= (empty($namePath) ? '' '/').strtolower($catName);
            if (empty(
$cache[$namePath])) {

                $dispMode 
$this->_displayModes[2];

                
$cat Mage::getModel('catalog/category')
                    ->
setStoreId($store->getId())
                    ->
setPath($path)
                    ->
setName($catName)
                    ->
setIsActive(1)
                    ->
setIsAnchor(1)
                    ->
setDisplayMode($dispMode)
                    ->
save();
                
$cache[$namePath] $cat;
            
}
            $catId 
$cache[$namePath]->getId();
            
$path .= '/'.$catId;
            
$i++;
        
}

        
return true;
    
}

    
/**
     * Retrieve store object by code
     *
     * @param string $store
     * @return Mage_Core_Model_Store
     */
    
public function getStoreByCode($store)
    
{
        $this
->_initStores();
        if (isset(
$this->_stores[$store])) {
            
return $this->_stores[$store];
        
}
        
return false;
    
}

    
/**
     *  Init stores
     *
     *  @param    none
     *  @return      void
     */
    
protected function _initStores ()
    
{
        
if (is_null($this->_stores)) {
            $this
->_stores Mage::app()->getStores(truetrue);
            foreach (
$this->_stores as $code => $store{
                $this
->_storesIdCode[$store->getId()$code;
            
}
        }
    }
}

No matter what I do I keep getting the same error.

I’m also using Magento 1.4.1.0, so I’m not sure if that’s the problem…

Any ideas would be much appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
liron
Jr. Member
 
Total Posts:  1
Joined:  2010-07-01
 

i am also working with the new version and having exactly the same issue , i must find asap solution for this problem

any ideas why it returns “Method “parse” not defined in adapter catalog/convert_adapter_products” when i try executing the new advanced profile i created?/....

 
Magento Community Magento Community
Magento Community
Magento Community
 
5live
Jr. Member
 
Total Posts:  28
Joined:  2007-09-01
 

there are some typos in this plugins docs. to fix this, simply remove the “s” after “product”:

<var name="adapter">catalog/convert_adapter_product</var>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2