Magento – Export and Import Customers

exportimport

I've exported my customers to a CSV file. The problem is, that the _address_street has the first line of the address as well as the suburb, merged into one?

Is that normal? Is there a field for address line 2?

I'm using Magento 1.9

I tried to actually reimport that data back into Magento…and it forced everything into Address Line 1.

Best Answer

Seems, this is expected behavior by design. Please, look at customer address backend model:

class Mage_Customer_Model_Resource_Address_Attribute_Backend_Street
    extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract
{
    /**
     * Prepare object for save
     *
     * @param Varien_Object $object
     * @return Mage_Customer_Model_Resource_Address_Attribute_Backend_Street
     */
    public function beforeSave($object)
    {
        $street = $object->getStreet(-1);
        if ($street) {
            $object->implodeStreetAddress();
        }
        return $this;
    }
}

And Mage_Customer_Model_Address_Abstract

/**
 * set address street informa
 *
 * @param unknown_type $street
 * @return unknown
 */
public function setStreet($street)
{
    if (is_array($street)) {
        $street = trim(implode("\n", $street));
    }
    $this->setData('street', $street);
    return $this;
}


/**
 * To be used when processing _POST
 */
public function implodeStreetAddress()
{
    $this->setStreet($this->getData('street'));
    return $this;
}

Since Module ImportExport uses attribute's backend models, so this is expected behavior.

Related Topic