VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: aeiweb on November 16, 2012, 17:44:21 PM

Title: Terms of service not checked HIGHLIGHTING
Post by: aeiweb on November 16, 2012, 17:44:21 PM
SO! Got it configured that when you check out you must agree to the terms of service. At the moment you can add stuff to your cart, start your checkout, and it takes you to fill in your address and such, then kicks you back to the cart, as it should.

BUT

When you try to finalize your checkout and HAVE NOT agreed to the terms of service, IT DOES NOT WARN YOU that thats why you can't check out. If the TOS isn't agreed to, it just loops you back into the cart over and over again. I need a popup or a note or something that says "AGREE TO THE TERMS OF SERVICE JERK" and then you can checkout. Just a little notice, nothing crazy.

Any ideas?
Title: Re: Terms of service not checked HIGHLIGHTING
Post by: aeiweb on November 26, 2012, 21:49:53 PM
Sorry, but has anybody got an update on this?  Its the last thing I need for the site to launch!
Title: Re: Terms of service not checked HIGHLIGHTING
Post by: bytelord on November 26, 2012, 22:20:32 PM
Hello,

First of all you have not say which version of joomla and vm2 you are using. To your issue is been inform you thought joomla system messages, usually at the top of the page "Please accept the terms of service to confirm" ...
may be you have "hide" or you are using any joomla template that hides system messages, check it out, this is not related to vm2 miss functionality.

Regards
Title: Re: Terms of service not checked HIGHLIGHTING
Post by: dsherwin on April 24, 2013, 00:22:03 AM
Hi,

Hoping someone can help, if the user does not click on the checkbox for terms of service and clicks on "Check Out Now", the page is reloaded without any indication that the user did not tick the checkbox.
Is there any way to highlight this to the user?

Thanks
Darragh


virtuemat 2.0.20b
Joomla 2.5.9

Title: Re: Terms of service not checked HIGHLIGHTING
Post by: jenkinhill on April 24, 2013, 10:06:46 AM
You may need to add this code to your Joomla template header:

<jdoc:include type="message" />
Title: Re: Terms of service not checked HIGHLIGHTING
Post by: dsherwin on April 24, 2013, 23:54:39 PM
Figured it out, the problem is that clicking on the "Check out now" calls submit on the form without checking if the checkbox is ticked.

The fix is to add the following views/cart/tmpl/default.php (after line 61)

$document->addScriptDeclaration ("
jQuery(document).ready(function($) {
$('a.vm-button-correct').click(function(event)
{
if( $('input#tosAccepted').is(':checked') )
{
document.checkoutForm.submit();
}
else
{
$('a.terms-of-service').css('background-color', 'red');
}
});
});
");


Change views/cart/view.html.php, line 141
from

$checkout_link_html = '<a class="vm-button-correct" href="javascript:document.checkoutForm.submit();" ><span>' . $text . '</span></a>';

to

$checkout_link_html = '<a class="vm-button-correct" href="#" ><span>' . $text . '</span></a>';


This will block the form from being submitted until the user has clicked the Terms of Service checkbox and highlight it in red

Regards
Darragh
Title: Re: Terms of service not checked HIGHLIGHTING
Post by: servlet on May 24, 2013, 11:53:10 AM
In
com_virtuemart/views/cart/tmpl/default.php
Just replace this line:
echo VmHtml::checkbox ('tosAccepted', $this->cart->tosAccepted, 1, 0, 'class="terms-of-service"');
with this:
echo VmHtml::checkbox ('tosAccepted', $this->cart->tosAccepted, 1, 1, 'class="terms-of-service"');

or change value from 0 to 1