VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: dylanphelan on August 16, 2012, 13:50:37 PM

Title: How to enable terms of service checkbox by default
Post by: dylanphelan on August 16, 2012, 13:50:37 PM
How do i check the terms of service checkbox by default?

Dont see this anywhere in config.

Title: Re: How to enable terms of service checkbox by default
Post by: bytelord on August 16, 2012, 14:00:53 PM
Hello,

I think the proper is the user checked by himself according that have already read the terms. But in case you want to do it you should add an attribute inside your custom template input method for terms check box. I think there  is no option from the backend to change the the attributes of the checkbox inside shopper fields.

The original should be like this:
<input class="terms-of-service" id="tosAccepted" type="checkbox" value="1" name="tosAccepted">


Change it to this by adding checked="checked" attribute.
<input class="terms-of-service" id="tosAccepted" type="checkbox" value="1" name="tosAccepted" checked="checked">


The above is an html example just add the attribute and please don't replace the whole line.

You have to add this attribute to your default cart template and in other layout template you want to change (billing address, registration, etc).

Hope it helps you out.

Regards,

Bytelord
Title: Re: How to enable terms of service checkbox by default
Post by: dandez on September 21, 2012, 02:12:38 AM
In the file virtuemart-template/cart/default.php

I have a line like this that matches most acurately to the one You've mentioned:

'<input class="terms-of-service" type="checkbox" name="tosAccepted" value="1" ' . $this->cart->tosAccepted . '/>

I tried to change it to:

'<input class="terms-of-service" type="checkbox"  checkbox="checkbox"  name="tosAccepted" value="1" ' . $this->cart->tosAccepted . '/>

and it didn't work for me.
Warmest Regards
Dan
Title: Re: How to enable terms of service checkbox by default
Post by: bytelord on September 21, 2012, 07:19:40 AM
Hello,

it should be

'<input class="terms-of-service" checked="checked" type="checkbox" name="tosAccepted" value="1" ' . $this->cart->tosAccepted . '/>

the above is until version 2.0.8e
Title: Re: How to enable terms of service checkbox by default
Post by: jmaracil on December 12, 2012, 11:39:51 AM
Hi:

In file com_virtuemart/helpers/cart.php

var $tosAccepted = true; intead of var $tosAccepted = null;

Regards
Title: Re: How to enable terms of service checkbox by default
Post by: bytelord on December 12, 2012, 12:38:20 PM
Yes also,

Thanks