1

I am inserting customer data in magento programmatically; for my client, email is not a mandatory field, so some users will not have it.

When I insert the customer without email, it throws an error "email is a required field" .

code

$customer = $this->_getCustomerModel();
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$userid = Mage::helper('customer')->CreateUserid(Federallawyer_Customer_Helper_Data::LAWYER);

$customer->setFirstname($_customer->getFirstname());
$customer->setLastname($_customer->getLastname());
$customer->setGroupId(Federallawyer_Customer_Helper_Data::LAWYER);
if($_customer->getEmail()!='')
{
    $customer->setIsSubscribed(1);
    $customer->setEmail($_customer->getEmail());
}
$customer->setUserid($userid);
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->setConfirmation(null);
$customer->save();

Is it possible to insert the data in customer table without email?

4
  • you can remove the required option in db for customer email Aug 13, 2015 at 20:17
  • ya i did,but still i can't able to insert the customer data with out email id.do you have any other idea or suggestion
    – senthil
    Aug 14, 2015 at 4:13
  • just generate a random email for each! Email is in fact used as frontend login, you know. Aug 14, 2015 at 11:46
  • except to generate the random email id, do you have any other idea,because i having nearly 10 lakhs record for that nearly 5 lakhs user don't have a email id, if i generate random email id it make some duplicate problem,that is why i asking some other idea and suggestion
    – senthil
    Aug 14, 2015 at 12:58

1 Answer 1

4

You cannot use the import without an email address. It's the main identifier and used to detect existing entries. In fact, I doubt any part of Magento will allow customers to be inserted without an email address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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