VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: anthrobote on December 12, 2011, 21:57:49 PM

Title: Behaviour of agreed and TOS in checkout
Post by: anthrobote on December 12, 2011, 21:57:49 PM
I want to report two errors I encountered during the new order process regarding the agreement of Terms of Service:

Description:
if(!$userFieldsModel->getIfRequired('agreed')){

$this->tosAccepted = JRequest::getInt('tosAccepted', $this->tosAccepted);
if ($this->tosAccepted !== 1) {

VirtueMart Version:
1.9.8M

Joomla/Mambo Version:
1.7.3

Proposed fix(es):
if($userFieldsModel->getIfRequired('agreed')){
$this->tosAccepted = intval(JRequest::getInt('tosAccepted', $this->tosAccepted));

Bugtracker task #:
Not submitted yet.

When both the fixes are applied, it works as I believe it was expected to work.
Title: Re: Bad condition causing Terms of Service checkbox to be ignored
Post by: Milbo on December 13, 2011, 02:15:10 AM
Interesting observation.

I wrote it so (or at least want it that way) that the agreed field works like a predefault, yes. So when "agree on TOS on every order" is unchecked, it works like directly agreeing to the TOS. On the other hand there is an extra field to read for the tos. You dont want to disturb the user while registration or entering data. But the TOS must be checked at the end of the checkout. So both systems work, people are just not forced directly to agree to the tos (there is also no link to the tos yet, so they would have to agree into the blue).
Title: Re: Bug causes the Terms of Service checkbox to be ignored
Post by: anthrobote on December 13, 2011, 22:46:51 PM
Yes it almost works as you say when the fixes I mentioned are applied. But another problem/bug I have just found is that the agreed field is not updated from the form (.../user/tmpl/edit_adress.php (http://dev.virtuemart.net/svn/virtuemart/trunk/virtuemart/components/com_virtuemart/views/user/tmpl/edit_address.php) view) when switched from value 1 to value 0 (i.e. unchecked) - the problem resides in .../models/userfields.php (https://dev.virtuemart.net/svn/virtuemart/trunk/virtuemart/administrator/components/com_virtuemart/models/userfields.php) which doesn't generate corresponding <input type="hidden" value="0"> to send the zero value via POST (hidden input should be added both to predefined checkbox for agreed field and to unknown checkboxes).

And one more bug: When user logs in and wants to change the state of checkbox for agreed field (for example during checkout). The checkbox appears always as unchecked even if the agreed field is set to 1 in the database. In other words, the agreed state is loaded only from the current session not from the database. But I am not sure if it's not some local problem in my modified version as I fiddle with the sources.

There are so many errors that it was a bit hard for me to grasp the whole logic, also I am very new to VirtueMart and its source code, so maybe I am missing something or using it badly :-)
Title: Re: Bug causes the Terms of Service checkbox to be ignored
Post by: anthrobote on December 13, 2011, 23:00:36 PM
I am sorry, the bugs from my first posts are now fixed in the latest beta versions of VirtueMart, but the one from my previous post remains.
Title: Re: Behaviour of agreed and TOS in checkout
Post by: doug4r on January 17, 2012, 22:30:09 PM
My agreed field is locked.  Where do I find the lastest beta versions of VirtueMart 2.0 that fixes this?

Doug
Title: Re: Behaviour of agreed and TOS in checkout
Post by: jenkinhill on January 17, 2012, 23:36:17 PM
In SVN. See http://dev.virtuemart.net/projects/virtuemart/wiki/Setting_up_a_Development_Environment
Title: Re: Behaviour of agreed and TOS in checkout
Post by: Milbo on January 18, 2012, 00:30:49 AM
You can also change the locked fields, just go in the detailed edit view.
Title: Re: Behaviour of agreed and TOS in checkout
Post by: anthrobote on January 20, 2012, 13:20:52 PM
What about the bugs I have mentioned, can you provide some clarification? The simple one concerning the hidden input field in models/userfields.php is still not corrected.

Thanks much.