VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Feature requests => Topic started by: woonydanny on August 17, 2009, 14:03:26 pm

Title: [SOLVED] ajax registration
Post by: woonydanny on August 17, 2009, 14:03:26 pm
i know it is nearly stable, but is there the feature of an ajax username/email checker planned? As at present, when a person enters all the information and clicks Send Registration and they have chosen a username that is already taken you are taken to a page where you need to click the back button and fill out the whole form again.
Title: Re: ajax registration
Post by: woonydanny on September 15, 2009, 10:49:10 am
would still really like this ajax username/email checker to be integrated into virtuemart :)
Title: [SOLVED]Re: ajax registration
Post by: woonydanny on September 26, 2009, 09:47:49 am
ok, i had a freelance developer write this hack for me. It works for me on IE7,IE8,FF3.5,Safari 4. I have included the instructions below for the community. I do not provide any support but I hope this helps some people and maybe even make it into the core.

FILE: administrator/components/com_virtuemart/html/checkout_register_form.php


Line 23 : CHANGE THESE LINEs
Code: [Select]
$missing = vmGet( $_REQUEST, "missing", "" );

if (!empty( $missing )) {
echo "<script type=\"text/javascript\">alert('".$VM_LANG->_('CONTACT_FORM_NC',false)."'); </script>\n";
}


AND REPLACE IT WITH THIS CODE:
Code: [Select]
$missing = vmGet( $_REQUEST, "missing", "" );

?>

<script language="javascript" type="text/javascript">



function getUsername(){
var form = document.adminForm;
var unam = form.username.value;

if( !$('username_ticker') )
$('username_input').innerHTML = $('username_input').innerHTML + "<div id=\"username_ticker\" style=\"padding-top:10px;\"></div>";

$('username_field').value = unam;

if( form.username.value.length < 3 ) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">Username : This input value is not valid.</span>';
} else {
$('username_ticker').innerHTML = "<img src=\"<?php echo JURI::base()."images/wait.gif";?>\">&nbsp;Checking";
var url = 'index.php?option=com_virtuemart&tasked=chkuserinfo&format=raw&what=uname';
url = url + '&uname=' + form.username.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">This username is already registered.</span>';
} else {
$('username_ticker').innerHTML = '<span style="border:1px none transparent;color:green;padding:5px 5px 5px 5px;">The username \''+ $('username_field').value +'\' is free for registration: you can proceed.</span>';
}
}
}).request();

}
}


function getEmail(){

var form = document.adminForm;
var eadd = form.email.value;

if( !$('email_ticker') )
$('email_input').innerHTML = $('email_input').innerHTML + "<div id=\"email_ticker\" style=\"padding-top:10px;\"></div>";

$('email_field').value = eadd;

if( !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email.value))) {
$('email_ticker').setHTML('<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">Email : This input value is not valid.</span>');
} else {
$('email_ticker').setHTML("<img src=\"<?php echo JURI::base()."images/wait.gif";?>\">&nbsp;Checking");
var url = 'index.php?option=com_virtuemart&tasked=chkuserinfo&format=raw&what=email';
url = url + '&email=' + form.email.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('email_ticker').setHTML('<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">This email is already registered.</span>');
} else {
$('email_ticker').setHTML('<span style="border:1px none transparent;color:green;padding:5px 5px 5px 5px;">The email \''+ $('email_field').value +'\' is free for registration: you can proceed.</span>');
}
}
}).request();

}
}



</script>
<?php

if (!empty( $missing )) {
echo "<script type=\"text/javascript\">alert('".$VM_LANG->_('CONTACT_FORM_NC',false)."'); </script>\n";
}


and then you need to add code into another file.


FILE: administrator/components/com_virtuemart/classes/ps_userfield.php

LINE 390 :
AFTER THESE LINES
Code: [Select]
case 'password':
case 'password2':
echo '<input type="password" id="'.$field->name.'_field" name="'.$field->name.'" size="30" class="inputbox" />'."\n";
  break;

ADD THE CODES BELOW:
Code: [Select]
case 'email':
echo '<input type="text" id="'.$field->name.'_field" name="'.$field->name.'" size="30" class="inputbox" onchange="getEmail();" />'."\n";
  break;

case 'username':
echo '<input type="text" id="'.$field->name.'_field" name="'.$field->name.'" size="30" maxlength="25" onchange="getUsername();" class="inputbox" />'."\n";
  break;

SO IT SHOULD LOOK LIKE THIS:
Code: [Select]
case 'password':
case 'password2':
echo '<input type="password" id="'.$field->name.'_field" name="'.$field->name.'" size="30" class="inputbox" />'."\n";
  break;

case 'email':
echo '<input type="text" id="'.$field->name.'_field" name="'.$field->name.'" size="30" class="inputbox" onchange="getEmail();" />'."\n";
  break;

case 'username':
echo '<input type="text" id="'.$field->name.'_field" name="'.$field->name.'" size="30" maxlength="25" onchange="getUsername();" class="inputbox" />'."\n";
  break;

  default:

ANOTHER FILE TO HACK
FILE: /components/com_virtuemart/virtuemart.php


LINE 21 : INSERT THE CODE BELOW AFTER THIS CODE "global $mosConfig_absolute_path, $product_id, $vmInputFilter, $vmLogger;"
Code: [Select]
$tasked = JRequest::getVar( 'tasked' );

if($tasked=="chkuserinfo"){
$database = & JFactory::getDBO();
$email = JRequest::getVar( 'email' );
$uname = JRequest::getVar( 'uname' );

$what = JRequest::getVar( 'what' );

$usercount = 0;
$emailcount = 0;


if($what == "uname"){
$database->setQuery("SELECT COUNT(*) FROM #__users WHERE username='$uname'");
$usercount = $database->loadResult();
if($usercount)
echo "1";
else
echo "0";

} else if ($what == "email") {
$database->setQuery("SELECT COUNT(*) FROM #__users WHERE email='$email'");
$emailcount = $database->loadResult();

if($emailcount)
echo "1";
else
echo "0";
}


die();
}

ALSO MAKE SURE THE IMAGE BELOW IS UPLOADED INTO THE  /images DIRECTORY ON YOUR SERVER


[attachment cleanup by admin]
Title: Re: [SOLVED] ajax registration
Post by: Branson on October 04, 2009, 00:58:10 am
VERY nice mod! I agree that this should be included in future releases.

One thing that you need to change is in the instructions. It states that the location of the last file to modify...
You have it listed as /components/virtuemart.php
This should be /components/com_virtuemart/virtuemart.php

Attached below is a screenshot of it in action...

[attachment cleanup by admin]
Title: Re: [SOLVED] ajax registration
Post by: woonydanny on October 04, 2009, 01:26:17 am
cheers Branson, i have now updated the last file's path.

glad it works for you too!
Title: Re: [SOLVED] ajax registration
Post by: Ventsi Genchev on October 04, 2009, 08:30:15 am
You're the man! Exactly what I needed. Thank you very much.
Title: Re: [SOLVED] ajax registration
Post by: Branson on October 20, 2009, 05:57:53 am
Just upgraded from 1.1.13 to 1.1.14 (patched). The edited files got overwritten during the upgrade, as expected.

I went through the instructions and it works great in 1.1.14. In case anyone is wondering.
Title: Re: [SOLVED] ajax registration
Post by: woonydanny on October 20, 2009, 10:22:09 am
hmmm, even though i have this working for me (tested it a fair bit) i have had numerous emails from customers saying that cant register.

Saying that they cant click on Submit Registration button and the Submit Registration button doesnt appear on some occasions. I cant replicate these issues but was hoping someone might be able to let me know what could be causing this?

thanks
Title: Re: [SOLVED] ajax registration
Post by: woonydanny on October 20, 2009, 15:21:24 pm
ok i am pretty sure i am having problems due to https.

the freelance developer is not responding (as i have already paid him) so any help much appreciated to fix this
Title: Re: [SOLVED] ajax registration
Post by: woonydanny on October 20, 2009, 15:48:04 pm
ok further testing has revealed that it doesnt work (no Submit Registration button is shown) when i use the registration form from the Checkout where it has the option for Returning Customers. Obviously there is a javascript conflict or something with that and the hack.

If i register through the Register link on the module (so doesnt have the returning customers feature) then it seems to work.

anyone know how to fix this?
Title: Re: [SOLVED] ajax registration
Post by: Branson on October 20, 2009, 19:59:19 pm
i will take a look at this tonight. im not a good programmer, but i can read it and see where it may be having issues.

what joomla template are you using, and do you think it may be that causing the issue?
Title: Re: [SOLVED] ajax registration
Post by: chuckscroggs on October 23, 2009, 20:46:49 pm
How do we get this USERNAME CHECKER to work on the actual registration page and not just the one they go to when they are checking out?
Title: Re: [SOLVED] ajax registration
Post by: woonydanny on October 24, 2009, 03:38:21 am
it works on the shop registration page, so just use the VM login module and people will use the shop rego page.

still having a problem with the javascript conflicting with the returning customers code so IE doesnt work
Title: Re: [SOLVED] ajax registration
Post by: Scar on October 28, 2009, 16:44:21 pm
I haven't tried this yet but there is a "e" missing in this line:
$('username_field').value   = unam;

in the insert code in administrator/components/com_virtuemart/html/checkout_register_form.php
Title: Re: [SOLVED] ajax registration
Post by: sev on November 26, 2009, 12:30:48 pm
it works on the shop registration page, so just use the VM login module and people will use the shop rego page.

I tried this and it works beautifully during checkout, but does not/not work when registering through VM registration module (either as part of all_in_one or stand alone).

I am on VM 1.1.4 and Joomla 1.5.15.

Any advice?
Title: Re: [SOLVED] ajax registration
Post by: woonydanny on January 26, 2010, 06:04:12 am
so does this work for users? im still not sure if it is 100% working
Title: Re: [SOLVED] ajax registration
Post by: Everest on February 25, 2010, 07:48:13 am
There are two errors with var "uname". I corrected them so far everything seems to work as designed. I don't put it on production site though.
UPDATE
as of march 1 2010 ajax works fine but no data except login first and last name is entered into mysql table.
Title: Re: [SOLVED] ajax registration
Post by: zurli on March 05, 2010, 00:43:14 am
Thank you very much for this hack. I was looking for this because register form is not best thing in VM.

it is working very good. please see picture. all databasefields are filled with data.  ::)



[attachment cleanup by admin]
Title: Re: [SOLVED] ajax registration
Post by: Everest on March 07, 2010, 19:48:44 pm
Oops, there was a bit of confusion over this hack. I admit it works. Thanks guys for sharing nice stuff!
Title: Re: [SOLVED] ajax registration
Post by: Engholm on March 25, 2010, 12:38:09 pm
Works fine with J1.5.15 and VM 1.1.4. This should be a native function in VM!
Title: Re: [SOLVED] ajax registration
Post by: Hermes on April 08, 2010, 02:56:36 am
Hi everyone!

Tested in J1.5.15 and VM 1.1.4 and afetr change the two errors in the variable uname, works perfect for me too.

I have a question about this hack. I'd like to use this code in the joomla normal registration, in addition of in my virtuemart registration form. I think that I know where to put the code inside files checkout_register_form.php and ps_userfield.php in my joomla installation, but I'm not pretty sure where to put the code inside file virtuemart.php in the joomla core.

¿Maybe In index.php? ¿Where  are the queries located in Joomla core?

¿Someone knows the answer?
It would be very nice to make work also this code in Joomla normal registration.

Thanks in advance!
Title: Re: [SOLVED] ajax registration
Post by: Ventsi Genchev on April 08, 2010, 08:38:57 am
I do not think that works normally. There are some problems.
User data is recorded normally, but then your account is not showing your email address and user name.
Title: Re: [SOLVED] ajax registration
Post by: Ventsi Genchev on April 08, 2010, 12:46:25 pm
First big thanks to peetree21 for a shared hack.

Well, I think I fixed most problems.


So  ;)

* fixed: not showing name and password in the form to change user data.
* fixed: in form to change user data has also investigated the email and username.
* fixed: length of fields and characters for a username and email can now be adjusted as other fields in the admin panel.
(Tests were made with VirtueMart 1.1.4 and IE6, IE7, IE8 and Mozilla)


According to recent tests that have been made, everything works as it should be.

Noted problems: not detected




Here's what should be done:


1. FILE: /administrator/components/com_virtuemart/html/checkout_register_form.php

CHANGE THESE LINEs
Code: [Select]
$missing = vmGet( $_REQUEST, "missing", "" );

if (!empty( $missing )) {
echo "<script type=\"text/javascript\">alert('".$VM_LANG->_('CONTACT_FORM_NC',false)."'); </script>\n";
}

AND REPLACE IT WITH THIS CODE:
Code: [Select]
$missing = vmGet( $_REQUEST, "missing", "" );

?>

<script language="javascript" type="text/javascript">



function getUsername(){
var form = document.adminForm;
var uname = form.username.value;

if( !$('username_ticker') )
$('username_input').innerHTML = $('username_input').innerHTML + "<div id=\"username_ticker\" style=\"padding-top:10px;\"></div>";

$('username_field').value = uname;

if( form.username.value.length < 3 ) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">Username : This input value is not valid.</span>';
} else {
$('username_ticker').innerHTML = "<img src=\"<?php echo JURI::base()."images/wait.gif";?>\">&nbsp;Checking";
var url = 'index.php?option=com_virtuemart&tasked=chkuserinfo&format=raw&what=uname';
url = url + '&uname=' + form.username.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">This username is already registered.</span>';
} else {
$('username_ticker').innerHTML = '<span style="border:1px none transparent;color:green;padding:5px 5px 5px 5px;">The username \''+ $('username_field').value +'\' is free for registration: you can proceed.</span>';
}
}
}).request();

}
}


function getEmail(){

var form = document.adminForm;
var eadd = form.email.value;

if( !$('email_ticker') )
$('email_input').innerHTML = $('email_input').innerHTML + "<div id=\"email_ticker\" style=\"padding-top:10px;\"></div>";

$('email_field').value = eadd;

if( !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email.value))) {
$('email_ticker').setHTML('<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">Email : This input value is not valid.</span>');
} else {
$('email_ticker').setHTML("<img src=\"<?php echo JURI::base()."images/wait.gif";?>\">&nbsp;Checking");
var url = 'index.php?option=com_virtuemart&tasked=chkuserinfo&format=raw&what=email';
url = url + '&email=' + form.email.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('email_ticker').setHTML('<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">This email is already registered.</span>');
} else {
$('email_ticker').setHTML('<span style="border:1px none transparent;color:green;padding:5px 5px 5px 5px;">The email \''+ $('email_field').value +'\' is free for registration: you can proceed.</span>');
}
}
}).request();

}
}



</script>
<?php

if (!empty( $missing )) {
echo "<script type=\"text/javascript\">alert('".$VM_LANG->_('CONTACT_FORM_NC',false)."'); </script>\n";
}



2. FILE: /administrator/components/com_virtuemart/classes/ps_userfield.php

AFTER THESE LINES
Code: [Select]
case 'password':
case 'password2':
echo '<input type="password" id="'.$field->name.'_field" name="'.$field->name.'" size="30" class="inputbox" />'."\n";
  break;

ADD THE CODES BELOW:
Code: [Select]
case 'email':
$maxlength = $field->maxlength ? 'maxlength="'.$field->maxlength.'"' : '';
echo '<input type="text" id="'.$field->name.'_field" name="'.$field->name.'" size="'.$field->size.'" onchange="getEmail();" value="'. ($db->sf($field->name, true, false)?$db->sf($field->name, true, false):'') .'" class="inputbox" '.$maxlength . $readonly . ' />'."\n";
  break;
case 'username':
$maxlength = $field->maxlength ? 'maxlength="'.$field->maxlength.'"' : '';
echo '<input type="text" id="'.$field->name.'_field" name="'.$field->name.'" size="'.$field->size.'" onchange="getUsername();" value="'. ($db->sf($field->name, true, false)?$db->sf($field->name, true, false):'') .'" class="inputbox" '.$maxlength . $readonly . ' />'."\n";
  break;


3. In the same file (ps_userfield.php)

AFTER THESE LINES
Code: [Select]
      /**
      * This is the most important part of this file
      * Here we print the field & its contents!
      */

ADD THE CODES BELOW:
Code: [Select]
            ?>
            
             <script language="javascript" type="text/javascript">



function getUsername(){
var form = document.adminForm;
var uname = form.username.value;

if( !$('username_ticker') )
$('username_input').innerHTML = $('username_input').innerHTML + "<div id=\"username_ticker\" style=\"padding-top:10px;\"></div>";

$('username_field').value = uname;

if( form.username.value.length < 3 ) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">Username : This input value is not valid.</span>';
} else {
$('username_ticker').innerHTML = "<img src=\"<?php echo JURI::base()."images/wait.gif";?>\">&nbsp;Checking";
var url = 'index.php?option=com_virtuemart&tasked=chkuserinfo&format=raw&what=uname';
url = url + '&uname=' + form.username.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">This username is already registered.</span>';
} else {
$('username_ticker').innerHTML = '<span style="border:1px none transparent;color:green;padding:5px 5px 5px 5px;">The username \''+ $('username_field').value +'\' is free for registration: you can proceed.</span>';
}
}
}).request();

}
}


function getEmail(){

var form = document.adminForm;
var eadd = form.email.value;

if( !$('email_ticker') )
$('email_input').innerHTML = $('email_input').innerHTML + "<div id=\"email_ticker\" style=\"padding-top:10px;\"></div>";

$('email_field').value = eadd;

if( !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email.value))) {
$('email_ticker').setHTML('<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">Email : This input value is not valid.</span>');
} else {
$('email_ticker').setHTML("<img src=\"<?php echo JURI::base()."images/wait.gif";?>\">&nbsp;Checking");
var url = 'index.php?option=com_virtuemart&tasked=chkuserinfo&format=raw&what=email';
url = url + '&email=' + form.email.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('email_ticker').setHTML('<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">This email is already registered.</span>');
} else {
$('email_ticker').setHTML('<span style="border:1px none transparent;color:green;padding:5px 5px 5px 5px;">The email \''+ $('email_field').value +'\' is free for registration: you can proceed.</span>');
}
}
}).request();

}
}



</script>
        <?php



4. FILE: /components/com_virtuemart/virtuemart.php

AFTER THESE LINE
Code: [Select]
global $mosConfig_absolute_path, $product_id, $vmInputFilter, $vmLogger;
ADD THE CODES BELOW:
Code: [Select]
$tasked = JRequest::getVar( 'tasked' );

if($tasked=="chkuserinfo"){
$database = & JFactory::getDBO();
$email = JRequest::getVar( 'email' );
$uname = JRequest::getVar( 'uname' );

$what = JRequest::getVar( 'what' );

$usercount = 0;
$emailcount = 0;


if($what == "uname"){
$database->setQuery("SELECT COUNT(*) FROM #__users WHERE username='$uname'");
$usercount = $database->loadResult();
if($usercount)
echo "1";
else
echo "0";

} else if ($what == "email") {
$database->setQuery("SELECT COUNT(*) FROM #__users WHERE email='$email'");
$emailcount = $database->loadResult();

if($emailcount)
echo "1";
else
echo "0";
}


die();
}


ALSO MAKE SURE THE IMAGE BELOW IS UPLOADED INTO THE  /images DIRECTORY ON YOUR SERVER


I hope this will help. I expect feedback from your tests. Good luck to all.  :)

[attachment cleanup by admin]
Title: Re: [SOLVED] ajax registration
Post by: daviddickens on April 16, 2010, 12:06:26 pm
Problem detected with registration page from the checkout.  The "Send registration" button disappears as soon as the username checker is activated.

Any solution for this problem?
Title: Re: [SOLVED] ajax registration
Post by: mbit on April 16, 2010, 12:19:31 pm
Problem detected with registration page from the checkout.  The "Send registration" button disappears as soon as the username checker is activated.

Any solution for this problem?
same issue here.
 of this hack comes out the button is hidding in the footer :/
is there a way to reveal the message next of the field and not below it?
Title: Re: [SOLVED] ajax registration
Post by: Ventsi Genchev on April 16, 2010, 13:50:57 pm
Add to your theme.css

Code: [Select]
#register_stretcher input.button {margin-bottom: 54px;}
Оr change the value according to your template.
If you use a template that has a similar field (like Mynxx), just change the value.

Title: Re: [SOLVED] ajax registration
Post by: mbit on April 16, 2010, 17:50:42 pm
Add to your theme.css

Code: [Select]
#register_stretcher input.button {margin-bottom: 54px;}
Оr change the value according to your template.
If you use a template that has a similar field (like Mynxx), just change the value.


Thank you ! this is what was missing! :)
Title: Re: [SOLVED] ajax registration
Post by: Ventsi Genchev on April 16, 2010, 23:35:31 pm
Nice error in VirtueMart.  ;D

Go to the page to change your account settings and change your email address with:

Code: [Select]
ewerwerwerwyterwutfrde@asdas
or

Code: [Select]
ewerwerwerwyterwutfrde@asdas.comco
Or just try to register similar or greater in length email addresses.

Explorer crashes, right?  ;D Problem in the script.
Mozilla can handle, but IE .....
If I am a buyer, I will never enter this site again.
I would hardly think that is my fault and is in the spelling of the email.


How to fix it:

From:
Code: [Select]
if( !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email.value))) {
To:
Code: [Select]
if( !(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(form.email.value))) {

Where:

/administrator/components/com_virtuemart/classes/ps_userfield.php
(2 positions if you use this hack. Otherwise, one position)

/administrator/components/com_virtuemart/html/checkout_register_form.php
(1 position if you use this hack.)

Title: Re: [SOLVED] ajax registration
Post by: daviddickens on April 20, 2010, 07:50:58 am
Add to your theme.css

Code: [Select]
#register_stretcher input.button {margin-bottom: 54px;}
Оr change the value according to your template.
If you use a template that has a similar field (like Mynxx), just change the value.



Thank you! It works.
Title: Re: [SOLVED] ajax registration
Post by: Hermes on April 21, 2010, 02:20:59 am
I'm using your hack, and in the case of the email tester I'm using the same regular expresion that uses PhpMailer. I'm sure that these guys knows more than me about regular expresions, in fact, works perfect, and works with some very complicated emails that can't be validated with your script. I only have tested with Navigators that works in Mac Platform. So, If you can test with IE Explorer 6-7&8, it would be nice to know if works as well as in the Mac Platform.

The regex is:

Code: [Select]
if( !(/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/.test(form.email.value)))


Thanks for this Hack Man!

Bye!
Title: Re: [SOLVED] ajax registration
Post by: Ventsi Genchev on April 22, 2010, 08:03:56 am
Yes, it's even better, but there is a need for such verification?
Otherwise, your method is more accurate. Can benefit both. Matter of choice.  :)

And I want to emphasize that the hack is not mine. It is the work of peetree21. I just made some changes.  :)
Title: Re: [SOLVED] ajax registration
Post by: ors_86 on April 27, 2010, 16:21:44 pm
its works fine, the problem is that when user decides to edit again his shipping address, his email and username are not appear!
only that, otherwhise is perfect!
Title: Re: [SOLVED] ajax registration
Post by: Ventsi Genchev on April 27, 2010, 23:55:27 pm
Which version do you use? From the first post?
Title: Re: [SOLVED] ajax registration
Post by: sev on April 28, 2010, 21:14:15 pm
Guys,

Sorry but it still does not/not work fully for me.  Here's how it does and does not work:

After I implemment the second version of the hack:

a). I go to the store, without logging in, put stuff in the cart and go to checkout.  I say I am a first time customer and need to register.  I get the registration form and the hack works here like a charm.

b). If instead I click "Register" in the VM login module, I get the same registration form, but no ajax validation - the hack does not work here.

Does anyone else have the same situation?  :(

Thanks.
Title: Re: [SOLVED] ajax registration
Post by: tenguka on May 04, 2010, 22:43:27 pm
Hi guys,

Thanks for the awesome hack. This should definitely be part of virtuemart. I am having the same issue as sev. It works in the checkout process when you register. But if I do a 'register now' to here /index.php?option=com_virtuemart&page=shop.registration I get a javascript error as so:

Code: [Select]
$ is not defined
This usually means jquery isn't being found so I load jquery from my template and now get this error:

Code: [Select]
$("email_ticker").setHTML is not a function
Any help on this would be very much appreciated.

Cheers!
Title: Re: [Really - SOLVED?] ajax registration
Post by: sev on May 27, 2010, 21:01:21 pm
Well, after some digging in Joomla code by a friend he came up with a solution to this.

In the file /administrator/components/com_virtuemart/html/shop.registration.php after this:

if( empty($auth['user_id']) ) {

add this:

vmCommonHTML::loadMooTools();

Works like a charm now.
Title: Re: [SOLVED] ajax registration
Post by: tenguka on May 28, 2010, 03:21:38 am
Awesome..that fixed it and it works like a charm. Three cheers to the Ajax fix for registration. Make this part of core please :-)
Title: Re: [SOLVED] ajax registration
Post by: mike420 on June 07, 2010, 09:59:39 am
I have converted this hack to work with Virtuemart 1.0.15.

It seems to work ok!!

I have also added a "Confirm Email" box.


in administrator/components/com_virtuemart/checkout_register_form.php

Find:
Code: [Select]
if (!empty( $missing )) {
echo "<script type=\"text/javascript\">alert('".$VM_LANG->_CONTACT_FORM_NC."'); </script>\n";
}


Replace with:
Code: [Select]
?>


<script language="javascript" type="text/javascript">

<?php global $mosConfig_live_site?>

function getUsername(){
var form = document.adminForm;
var uname = form.username.value;

if( !$('username_ticker') )
$('username_div').innerHTML = $('username_div').innerHTML + "<div id=\"username_ticker\" class=\"<?php if ($page == 'shop.registration') { 
echo 'usernameajax'/*Need to change for your template*/
 
}
else { 
echo 'usernameajax2'/*Need to change for your template*/
 } ?>

\"></div>";

$('username_field').value = uname;

if( form.username.value.length < 3 ) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC url(./images/publish_x.png) no-repeat 6px 6px; border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 25px; float:left;">More than 2 characters!</span>';
} else {
$('username_ticker').innerHTML = "<img src=\"<?php echo $mosConfig_live_site?>/images/wait.gif\">&nbsp;Checking";
var url = 'index.php?option=com_virtuemart&task=chkuserinfo&format=raw&what=uname';
url = url + '&uname=' + form.username.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC url(./images/publish_x.png) no-repeat 6px 6px; border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 25px;float:left;">Already Used!</span>';
} else {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC url(./images/tick.png) no-repeat 6px 6px; border:1px solid #390; color:green;font-weight:bold;padding:5px 5px 5px 25px;float:left;">Available.</span>';
}
}
}).request();

}
}


function getEmail(){

var form = document.adminForm;
var email = form.email.value;

if( !$('email_ticker') )
$('email_div').innerHTML = $('email_div').innerHTML + "<div id=\"email_ticker\" class=\"<?php if ($page == 'shop.registration') { 
echo 'useremailajax'/*Need to change for your template*/
 
}
else { 
echo 'useremailajax2'/*Need to change for your template*/
 } ?>

\"></div>";

$('email_field').value = email;

if( !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email.value))) {
$('email_ticker').setHTML('<span style="background:#FFFFCC url(./images/publish_x.png) no-repeat 6px 6px;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 25px;float:left;">Not Valid!</span>');
} else {
$('email_ticker').setHTML("<img src=\"<?php echo $mosConfig_live_site?>/images/wait.gif\">&nbsp;Checking");
var url = 'index.php?option=com_virtuemart&task=chkuserinfo&format=raw&what=email';
url = url + '&email=' + form.email.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('email_ticker').setHTML('<span style="background:#FFFFCC url(./images/publish_x.png) no-repeat 6px 6px; border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 25px;float:left;">Already Registered.</span>');
} else {
$('email_ticker').setHTML('<span style="background:#FFFFCC url(./images/tick.png) no-repeat 6px 6px; border:1px solid #390; color:green;font-weight:bold;padding:5px 5px 5px 25px;float:left;">Not Registered.</span>');
}
}
}).request();

}
}

</script>
<?php



if (!empty( $missing )) {
echo "<script type=\"text/javascript\">alert('".$VM_LANG->_('CONTACT_FORM_NC',false)."'); </script>\n";
}

You will need to change the classes to suit your template /*Need to change for your template*/

The classes I used for my template.css were:
Code: [Select]
.usernameajax {position:absolute; top:505px; left:630px; z-index:6000;}
.usernameajax2 {position:absolute; top:635px; left:480px; z-index:6000;}

.useremailajax {position:absolute; top:535px; left:630px; z-index:6000;}
.useremailajax2 {position:absolute; top:665px; left:480px; z-index:6000;}


In the same file find:
Code: [Select]
$shopper_fields['email'] = $VM_LANG->_REGISTER_EMAIL;
Add directly below:
Code: [Select]
$shopper_fields['email2'] = $VM_LANG->_REGISTER_EMAIL2;

Find:
Code: [Select]
case 'agreed':
echo '<input type="checkbox" id="agreed_field" name="agreed" value="1" class="inputbox" />';
break;

Add directly below:
Code: [Select]
case 'email':
echo '<input type="text" id="'.$fieldname.'_field" name="'.$fieldname.'" size="30" onchange="getEmail();" value="'. ($db->sf($fieldname, true, false)?$db->sf($fieldname, true, false):'') .'" class="inputbox" />'."\n";
break;

case 'email2':
echo '<input type="text" id="'.$fieldname.'_field" name="'.$fieldname.'" size="30" class="inputbox" />'."\n";
break;

case 'username':
echo '<input type="text" id="'.$fieldname.'_field" name="'.$fieldname.'" size="30" onchange="getUsername();" value="'. ($db->sf($fieldname, true, false)?$db->sf($fieldname, true, false):'') .'" class="inputbox" />'."\n";
break;


in file administrator/components/com_virtuemart/htmlTools.class.php

Find:
Code: [Select]
if( in_array( 'email', $required_fields)) {

echo '
if( !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email.value))) {
alert( \''. html_entity_decode( $VM_LANG->_REGWARN_MAIL ).'\');
return false;
}';

}


Add after:
Code: [Select]
if( in_array( 'email2', $required_fields)) {

echo '
if (form.email2.value == "") {
alert( "'.html_entity_decode( $VM_LANG->_REGWARN_MAIL2).'" );
return false;
} else if ((form.email.value != "") && (form.email.value != form.email2.value)){
alert( "'. html_entity_decode( $VM_LANG->_REGWARN_MAIL3).'" );
return false;
}';

}


in file administrator/components/com_virtuemart/languages/english.php

Find:
Code: [Select]
var $_REGISTER_EMAIL = 'Email';
Add after:
Code: [Select]
var $_REGISTER_EMAIL2 = 'Confirm E-mail';
find:
Code: [Select]
var $_REGWARN_MAIL = 'Please enter a valid e-mail address!';
Add after:
Code: [Select]
var $_REGWARN_MAIL2 = 'Please confirm your e-mail!';
var $_REGWARN_MAIL3 = 'E-mail confirmation does not match, please try again!';


in file components/com_virtuemart/virtuemart.php

Find:
Code: [Select]
include( $mosConfig_absolute_path.'/administrator/components/'.$option.'/compat.joomla1.5.php');
Add after:
Code: [Select]
$task = mosGetParam($_REQUEST, 'task' );

if($task=="chkuserinfo"){
global $database;
$email = mosGetParam($_REQUEST, 'email' );
$uname = mosGetParam($_REQUEST, 'uname' );

$what = mosGetParam($_REQUEST, 'what' );

$usercount = 0;
$emailcount = 0;


if($what == "uname"){

$database->setQuery("SELECT COUNT(*) FROM #__users WHERE username='$uname'");
$usercount = $database->loadResult();
if($usercount)
echo "1";
else
echo "0";

} else if ($what == "email") {
$database->setQuery("SELECT COUNT(*) FROM #__users WHERE email='$email'");
$emailcount = $database->loadResult();

if($emailcount)
echo "1";
else
echo "0";

}

die();
}


I think that's all!!!!
Title: Re: [SOLVED] ajax registration
Post by: rok on June 16, 2010, 19:45:39 pm
I'm having problems, because my website has ja-mesolite virtuemart theme. The problem is that the ajax registration works only when user tries to check-out items (without being logged in) and it doesn't work when user tries to register through virtuemart login module on the left.

Also am having same issues as people before me with registration button to dissapear on ajax registration webpage (those hacks sadly don't work for me)...

Thank you for your help...
Title: Re: [SOLVED] ajax registration
Post by: realcyrus on June 17, 2010, 16:59:11 pm
I noticed a problem with this hack;
Assume that a user is already registered and tries to edit his user data;
If he enters another username or email, and then again enters his current username or email, the form will say 'username / email already in use';
So I modified the code in components/com_virtuemart/virtuemart.php to check if it is the active username or email.

Code: [Select]
$tasked = JRequest::getVar( 'tasked' );

if($tasked=="chkuserinfo"){
$database = & JFactory::getDBO();
$actuser = & JFactory::getUser();
$actusername = $actuser->get('username');
$actemail = $actuser->get('email');
$email = JRequest::getVar( 'email' );
$uname = JRequest::getVar( 'uname' );

$what = JRequest::getVar( 'what' );

$usercount = 0;
$emailcount = 0;

if($what == "uname"){
if (strcasecmp($uname, $actusername) == 0){
echo 0;
} else {
$database->setQuery("SELECT COUNT(*) FROM #__users WHERE username='$uname'");
$usercount = $database->loadResult();
if($usercount)
echo "1";
else
echo "0";
}

} else if ($what == "email") {
if (strcasecmp($email, $actemail) == 0){
echo 0;
} else {
$database->setQuery("SELECT COUNT(*) FROM #__users WHERE email='$email'");
$emailcount = $database->loadResult();

if($emailcount)
echo "1";
else
echo "0";
}
}

die();
}


Title: Re: [SOLVED] ajax registration
Post by: _fD_ on August 27, 2010, 11:22:16 am
Hello Guys

Great hack. So far i see, it does completly the job.

Many thanks.

Urs
Title: Re: [SOLVED] ajax registration
Post by: realayumi on September 14, 2010, 11:20:19 am
But if we forget to input 1 required (*) field, after we click send, all the data we already typed become blank? And user will type it again?
Title: Re: [SOLVED] ajax registration
Post by: alex2010 on September 15, 2010, 08:48:03 am
hello
i asked mike420 or other friends to correct directory of files in post 37
fo example i cant find the code you put from "htmlTools.class.php"

i use v-m 1.1.5  and joomla 1.5.20
Title: Re: [SOLVED] ajax registration
Post by: bobysolo on September 27, 2010, 23:42:28 pm
its works fine, the problem is that when user decides to edit again his shipping address, his email and username are not appear!
only that, otherwhise is perfect!

I have the same problem - otherwise it works like a charm. For now I just disabled those fields in the account maintenance page.

Joomla 1.5.20 and VM 1.1.4.
Title: Re: [SOLVED] ajax registration
Post by: mike420 on September 28, 2010, 02:03:30 am
hello
i asked mike420 or other friends to correct directory of files in post 37
fo example i cant find the code you put from "htmlTools.class.php"

i use v-m 1.1.5  and joomla 1.5.20


As stated in the first line of my post.. "I have converted this hack to work with Virtuemart 1.0.15."

So I'm not sure what is wrong with your version!!
Title: Re: [SOLVED] ajax registration
Post by: Pyno on December 15, 2010, 16:11:14 pm
First big thanks to peetree21 for a shared hack.

Well, I think I fixed most problems.


So  ;)

* fixed: not showing name and password in the form to change user data.
* fixed: in form to change user data has also investigated the email and username.
* fixed: length of fields and characters for a username and email can now be adjusted as other fields in the admin panel.
(Tests were made with VirtueMart 1.1.4 and IE6, IE7, IE8 and Mozilla)


According to recent tests that have been made, everything works as it should be.

Noted problems: not detected




Here's what should be done:


1. FILE: /administrator/components/com_virtuemart/html/checkout_register_form.php

CHANGE THESE LINEs
Code: [Select]
$missing = vmGet( $_REQUEST, "missing", "" );

if (!empty( $missing )) {
echo "<script type=\"text/javascript\">alert('".$VM_LANG->_('CONTACT_FORM_NC',false)."'); </script>\n";
}

AND REPLACE IT WITH THIS CODE:
Code: [Select]
$missing = vmGet( $_REQUEST, "missing", "" );

?>

<script language="javascript" type="text/javascript">



function getUsername(){
var form = document.adminForm;
var uname = form.username.value;

if( !$('username_ticker') )
$('username_input').innerHTML = $('username_input').innerHTML + "<div id=\"username_ticker\" style=\"padding-top:10px;\"></div>";

$('username_field').value = uname;

if( form.username.value.length < 3 ) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">Username : This input value is not valid.</span>';
} else {
$('username_ticker').innerHTML = "<img src=\"<?php echo JURI::base()."images/wait.gif";?>\">&nbsp;Checking";
var url = 'index.php?option=com_virtuemart&tasked=chkuserinfo&format=raw&what=uname';
url = url + '&uname=' + form.username.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">This username is already registered.</span>';
} else {
$('username_ticker').innerHTML = '<span style="border:1px none transparent;color:green;padding:5px 5px 5px 5px;">The username \''+ $('username_field').value +'\' is free for registration: you can proceed.</span>';
}
}
}).request();

}
}


function getEmail(){

var form = document.adminForm;
var eadd = form.email.value;

if( !$('email_ticker') )
$('email_input').innerHTML = $('email_input').innerHTML + "<div id=\"email_ticker\" style=\"padding-top:10px;\"></div>";

$('email_field').value = eadd;

if( !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email.value))) {
$('email_ticker').setHTML('<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">Email : This input value is not valid.</span>');
} else {
$('email_ticker').setHTML("<img src=\"<?php echo JURI::base()."images/wait.gif";?>\">&nbsp;Checking");
var url = 'index.php?option=com_virtuemart&tasked=chkuserinfo&format=raw&what=email';
url = url + '&email=' + form.email.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('email_ticker').setHTML('<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">This email is already registered.</span>');
} else {
$('email_ticker').setHTML('<span style="border:1px none transparent;color:green;padding:5px 5px 5px 5px;">The email \''+ $('email_field').value +'\' is free for registration: you can proceed.</span>');
}
}
}).request();

}
}



</script>
<?php

if (!empty( $missing )) {
echo "<script type=\"text/javascript\">alert('".$VM_LANG->_('CONTACT_FORM_NC',false)."'); </script>\n";
}



2. FILE: /administrator/components/com_virtuemart/classes/ps_userfield.php

AFTER THESE LINES
Code: [Select]
case 'password':
case 'password2':
echo '<input type="password" id="'.$field->name.'_field" name="'.$field->name.'" size="30" class="inputbox" />'."\n";
    break;

ADD THE CODES BELOW:
Code: [Select]
case 'email':
$maxlength = $field->maxlength ? 'maxlength="'.$field->maxlength.'"' : '';
echo '<input type="text" id="'.$field->name.'_field" name="'.$field->name.'" size="'.$field->size.'" onchange="getEmail();" value="'. ($db->sf($field->name, true, false)?$db->sf($field->name, true, false):'') .'" class="inputbox" '.$maxlength . $readonly . ' />'."\n";
  break;
case 'username':
$maxlength = $field->maxlength ? 'maxlength="'.$field->maxlength.'"' : '';
echo '<input type="text" id="'.$field->name.'_field" name="'.$field->name.'" size="'.$field->size.'" onchange="getUsername();" value="'. ($db->sf($field->name, true, false)?$db->sf($field->name, true, false):'') .'" class="inputbox" '.$maxlength . $readonly . ' />'."\n";
  break;


3. In the same file (ps_userfield.php)

AFTER THESE LINES
Code: [Select]
      /**
      * This is the most important part of this file
      * Here we print the field & its contents!
      */

ADD THE CODES BELOW:
Code: [Select]
             ?>
             
             <script language="javascript" type="text/javascript">



function getUsername(){
var form = document.adminForm;
var uname = form.username.value;

if( !$('username_ticker') )
$('username_input').innerHTML = $('username_input').innerHTML + "<div id=\"username_ticker\" style=\"padding-top:10px;\"></div>";

$('username_field').value = uname;

if( form.username.value.length < 3 ) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">Username : This input value is not valid.</span>';
} else {
$('username_ticker').innerHTML = "<img src=\"<?php echo JURI::base()."images/wait.gif";?>\">&nbsp;Checking";
var url = 'index.php?option=com_virtuemart&tasked=chkuserinfo&format=raw&what=uname';
url = url + '&uname=' + form.username.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('username_ticker').innerHTML = '<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">This username is already registered.</span>';
} else {
$('username_ticker').innerHTML = '<span style="border:1px none transparent;color:green;padding:5px 5px 5px 5px;">The username \''+ $('username_field').value +'\' is free for registration: you can proceed.</span>';
}
}
}).request();

}
}


function getEmail(){

var form = document.adminForm;
var eadd = form.email.value;

if( !$('email_ticker') )
$('email_input').innerHTML = $('email_input').innerHTML + "<div id=\"email_ticker\" style=\"padding-top:10px;\"></div>";

$('email_field').value = eadd;

if( !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email.value))) {
$('email_ticker').setHTML('<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">Email : This input value is not valid.</span>');
} else {
$('email_ticker').setHTML("<img src=\"<?php echo JURI::base()."images/wait.gif";?>\">&nbsp;Checking");
var url = 'index.php?option=com_virtuemart&tasked=chkuserinfo&format=raw&what=email';
url = url + '&email=' + form.email.value;

new Ajax(url, {
method: 'get',
onComplete: function(x){
if(x == 1) {
$('email_ticker').setHTML('<span style="background:#FFFFCC;border:1px solid #CC0000;color:red;font-weight:bold;padding:5px 5px 5px 5px;">This email is already registered.</span>');
} else {
$('email_ticker').setHTML('<span style="border:1px none transparent;color:green;padding:5px 5px 5px 5px;">The email \''+ $('email_field').value +'\' is free for registration: you can proceed.</span>');
}
}
}).request();

}
}



</script>
        <?php



4. FILE: /components/com_virtuemart/virtuemart.php

AFTER THESE LINE
Code: [Select]
global $mosConfig_absolute_path, $product_id, $vmInputFilter, $vmLogger;
ADD THE CODES BELOW:
Code: [Select]
$tasked = JRequest::getVar( 'tasked' );

if($tasked=="chkuserinfo"){
$database = & JFactory::getDBO();
$email = JRequest::getVar( 'email' );
$uname = JRequest::getVar( 'uname' );

$what = JRequest::getVar( 'what' );

$usercount = 0;
$emailcount = 0;


if($what == "uname"){
$database->setQuery("SELECT COUNT(*) FROM #__users WHERE username='$uname'");
$usercount = $database->loadResult();
if($usercount)
echo "1";
else
echo "0";

} else if ($what == "email") {
$database->setQuery("SELECT COUNT(*) FROM #__users WHERE email='$email'");
$emailcount = $database->loadResult();

if($emailcount)
echo "1";
else
echo "0";
}


die();
}


ALSO MAKE SURE THE IMAGE BELOW IS UPLOADED INTO THE  /images DIRECTORY ON YOUR SERVER


I hope this will help. I expect feedback from your tests. Good luck to all.  :)

Is it possible to make this compatible with mootools 120? I must use mootools 120, but if I add this vmCommonHTML::loadMooTools(); they stop working!
Title: Re: [SOLVED] ajax registration
Post by: Qzmarcia on March 02, 2011, 21:10:11 pm
VERY GOOD SOLUTIONS !!

I WANT NOW WHERE I CAN CHANGE THE TEXT: The username 'Qzkkkyan' is free for registration: you can proceed.

FOR MY NATIVE LANGUAGE.

TO REGARDS

QZ MARCIA
Title: Re: [SOLVED] ajax registration
Post by: lindapowers on March 03, 2011, 18:35:56 pm
great... but I will wait until they add it officially.
Title: Re: [SOLVED] ajax registration [but still AUTO-LOGIN issue for some of us]
Post by: cyran0 on March 16, 2011, 15:10:09 pm
Hi

I successfully patch my 1.1.7 ver of VirtueMart ... thx a bunch, it is great : all the validations on the same page !

I have a related question which involve, I think, the same php pages.

With the email account activation in place, right after a successful registration why is the response page indicating a successful registration AND a login failure ?

Quote
Login denied! Your account has either been blocked or you have not activated it yet. Did you not get an activation e-mail and follow the validation link?

My guess is that there is some kind of auto-login which does not make sense for my setup since the new user must activate the account with the link inside the registration email first !

Lately, I applied another small patch which activates error messages, including the one above, through out the whole site, I added the line
    <jdoc:include type="message" />
into this file
    C:\xampp\htdocs\ecommerce\templates\ja_larix\index.php
ref: http://forum.virtuemart.net/index.php?topic=50465.0

I bet there is a simple way to deactivate the auto-login for this case. Somebody knows how ?

thx in advance
Title: Re: [SOLVED] ajax registration
Post by: lindapowers on April 01, 2011, 19:41:50 pm
Man this would be great, read the entire post but so many codes and corrections I don't know where to start from. Someone has this working correctly in VM 1.1.8?
Title: Re: [SOLVED] ajax registration
Post by: maxxer on April 13, 2011, 12:35:19 pm
I'm attaching here a full patch for VM 1.1.7.
Thanks for sharing this!

Patch will apply with
patch -p1 < filename

[attachment cleanup by admin]
Title: Re: [SOLVED] ajax registration
Post by: lindapowers on April 14, 2011, 10:30:29 am
PATCH_verifica_utente.txt ????????????????????

Where does that file go and what is the name of that file? Oo
Title: Re: [SOLVED] ajax registration
Post by: didi235 on May 04, 2011, 04:48:33 am
This patch is great but i am having a problem with SSL. It seems to get stuck on the waiting image. Does anyone have this working with SSL?
Title: Re: [SOLVED] ajax registration
Post by: sirius on May 12, 2011, 17:32:19 pm
Hi,
implemented on virtuemart 1.1.8 (2nd method with all the corrections of the topic except mootools call)
joomla 1.5.23

All is ok, except that all username and all emails are always free to use...
Simple test with some already registered username, return always green/free to use.

Any same cases as my own ?

Thanks
Title: Re: [SOLVED] ajax registration
Post by: Derf on May 26, 2011, 13:18:41 pm
This is awesome, thanks so much!

A few questions:

1) How do I use the same system to validate matching passwords?
2) How can I implement the same system for all the fields in the VM registration (first name, last name, address, etc.)

Thanks a ton!
Title: Re: [SOLVED] ajax registration
Post by: abcisme on July 31, 2011, 15:58:33 pm
But if we forget to input 1 required (*) field, after we click send, all the data we already typed become blank? And user will type it again?

Check out this post:  http://forum.virtuemart.net/index.php?topic=78676.0

Title: Re: [SOLVED] ajax registration
Post by: drevokocur on November 02, 2011, 11:18:50 am
Tested on VirtueMart 1.1.2 stable. Works perfectly! Thanks!!!
Title: Re: [SOLVED] ajax registration
Post by: AlfredJK on August 09, 2012, 21:06:13 pm
Hi, i know the topic is old but i have still te problem that the registration button scrolls down and only available by pressing the tab. I added the syntax
#register_stretcher input.button {margin-bottom: 54px;} but it didn't help. I'am using IE 9. Firefox and chrome works perfect!

HELP!
Title: Re: [SOLVED] ajax registration
Post by: Roger Lightening on May 26, 2014, 14:10:35 pm
Thank you, thank you, thank you!
Your post has saved me hours of work. I manage a old VirtueMart website and this hack has probably saved me eight hours of work. Implemented the hack as per Vanci's post and it works perfectly.