[Bug] Terms-of-Service Checkbox Field Showing With ToS Disabled

Started by terp, April 18, 2012, 23:29:21 PM

Previous topic - Next topic

terp

...perhaps related to a workout you guys did in the cart.php file:

/* The problem here is that we use a form for the quantity boxes and so we cant let the form start here,
* because we would have then a form in a form.
*
* But we cant make an extra form here, because then pressing the above checkout button would not send the
* user notices for exampel. The solution is to write a javascript which checks and unchecks both tos checkboxes simultan
* The upper checkout button should than just fire the form below.



<input class="terms-of-service" id="tosAccepted" type="checkbox" name="tosAccepted" value="1">





[attachment cleanup by admin]

terp

Everyone else just lives with it or should I just strip it out using an override?

teobgeno

At components/com_virtuemart/views/cart/tmpl/default.php line 127 - 132



   <?php
if(!class_exists('VmHtml'))require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'html.php');
echo VmHtml::checkbox('tosAccepted',$this->cart->tosAccepted,1,0,'class="terms-of-service"');

if(VmConfig::get('oncheckout_show_legal_info',1)){
?>




The if(!class_exists('VmHtml'))require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'html.php');
            echo VmHtml::checkbox('tosAccepted',$this->cart->tosAccepted,1,0,'class="terms-of-service"');

must be below the if(VmConfig::get('oncheckout_show_legal_info',1)){

like this


  <?php


if(VmConfig::get('oncheckout_show_legal_info',1)){
if(!class_exists('VmHtml'))require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'html.php');
echo VmHtml::checkbox('tosAccepted',$this->cart->tosAccepted,1,0,'class="terms-of-service"');
?>




I am talking about the default template of virtuemart 2.0.6 . I think you will be ok with this modification.

zebrafilm

Thanks, but it removes the checkbox but it keeps asking/warning to check it.

Bastiaan

teobgeno

Are you sure that the option Must agree to Terms of Service on EVERY ORDER? is unchecked at configuration->checkout( tab ) ?

terp

It's forcing people to check the box, whether the backened params related to the Terms-of-Service are checked or not...cart compiles with the checkbox and forces the check...clearly a bug.


katalystsol

I have the same issue with a clean install of 2.0.6 on J1.5.26

For me, it outputs two fields with the same name attribute:


<input type="hidden" name="tosAccepted" value="0"><input class="terms-of-service" id="tosAccepted" type="checkbox" name="tosAccepted" value="1" checked="checked" />



teobgeno

At components/com_virtuemart/helpers/cart.php

Below is setting the agree to terms var

if((!empty($user->agreed) || !empty($this->BT['agreed'])) && !VmConfig::get('agree_to_tos_onorder',0) ){
$this->tosAccepted = 1;
}




Try to modify it to

$this->tosAccepted = 1;

if((!empty($user->agreed) || !empty($this->BT['agreed'])) && !VmConfig::get('agree_to_tos_onorder',0) ){
$this->tosAccepted = 1;
}



But this is not a correct solution just a quick fix .

teobgeno

QuoteFor me, it outputs two fields with the same name attribute

I don't have this output with joomla 1.5.26 vm 2.0.6 (vm template default) (joomla template default)
Try to check your vm template in case you have made an override.

zebrafilm

Adding $this->tosAccepted = 1; makes the checkbox checked by default.

That helps already. :-)

Lets hope it will be fixed in the next version.

Bastiaan

terp

Quote from: zebrafilm on April 26, 2012, 21:31:37 PM
Adding $this->tosAccepted = 1; makes the checkbox checked by default.

That helps already. :-)

Lets hope it will be fixed in the next version.

Bastiaan

Yea, that's what I ended up doing, then just hide the field in the CSS ( .checkout-button-top input.terms-of-service ).


terp

Do reported bugs often get overlooked here in VM world? Are we supposed to log them somewhere else?


murenti

I am very grateful for Virtuemart and the people behind it. 

Its easy to sling criticism from the side lines but is it helpful???

You are enjoying the benefits of VirtueMart and the help of volunteers to solve your issues YET you are ready to make rude remarks at the first chance.  Instead of picking and criticizing why dont you offer something constructive to VirtueMart and the Human race by thinking of others instead of yourself.


terp

Quote from: murenti on May 02, 2012, 04:09:25 AM
I am very grateful for Virtuemart and the people behind it. 

Its easy to sling criticism from the side lines but is it helpful???

You are enjoying the benefits of VirtueMart and the help of volunteers to solve your issues YET you are ready to make rude remarks at the first chance.  Instead of picking and criticizing why dont you offer something constructive to VirtueMart and the Human race by thinking of others instead of yourself.

You talking to me? Show me one instance where I made "rude remarks." Don't you have an Occupy Wallstreet march to attend, Mr. Cosmopolitan? (was that rude?)