Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

Simple way to register customers via javascript+ajax …
Total Posts:  68
Joined:  2008-12-06

Hey Everyone,

After spending quite a bit of time on this, I thought I’d share a little bit. I bought GoMage’s LightCheckout extension, which has a really nifty JS popup to get you to log in before checking in. Oh cool! But now I want it to handle registering a new customer… Wow that was a journey. There isn’t much code for doing this and they don’t even spool up a form.

I add a JS function and a “create account” a href that calls it. I learned enough prototype to figure out how to select, add, and alter elements to the initial form. Then I repurposed their JS login handler to create a new customer based on the form content… but the real problem is finding out how the heck a user account is created. I studied the included onepagecheckout…

If you root around in the code (I do a lot of grep), you’ll find the function that handles the actual account creation. This is real handy for finding out what other people do to accomplish tasks. grep is a file searching program. It looks in files for your search term. -r means recursive, or go into all subdirectories, -i means make it case in-sensitive, and -n tells you which line number. BTW this trick is fantastic for finding CSS, too!

me@host /www/appgrep -rin "function createPost" *
code/core/Mage/Customer/controllers/AccountController.php:242:    public function createPostAction()
me@host /www/app$

From perusing this function and how the included onepage checkout uses it, I glean that these paramaters have to be passed in:
firstname, lastname, email, password, confirmation, error_url, success_url, is_subscribed

You’ll see next that I left the URLs empty. The below code snippet is inside a function that gets called when the “create form” form is submitted.

// let's create an account!!
var response = new Object();
response.message '';
request = new Ajax.RequestcreateUrl ,
onSuccess: function(transport){
'var response = '+transport.responseText);
.error true;
response.message 'Unknown error.'// initialise response
$$('light-checkout-popup-content-bg-in')[0].insert({'top':'<a class="close" onclick="checkout.hideLoginForm();"></a>'});
); // and then you can if(response.error) or if(!response.error) to handle error control.

You’ll see I put the alert box in there ... I believe this only errors if you truly crash/break varien’s javascript. I really suck at javascript, so the chages are a bit ugly in the bigger picture of their code flow, but it works and seems really simple.

I learned a new “cheat” from GoMage and working with this extension… that getCreateUrl(); function is defined in a PHP file, when you have access to Mage. So this went in at the top of the template file handling the page I’m playing with:

<script type="text/javascript">
var url='<?php echo $this->getUrl("customer/account/createPost");?>';
url.length == alert ('bar url! : '+url);

In my case /customer/account/createPost is the url… I guess I could have just hard coded it. If I had seen something like this in the first handful of hours into my search to create customer accounts, I would have been very happy. So now I give this to you and to Google so that the next time someone wants to do this, it might be easy.


Magento Community Magento Community
Magento Community
Magento Community
Total Posts:  1702
Joined:  2009-06-23

This thread may be helpful:


Magento Community Magento Community
Magento Community
Magento Community
Total Posts:  356
Joined:  2013-01-13
Warsaw, Poland

Hello guys,

LightCheckout extension has become more improved with its new features and abilities. You can choose only registered customers, guests or both of them in the configurtion to place an order. Also, LightCheckout extension is compatible with our Free Social Connector. You can install it and it will allows your customers use the social networks such as Google, LinkedIn and Facebook for the registration. GoMage Social Connector takes the data from a customer social network and the customer doesn’t waste time for mapping the fields:

Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top