News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Terms of service

Started by maxlatino74, November 21, 2013, 23:56:06 PM

Previous topic - Next topic

maxlatino74

is a long time that I try to solve a problem of my WebSite: When I make an order, and I do not accept the terms of service, the order goes on when it should be stopped. It should show instead a warning that feels the need of the terms of service with a popup ... can you solve this problem?

i already enabled in the settings that need to accept the terms of service to every order
:'(
i use 2.0.24b

shopper999

I have the same problem on Joomla! 2.5.17 and 2.0.26a

shopper999

#2
If I use VM 2.0.24, everything works fine.
After directly upgrading to 2.0.26a without additional changes, "accepting the TOS" is NOT validated any more correctly.

This problem starts directly after upgrading.


I found the error, it is in "components/com_virtuemart/helpers/cart.php"

In Version 2.0.24 looks like

if(!empty($agreed->required) and empty($agreed->default) and !empty($this->BT)){



In Version 2.0.26a on line 865, it looks like

if(!empty($agreed->required) and $agreed->default!=='' and $validUserDataBT!==-1){


Fix this to:

if(!empty($agreed->required) and $agreed->default=='' and $validUserDataBT!==-1){


The error is in the negotiation of

$agreed->default==''


Could the VM developers please confirm this as a bug and fix it?



Milbo

damn c version, eh?

Please try this

if (empty($this->tosAccepted)) {

$userFieldsModel = VmModel::getModel('Userfields');

$agreed = $userFieldsModel->getUserfield('agreed','name');

if($agreed->default){
$this->tosAccepted = $agreed->default;
}

if(empty($this->tosAccepted) and !empty($agreed->required) and $validUserDataBT!==-1){
$redirectMsg = null;// JText::_('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
$this->tosAccepted = false;
vmInfo('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS','COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
return $this->redirecter('index.php?option=com_virtuemart&view=cart' , $redirectMsg);
}
}
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

shopper999

#4
OK, Thanks Milbo.
This code is better to understand, and it works for me ;-)


Milbo

ahh now I found the quirk in all of this, please try this code

if(!isset($this->tosAccepted)){
$userFieldsModel = VmModel::getModel('Userfields');
$agreed = $userFieldsModel->getUserfield('agreed','name');
$this->tosAccepted = $agreed->default;
}
if (empty($this->tosAccepted)) {

$userFieldsModel = VmModel::getModel('Userfields');
$agreed = $userFieldsModel->getUserfield('agreed','name');

if(empty($this->tosAccepted) and !empty($agreed->required) and $validUserDataBT!==-1){
$redirectMsg = null;// JText::_('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
$this->tosAccepted = false;
vmInfo('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS','COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
return $this->redirecter('index.php?option=com_virtuemart&view=cart' , $redirectMsg);
}
}
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

shopper999

Hey milbo,

thank you. This code also works.

There is only one thing, I'd like to know. This problem seems to happen only in some special cases, which I couldn't figure out so far.
I have another 2.0.26a installation, without this problem.

Could you explain, in which case this error happens?