AvS_FastSimpleImport

Wrapper for Magento ImportExport functionality which imports data from arrays

View the Project on GitHub avstudnitz/AvS_FastSimpleImport

Category Import

Example Code

$data = array();
$data[] = array(
    '_root' => 'Default Category',
    '_category' => 'Test2',
    'description' => 'Test2',
    'is_active' => 'yes',
    'include_in_menu' => 'yes',
    'meta_description' => 'Meta Test',
    'available_sort_by' => 'position',
    'default_sort_by' => 'position',
);
$data[] = array(
    '_root' => 'Default Category',
    '_category' => 'Test2/Test3',
    'description' => 'Test3',
    'is_active' => 'yes',
    'include_in_menu' => 'yes',
    'meta_description' => 'Meta Test',
    'available_sort_by' => 'position',
    'default_sort_by' => 'position',
);
$data[] = array(
    '_root' => 'Default Category',
    '_category' => 'Test2/Test4 \/ WithSlash',
    'description' => 'When specifying a category path for a category with a slash (/) in the name, escape the slash with a backslash (Test \/ WithSlash).',
    'is_active' => 'yes',
    'include_in_menu' => 'yes',
    'meta_description' => 'Meta Test',
    'available_sort_by' => 'position',
    'default_sort_by' => 'position',
);
$data[] = array(
    '_store' => 'storename',
    'name' => 'Storeview name',
    'description' => 'Never specify a name in admin store level, the name is extracted out of the _category path'
);

/** @var $import AvS_FastSimpleImport_Model_Import */
$import = Mage::getModel('fastsimpleimport/import');
try {
    $import->processCategoryImport($data);
} catch (Exception $e) {
    print_r($import->getErrorMessages());
}

Notes