[Solved workaround] Not possible to agree Terms of Service VM 2.0.6

Started by wooq, April 20, 2012, 18:17:43 PM

Previous topic - Next topic

wooq

Hi,

I have the bug that customers are not able to agree the "Terms of Service" and in order they cannot checkout...
They get the error code "Please accept the TOS"

I already checked every combination with the backend options: "Customer has to agree the TOS on every checkout" and "Show TOS information". (I don't know the exact english translation).

My question: Is there any way to fix this bug? Any Workaround?
or: Is it possible to deactivate that customers has to accept the TOS.


I already tried to delete the section in the cart.php and ind the default.php but as you can see without success.

Thank you in advance, I am seriously desperate...

shop: http://www.mittelrhein-openair.de/index.php/tickets
Joomla! 2.5.4
Virtuemart 2.0.6 public

archos

#1
I got also trouble with the TOS.
I feel the problem is located on com_virtuemart\helpers\cart.php

on line 165

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


Should maybe

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


with swaping ¦¦ and &&

agree_to_tos_onorder is related to the backend "Customer has to agree the TOS on every checkout" so it should override any user choice
($user->agreed is related to the check box on the cart view
BT['agreed']  I have no idea

Because I'm not sure about the way it should work maybe my hack is not the good way.

To help you to debug the issue you can add the following debug view

vmdebug('user agreed',$user->agreed);
vmdebug('BT agreed',$this->BT['agreed']);
vmdebug('agree_to_tos_onorder',VmConfig::get('agree_to_tos_onorder',0));
vmdebug('tosAccepted',$this->tosAccepted);


In any case you should be able to force the TOS by adding after the test condition

$this->tosAccepted = 1;


wooq

Hi Archos,

Thank you so very much!

At first I changed:


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


to

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


And it worked!
important was your hint with: ('agree_to_tos_onorder',0)
I changed it to ('agree_to_tos_onorder',1)
and voila it is working!

I know this is just a workaround, now I have to wait for a bugfix ;)

Thanks again, I switch this thread to solved



sandstorm

does this just make sure the checkbox is ticked?

I too have the problem with the text that says terms & conditions mus be agreed.

I have it set to yes in the back end, but in the front end there is now just a checkbox. the text has gone.

I followed the temp hack above, but this just automatically checks the box.

Anyone know how I can add the text back in to advise customer they must agree to T&C
J3.6.4 / PHP7.0.12
VM3.0.16

amitpatekar

Awesome thank you, it helped me a lot and save lot of time of debugging.
There are many such small bug in VM for 2.5 i guess.

Can you put some light on where to add the debug code.????

Regards
Amit Patekar
Quote from: archos on April 20, 2012, 23:28:13 PM
I got also trouble with the TOS.
I feel the problem is located on com_virtuemart\helpers\cart.php

on line 165

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


Should maybe

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


with swaping ¦¦ and &&

agree_to_tos_onorder is related to the backend "Customer has to agree the TOS on every checkout" so it should override any user choice
($user->agreed is related to the check box on the cart view
BT['agreed']  I have no idea

Because I'm not sure about the way it should work maybe my hack is not the good way.

To help you to debug the issue you can add the following debug view

vmdebug('user agreed',$user->agreed);
vmdebug('BT agreed',$this->BT['agreed']);
vmdebug('agree_to_tos_onorder',VmConfig::get('agree_to_tos_onorder',0));
vmdebug('tosAccepted',$this->tosAccepted);


In any case you should be able to force the TOS by adding after the test condition

$this->tosAccepted = 1;