VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Blackwabbit on November 15, 2013, 18:47:23 PM

Title: [SOLVED] TOS bugs on checkout
Post by: Blackwabbit on November 15, 2013, 18:47:23 PM
Hello.
I've got a deep problem with TOS on checkout.
TOS line and checkbox should appear and get checked in to proceed payout. However, it doesn't appear at all, while the shop is configured to ask customers to agree TOS.
Screenshot :
(http://louisetfils.fr/images/virtuemart-tos-admin.jpg)

I had an override in my template, so i disabled it. but the problem remains.
(http://louisetfils.fr/images/virtuemart-tos-admin2.jpg)

I found a bunch of articles about some similar problems, but never about that case exactly, and all of them are pretty old or talk about obsolete bits of code.

I decided to look at components/com_virtuemart/views/cart/default.php and try to get what was going wrong.
I finally realised that TOS line doesn't appear because of that if condition, line 152 :
if ($userFieldsModel->getIfRequired ('agreed')) {

If i disable it (as its closing bracet a few lines further of course), tada, all my TOS stuff reappears. TOS label (including the popup link to vm tos), and TOS checkbox.

BUT ...
Checking it or unchecking the box it has no consequence ... Customers can finish their order without checking/clicking the box... Which is pretty much the inverse of what it's supposed to do  :-\


I'm totally lost, i plundered the whole web and found nothing. And now, i'm beggin for help, or direction, on your forum !
Thank you  ;D

And sorry for my rusty english.

Title: Re: TOS bugs on checkout
Post by: GJC Web Design on November 15, 2013, 21:06:26 PM
but if  if ($userFieldsModel->getIfRequired ('agreed')) { isn't true

(this comes from function getIfRequired($fieldname) file administrator/components/com_virtuemart/models/userfields.php line 1074 )

then it isn't set as "required" in the #__virtuemart_userfields table...

what does the VM admin shopper fields say?

Title: Re: TOS bugs on checkout
Post by: Blackwabbit on November 15, 2013, 22:09:12 PM
Hello GJC, and thank you for your answer.

If i understand, this condition means that __virtuemart_userfields table should indicate "required".
Stop me if i'm wrong, but this :
(http://louisetfils.fr/images/virtuemart-tos-admin.jpg)
is the way to get this field as "required", isn't it?

the two lines within the red circle are the options to force any user to checks and agree tos before checking out any order.

The first line litteraly means : "Should user accept tos for every order", while second one means "display tos on order confirm page".

The last checked line is about forcing the client to create a user account while checkout.

does that answer your question? I must admit i'm still lost in this case :s
Title: Re: TOS bugs on checkout
Post by: GJC Web Design on November 15, 2013, 23:39:40 PM
Yes - but those settings are VM settings in virtuemart.cfg - I doubt highly they are changing the database setting for

table: #__virtuemart_userfields ; field: required; where name = agreed

have you checked that table and is required set to 1?

It is set afaik in VM config->configuration->shopper fields but it is normally locked.
If your ($userFieldsModel->getIfRequired ('agreed')) { ->  isn't true then the required can't be 1
if not just set it in the database directly

Title: Re: TOS bugs on checkout
Post by: Blackwabbit on November 16, 2013, 09:17:21 AM
Thank you GJC Web Design :)
that's exactly the info i was looking for, and that exactly fixed my problem.

For som reason, the COM_VIRTUEMART_I_AGREE_TO_TOS table field, named agreed, was assigned to 0 in the required column.
If i get that right, the checkbox in virtuemart config is supposed to act on this table field, passing it to 0 or 1. For some reason, my virtuemart doesn't.

However, thank you for your time and effort.
Problem vapored  8)
Title: Re: [SOLVED] TOS bugs on checkout
Post by: GJC Web Design on November 16, 2013, 11:49:06 AM
And I thank you for your thank you!!!! :)

very rare sadly..  :(
Title: Re: [SOLVED] TOS bugs on checkout
Post by: Blackwabbit on November 16, 2013, 17:59:36 PM
Well, i've benn well-educated ;)
(http://www.picturapoesis.com/documents/img/be-nice.jpg)