7

I'm trying to import customers via CSV Import:

System > Import/Export > Import > Customers > Append Complex Data

I'd like to import customers which are "not confirmed" after import.

Note: You have to enable the setting System > Configuration > Customer Configuration > Create New Account Options > Require Emails Confirmation to "Yes" for this to take effect.

The values for the confirmation field in the backend are:

<select id="_accountconfirmation" class=" select" name="account[confirmation]">
  <option value="">Confirmed</option>
  <option selected="selected" value="HASH_VALUE">Not confirmed</option>
</select>

My CSV includes the confirmation field which I've set to various values (empty, 0, 1, random numbers,...) but the customers are always "confirmed" after the import is done.

3

After debugging the import I found out that there is a function addSystemHiddenFilterWithPasswordHash() which is called in the _initAttributes() method of Mage_ImportExport_Model_Import_Entity_Customer:

$collection = Mage::getResourceModel('customer/attribute_collection')->addSystemHiddenFilterWithPasswordHash();

The method is defined in Mage_Eav_Model_Resource_Attribute_Collection:

/**
     * Exclude system hidden attributes but include password hash
     *
     * @return Mage_Customer_Model_Entity_Attribute_Collection
     */
    public function addSystemHiddenFilterWithPasswordHash()
    {
        $field = '(CASE WHEN additional_table.is_system = 1 AND additional_table.is_visible = 0
            AND main_table.attribute_code != "' . self::EAV_CODE_PASSWORD_HASH . '" THEN 1 ELSE 0 END)';
        $this->addFieldToFilter($field, 0);
        return $this;
    }

As the confirmationfield is a system value (see app/code/core/Mage/Customer/sql/customer_setup/mysql4-data-upgrade-1.4.0.0.7-1.4.0.0.8.php), you cannot import the information about the confirmation of a customer per default.

So if you ever want to override this, create a rewrite of the 'customer/attribute_collection' resource model and adapt that method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.