Author Topic: [Solved workaround] Not possible to agree Terms of Service VM 2.0.6  (Read 5522 times)

wooq

  • Beginner
  • *
  • Posts: 2
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

  • Beginner
  • *
  • Posts: 33
Re: Not possible to agree Terms of Service VM 2.0.6
« Reply #1 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

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

Should maybe

Code: [Select]
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

Code: [Select]
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

Code: [Select]
$this->tosAccepted = 1;

wooq

  • Beginner
  • *
  • Posts: 2
Re: Not possible to agree Terms of Service VM 2.0.6
« Reply #2 on: April 21, 2012, 16:05:46 pm »
Hi Archos,

Thank you so very much!

At first I changed:


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

to

Code: [Select]
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

  • Jr. Member
  • **
  • Posts: 234
    • ConCom
  • Skype Name: sandstorm871
  • VirtueMart Version: 3.0.16
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

  • Beginner
  • *
  • Posts: 5
Re: Not possible to agree Terms of Service VM 2.0.6
« Reply #4 on: June 17, 2012, 08:48:59 am »
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
I got also trouble with the TOS.
I feel the problem is located on com_virtuemart\helpers\cart.php

on line 165

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

Should maybe

Code: [Select]
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

Code: [Select]
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

Code: [Select]
$this->tosAccepted = 1;