VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Development & Testing => Topic started by: lipes on April 08, 2013, 21:08:06 PM

Title: Problem in Cart User Terms - Off mode doesnt work
Post by: lipes on April 08, 2013, 21:08:06 PM
I did a test because some clients are telling me that cant do a order.

Well.. i've removed from the Admin config but the TOS check box in fact stays in the front end near to the Finalize button!

I tested to do an order and click to Finalize/Finnish button and i get an Joomla Alert to do "Agree with the TOS" and then Finnish/Finalize that order! But this is strange because in the Admin area all options are not checked to got TOS active! They are Off...
Title: Re: Problem in Cart User Terms - Off mode doesnt work
Post by: PRO on April 08, 2013, 22:55:28 PM
views/user/edit_address.php


down in the form (under this <input type="hidden" name="layout" value="<?php echo $this->getLayout(); ?>" />)

add this
<?php if (JRequest::getVar('addrtype')=='BT')   { echo '<input type="hidden" name="agreed" value="1" />';}?>

then you just override it
Title: Re: Problem in Cart User Terms - Off mode doesnt work
Post by: Stonedfury on April 22, 2013, 19:27:36 PM
I am having the problem with TOS on the cart page. Not the address page.
My page has this <?php if (!class_exists ('VirtueMartModelUserfields')) {
require(JPATH_VM_ADMINISTRATOR DS 'models' DS 'userfields.php');
}
$userFieldsModel VmModel::getModel ('userfields');
if ($userFieldsModel->getIfRequired ('agreed')) { ?>

<label for="tosAccepted" class="checkbox inline">
<?php if (!class_exists ('VmHtml')) {
require(JPATH_VM_ADMINISTRATOR DS 'helpers' DS 'html.php');
}
echo VmHtml::checkbox ('tosAccepted'$this->cart->tosAccepted10'class="terms-of-service"');
if (VmConfig::get ('oncheckout_show_legal_info'1)) { ?>

<a href="#full-tos" class="terms-of-service" data-toggle="modal">
<?php echo JText::('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED'); ?>
</a>
<div class="boot-modal fade" id="full-tos" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><?php echo JText::('COM_VIRTUEMART_CART_TOS'); ?></h3>
</div>
<div class="modal-body">
<p><?php echo $this->cart->vendor->vendor_terms_of_service?></p>
</div>
</div>
<?php ?>
</label>
<?php ?>

If I remove the code for TOS it still ask for it. I unpublish in back end and removed the button still gave an issue.

I opened up my override file edit_address.php and in this block added the link you said above <input type="hidden" name="layout" value="<?php echo $this->getLayout(); ?>" />
<?php if (JRequest::getVar('addrtype')=='BT')   { echo '<input type="hidden" name="agreed" value="1" />';}?>
<input type="hidden" name="address_type" value="<?php echo $this->address_type?>" />

Where would I put that in my default page for cart?
Title: Re: Problem in Cart User Terms - Off mode doesnt work
Post by: PRO on April 22, 2013, 21:19:12 PM
Quote from: Stonedfury on April 22, 2013, 19:27:36 PM
I am having the problem with TOS on the cart page. Not the address page.
My page has this <?php if (!class_exists ('VirtueMartModelUserfields')) {
require(JPATH_VM_ADMINISTRATOR DS 'models' DS 'userfields.php');
}
$userFieldsModel VmModel::getModel ('userfields');
if ($userFieldsModel->getIfRequired ('agreed')) { ?>

<label for="tosAccepted" class="checkbox inline">
<?php if (!class_exists ('VmHtml')) {
require(JPATH_VM_ADMINISTRATOR DS 'helpers' DS 'html.php');
}
echo VmHtml::checkbox ('tosAccepted'$this->cart->tosAccepted10'class="terms-of-service"');
if (VmConfig::get ('oncheckout_show_legal_info'1)) { ?>

<a href="#full-tos" class="terms-of-service" data-toggle="modal">
<?php echo JText::('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED'); ?>
</a>
<div class="boot-modal fade" id="full-tos" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><?php echo JText::('COM_VIRTUEMART_CART_TOS'); ?></h3>
</div>
<div class="modal-body">
<p><?php echo $this->cart->vendor->vendor_terms_of_service?></p>
</div>
</div>
<?php ?>
</label>
<?php ?>

If I remove the code for TOS it still ask for it. I unpublish in back end and removed the button still gave an issue.

I opened up my override file edit_address.php and in this block added the link you said above <input type="hidden" name="layout" value="<?php echo $this->getLayout(); ?>" />
<?php if (JRequest::getVar('addrtype')=='BT')   { echo '<input type="hidden" name="agreed" value="1" />';}?>
<input type="hidden" name="address_type" value="<?php echo $this->address_type?>" />

Where would I put that in my default page for cart?


you dont put it in the cart.

the urser has to fill in billing address.

THEN, all that information is stored
Title: Re: Problem in Cart User Terms - Off mode doesnt work
Post by: Stonedfury on April 23, 2013, 18:31:35 PM
That code is already in the cart. I didnt put it there. I want to do away with the TOS all together. I know the user has to fill out the billing information. I unpublish TOS and still shows and request it. I remove the code that is there and still get error and ask for TOS agree. So far every method I have tried has still for some strange reason given the TOS flag. I use your button code and it works if you are registered and login ( I am NOT saying your code is flawed) If the user does guest the button wont show as there is no tos showing on address but only on cart. I think I should stop talking as I do not feel I am getting what is going on spit out in a discernible manor. You'd have to see for yourself.
Title: Re: Problem in Cart User Terms - Off mode doesnt work
Post by: Stonedfury on April 23, 2013, 18:52:38 PM
Fingered it out. I just opened up my database and turned all the TOS settings to 0 so it doesnt show or request or be required. Now it works as I want. Such a simple solution really. Then I opened up my default.php page and removed the TOS code so it no longer shows.
Title: Re: Problem in Cart User Terms - Off mode doesnt work
Post by: PRO on April 23, 2013, 21:37:06 PM
Quote from: Stonedfury on April 23, 2013, 18:52:38 PM
Fingered it out. I just opened up my database and turned all the TOS settings to 0 so it doesnt show or request or be required. Now it works as I want. Such a simple solution really. Then I opened up my default.php page and removed the TOS code so it no longer shows.

when up update its going to change it back maybe
Title: Re: Problem in Cart User Terms - Off mode doesnt work
Post by: Stonedfury on April 24, 2013, 00:04:31 AM
Hope not, but I will have to watch it. For now it works flawlessly. I have even used some of your code for other things now. I just keep thinking that I could use if statements instead of repeating the code for hide and show.
Title: Re: Problem in Cart User Terms - Off mode doesnt work
Post by: DaveOzric on May 23, 2013, 19:44:01 PM
Just out of curiosity, why is there even a setting to NOT show it if it still shows it anyway? Is there no way to turn it off without workarounds and hacking code?

Thanks
Title: Re: Problem in Cart User Terms - Off mode doesnt work
Post by: Amema on March 26, 2014, 23:14:46 PM
Sadly this bug still remains in VM2.0.26

I have exactly the same problem and several customers claim they cannot order, even though everything looks good - apart from this bug that we inform about - from the admin's perspective (both PC and mac checked with different browsers).

I have stumbled around in the database but can't find any TOS lines to delete.
Title: Re: Problem in Cart User Terms - Off mode doesnt work
Post by: Milbo on March 29, 2014, 10:17:13 AM
This is not a bug guys. It just prevents you todo things which you should not do.

The TOS of vm and AGREED of joomla is atm almost the same. If you want to register to a store it is a legal requirement in most countries that you have to click the "agreed". We use the joomla user registration and therefore the "agreed" is mandatory. If someone fills the "agreed" for the registration, the TOS is automatically checked. So you should think twice if you just want to remove it.

So, but how to solve your problem if you insist to remove it. There are various methods.  The solution of stonedfury is the worst.

First idea: Just set the default = 1. Done! The only disadvantage is that your users still can see it, but you can set it to hidden and that it is not displayed. Imho thats it.

In vm3 there are two userfields, one for the registration "agreed" which is mapped to the joomla agreed and a real TOS field, which is only for the TOS. We have there also a new type of shopperfields which can be set to the cart itself. But as long you are not using vm3, just set the default=1, set it to hidden.

If this does not work, for whatever reason. Then just remove it from the layout and add a hidden field with value =1 and name tos.