VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: remeedella on January 24, 2013, 02:23:21 AM

Title: Agree to ToS required checkout problem
Post by: remeedella on January 24, 2013, 02:23:21 AM
Hello,

I`ve been looking for this solution for several days and finally got help to come across a solution. Agree to Terms of Service requirement in virtuemart settings, require user to be registered to checkout and show terms of service on checkout are all enabled.

This problem exists on the latest virtuemart on a clean install. Some people encounter the problem where you do not put a checkmark in the box checking out from your cart and you can still continue to step 2.. Why is that? It makes me think that `require` setting doesnt work at all. It actually does, you are only prompted an error to agree to ToS at the end of checkout steps confirming your order. That, or if you have your shipping method (step 2) , your payment method (step 3) and your billing address all filled out and you haven`t agreed to Tos yet then you will be prompted. That seems confusing and inaccurate.

Users should be prompted immediately to agree to ToS or it should be written `by clicking check out now you have confirmed to the Terms of Service.` I would strongly recommend adjusting this on a future release of virtuemart or offering us the option as a setting in back-end. I looked like crazy for a solution to this problem that I don't think used to happen in in virtuemart 1 or older versions of Joomla, nobody had an answer.

Solution:

components/com_virtuemart/helpers/cart.php

move line 896

   if ($this->tosAccepted == 0) {

$userFieldsModel = VmModel::getModel('Userfields');

$required = $userFieldsModel->getIfRequired('agreed');
if(!empty($required)){
$redirectMsg = JText::_('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
return $this->redirecter('index.php?option=com_virtuemart&view=cart' , $redirectMsg);
}
}

all that should be moved to line 770. Voila, ToS takes priority when trying to checkout, no need to be at the last step of checkout and confirming your purchase to be prompted, you are prompted immediately.
Title: Re: Agree to ToS required checkout problem
Post by: remeedella on January 27, 2013, 21:23:11 PM
no one ran into this? :O I'd be surprised
Title: Re: Agree to ToS required checkout problem
Post by: Milbo on January 31, 2013, 20:00:27 PM
There is another post already exactly pointing out the same thing.
Title: Re: Agree to ToS required checkout problem
Post by: remeedella on February 01, 2013, 22:22:15 PM
Okay thanks Milbo. I literally searched the forum, joomla forum, google like crazy. There were no examples or fixes for this problem and I couldnt find the post you suggested. It took me days lol so I dont want anyone to have trouble with this either. I already showed this to Val. Thanks!
Title: Re: Agree to ToS required checkout problem
Post by: Milbo on February 03, 2013, 19:27:14 PM
Just used this post, changed.
Title: Re: Agree to ToS required checkout problem
Post by: remeedella on March 18, 2013, 20:51:28 PM
awesomee!