Could someone please advise why when adding a customer via an external script the website and store values are ignored and the customer is always assigned to "admin" and not to "main website".
I only have 1 website and 1 store within my Magento instance and each has an id of 1
My code is below:
$customer = Mage::getModel("customer/customer");
$customer ->setWebsiteId(1)
->setStore(1)
->setFirstname('John')
->setLastname('Smith')
->setEmail('john@smith.com')
->setPassword('password')
->setGroupId('1');
try{
$customer->save();
}
catch (Exception $e) {
Zend_Debug::dump($e->getMessage());
}
Best Answer
Instead of using
setStore()
you could have usesetStoreId()