AvS_FastSimpleImport

Wrapper for Magento ImportExport functionality which imports data from arrays

View the Project on GitHub avstudnitz/AvS_FastSimpleImport

Customer Import

This import is basically using the core functionality to import customers with the ImportExport module.

Example Code

$data = array(
    array(
        'email' => 'customer@company.com',
        '_website' => 'base',
        '_store' => 'example_com_deDE', // The storeviews code
        'group_id' => 1,
        'firstname' => 'John',
        'lastname' => 'Doe',
        '_address_firstname' => 'John',
        '_address_lastname' => 'Doe',
        '_address_street' => 'Main Street 1',
        '_address_postcode' => '12345',
        '_address_city' => 'Springfield',
        '_address_country_id' => 'US',
        '_address_telephone' => '+1 2345 6789',
        '_address_default_billing_' => 1,
        '_address_default_shipping_' => 0,
	),
    array(
        'email' => null,
        '_website' => null,
        '_address_firstname' => 'John',
        '_address_lastname' => 'Doe',
        '_address_street' => 'Countryside 99',
        '_address_postcode' => '98765',
        '_address_city' => 'Cape Cod',
        '_address_country_id' => 'US',
        '_address_telephone' => '+1 9876 54321',
        '_address_default_billing_' => 0,
        '_address_default_shipping_' => 1,
	),
);

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

This example imports one customer with two addresses.