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.