[Bug] After a registration error, I can buy nevertheless

Started by grog24, May 08, 2013, 12:29:13 PM

Previous topic - Next topic

grog24

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

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

grog24

Is there a solution for this problem? I allow only registered users to checkout on my site.

Thanks

Milbo

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 );
}
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

grog24

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!

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/