In Magento 1.7 community edition, I have overridden the AccountController of the Customer Module. I have modified the createPost method so that it saves the customer name, email and password only, and returns JSON output so that I an call it using ajax.
To test that the controller is working correctly, I request the method directly, i.e.:
www.mysite.com.au/customer/account/createpost/?firstname=john&[email protected]&password=xxxxxx&confirmation=xxxxxx
The issue I am having is that $customer->save()
is called, an exception is thrown
(Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS
), the message being "customer email already exists" which is traced back to app/code/core/Mage/Customer/Model/Resource/Customer.php
. The customer record IS inserted despite the exception.
So Magento is attempting to save the customer twice. If I out a return at the top of the Mage_Customer_Model_Resource_Customer:_beforeSave(Varien_Object $customer)
method, TWO customer records are added.
Any ideas would be greatly appreciated.
Edit: I realised that this is an issue with PHP running on my Windows 7 PC (I installed the BitNami WAMP stack). I copied the code to a linux box, and the fault is not occurring.