Just a note, is there a way to check if the user has checked the Terms of Service box and display a warning if they haven't?
Right now, the page just refreshes if the user hasn't checked the box, if they hit the submit button.
Thanks,
-Communion
In the interest of helping, I just implemented one into my site by doing the following. The first file is a template file so it could be in your template folder.
In the folder com_virtuemart/views/cart/default.php around line 324, depends on your template, find this line of code:
echo $this->checkout_link_html;
and add this piece of code:
<script type="text/javascript">
function checkFields(){
var checkbox = document.getElementById('tosAccepted');
if(!checkbox.checked){
alert("Please accept the Terms and Conditions");
return false;
}else{
document.checkoutForm.submit();
}
}
</script>
Next you will need to edit this line of code in com_virtuemart/views/cart/view.html.php right around line 140:
$checkout_link_html = '<a class="vm-button-correct" href="javascript: document.checkOutForm.submit();"><span>' . $text . '</span></a>';
and turn it into this:
$checkout_link_html = '<a class="vm-button-correct" href="javascript: void(0)" onclick="return checkFields();"><span>' . $text . '</span></a>';
This will make it so that an alert is popped unless the terms and conditions button is accepted.
But this is a core hack! After you update Virtuemart your changes will lost.
Quote from: kkmediaproduction on November 28, 2012, 00:08:18 AM
But this is a core hack! After you update Virtuemart your changes will lost.
Indeed it is. The template file won't change but you would have to re-do the view.html.php step again.