Search code examples
phpmagentoimportavs

Magento AvS_fastsimpleimporter multiple addresses


Is it possible while creating new users with AvS_Fastsimpleimporter to add more than the standard address ?

Currently my array "data" looks like this

'email' => $kunde['email'],
    '_website' => $_website,
    '_store' => $_website . 'store',
    'confirmation' => '',
    'created_at' => $created_at,
    'created_in' => 'Import',
    'disable_auto_group_change' => 0,
    'firstname' => $kunde['name_1'],
    'group_id' => 3,
    'kontonummer' => $kunde['kontonr'],
    'kundennummer' => $kunde['kundennr'],
    'lastname' => $lastname,
    'password_hash' => $password_hash,
    'store_id' => 0,
    'website_id' => $country['id'],
    '_address_city' => $kunde['ort'],
    '_address_country_id' => $kunde['land'],
    '_address_fax' => $kunde['fax'],
    '_address_firstname' => $kunde['name_1'],
    '_address_lastname' => $lastname,
    '_address_postcode' => $kunde['plz'],
    '_address_street' => $kunde['strasse'],
    '_address_telephone' => $_address_telephone,
    '_address_vat_id' => $kunde['ust_id'],
    '_address_default_billing_' => 1,
    '_address_default_shipping_' => 1,

And i want to add a second address with the AvS_Simpleimporter. I tried to add a second array in data like this:

array_push($data, array(
            'email' => null,
            '_website' => null,
            '_address_city' => checkRequiredInput($address['ort']),
            '_address_country_id' => $address['land'],
            '_address_firstname' => checkRequiredInputVadr($address['name_1']),
            '_address_lastname' => checkRequiredInputVadr($address['name_2']),
            '_address_postcode' => checkRequiredInput($address['plz']),
            '_address_street' => checkRequiredInput($address['strasse']),
            '_address_default_billing_' => 0,
            '_address_default_shipping_' => 0,
        ));

And then executing with

$importer = Mage::getModel('fastsimpleimport/import');
$importer->setIgnoreDuplicates('password_hash')->processCustomerImport($data);

But this currently doesn't work. The second address is added as an extra array to data like this

.... data array
....
'_address_default_billing_' => 1
'_address_default_shipping_' => 1
[0] =>  'email' => bla bla
        '_website' => bla bla
         and so son

Any help ?


Solution

  • Multiple addresses are imported as additional rows. Hence you need to:

    '_address_country_id' => array($country1,$country2),
    '_address_city' => array($city1, $city2),
    ....
    

    Sample CSV Screenshot