VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: grog24 on May 08, 2013, 12:29:13 PM

Title: [Bug] After a registration error, I can buy nevertheless
Post by: grog24 on May 08, 2013, 12:29:13 PM
Hi all!

I found a bug regarding the checkout and registration process. When I enter all the data in the registration fields but make a mistake in the "Confirm Password" field or the username is already used, I've got the error message, but if now i go straight to the cart, all the data I had entered are displayed and i can proceed to the checkout process. Same things in the cart, after clicking "Register And Checkout" I've got the error message and I'm asked for the shipping method.

I've replicated the same things on the demo site.

Thank you for your hard work

Bye

Joomla! 2.5.11 - Virtuemart 2.0.20b
Title: Re: [Bug] After a registration error, I can buy nevertheless
Post by: Milbo on May 08, 2013, 12:35:29 PM
Interesting. It is intended that it works that way as long you allow unregistered users. But in fact it must be prevented if only registered users are allowed to checkout.
Title: Re: [Bug] After a registration error, I can buy nevertheless
Post by: grog24 on May 10, 2013, 12:28:03 PM
Is there a solution for this problem? I allow only registered users to checkout on my site.

Thanks
Title: Re: [Bug] After a registration error, I can buy nevertheless
Post by: Milbo on May 13, 2013, 20:28:15 PM
Please try in the FE controller user.php around line 212

instead this

if (is_array($ret) and $ret['success'] and !$useractivation) {
// Username and password must be passed in an array
$credentials = array('username' => $ret['user']->username,
  'password' => $ret['user']->password_clear
);
$return = $mainframe->login($credentials);
}


this here

if (is_array($ret) and $ret['success'] and !$useractivation) {
// Username and password must be passed in an array
$credentials = array('username' => $ret['user']->username,
  'password' => $ret['user']->password_clear
);
$return = $mainframe->login($credentials);
} else if(VmConfig::get('oncheckout_only_registered',0)){
$layout = JRequest::getWord('layout','edit');
$this->redirect( JRoute::_('index.php?option=com_virtuemart&view=user&layout='.$layout), $msg );
}
Title: Re: [Bug] After a registration error, I can buy nevertheless
Post by: grog24 on May 26, 2013, 18:56:37 PM
sorry for the late reply, I've tried with your fix but does not change anything. I've found a workaround that does what I want, I've added this:
if($currentUser->guest!=1){
$this->saveToCart($data);
}

instead of:
$this->saveToCart($data);
in the same user.php file under the function saveData and with this the data are stored only if the validation passes. The only downside is that all the field are empty if an error occurred, there is a solution for this last problem?

Thank you!
Title: Re: [Bug] After a registration error, I can buy nevertheless
Post by: Milbo on May 27, 2013, 00:11:05 AM
Please use the latest release candidate 2.0.21a http://forum.virtuemart.net/index.php?topic=115877.0