VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: pkubik on January 09, 2018, 07:05:30 AM

Title: Terms of Service can not be turned off - Required field
Post by: pkubik on January 09, 2018, 07:05:30 AM
Hi,
I have an optional field for TOS, but the order still needs to be checked in the order. Why? I want to send an order without ticking the box. Thanks.

defined('_JEXEC') or die('Restricted access');
$hiddenFields = '';
?>
<?php if(!empty($this->userFieldsCart['fields'])) : ?>
<?php foreach($this->userFieldsCart['fields'] as $field) : ?>
<?php if($field['hidden']) :
$hiddenFields .= $field['formcode'] . "\n";
else : ?>

<?php if($field['name'] == 'customer_note' || $field['type'] == 'textarea') : ?>
<div class="customer-comment-group">
<label for="<?php echo $field['name'?>_field" class="comment"><?php echo $field['title'?></label>
<?php $field['formcode'] = str_replace('rows="1"''rows="3"'$field['formcode']); ?>
<?php echo strpos($field['formcode'], 'class="') ? 
str_replace('class="''class="customer-comment proopc-customer-comment '$field['formcode']) : 
str_replace('<textarea''<textarea class="customer-comment proopc-customer-comment"'$field['formcode']); ?>

</div>
<?php elseif($field['name'] == 'tos') : ?>
<div class="cart-tos-group">
<?php
$this->cart->prepareVendor();
$tos = (is_array($this->cart->BT) && !empty($this->cart->BT['tos'])) ? $this->cart->BT['tos'] : 0;
?>

<?php if(VmConfig::get('oncheckout_show_legal_info'1)) : ?>
<?php if($this->params->get('tos_fancybox'0)) : ?>
<label for="tos" class="checkbox prooopc-tos-label proopc-row">
<?php echo VmHtml::checkbox ($field['name'], $tos10'class="terms-of-service"'); ?>
<div class="terms-of-service-cont">
<a href="#proopc-tos-fancy" class="terms-of-service" data-tos="fancybox"><?php echo vmText::('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED'); ?></a>
</div>
</label>
<div class="soft-hide">
<div id="proopc-tos-fancy" class="fancy-tos-container">
<div class="fancy-tos-head">
<button type="button" class="fancy-close"><span aria-hidden="true">&times;</span></button>
<h3 class="fancy-tos-title"><?php echo vmText::('COM_VIRTUEMART_CART_TOS'); ?></h3>
</div>
<div class="fancy-tos-body">
<p><?php echo $this->cart->vendor->vendor_terms_of_service?></p>
</div>
</div>
</div>
<?php else : ?>
<label for="tos" class="checkbox prooopc-tos-label proopc-row">
<?php echo VmHtml::checkbox ($field['name'], $tos10'class="terms-of-service"'); ?>
<div class="terms-of-service-cont">
<a href="#proopc-tos-fancy" class="terms-of-service" data-toggle="bootmodal"><?php echo JText::('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED'); ?></a>
</div>
</label>
<div class="bootmodal fade" id="proopc-tos-fancy" tabindex="-1" role="dialog" aria-labelledby="tosLabel" aria-hidden="true">
<div class="bootmodal-header">
<button type="button" class="close" data-dismiss="bootmodal" aria-hidden="true">&times;</button>
<h3 id="tosLabel"><?php echo JText::('COM_VIRTUEMART_CART_TOS'); ?></h3>
</div>
<div class="bootmodal-body">
<p><?php echo $this->cart->vendor->vendor_terms_of_service?></p>
</div>
</div>
<?php endif; ?>
<?php else : ?>
<label for="tos" class="checkbox prooopc-tos-label proopc-row">
<?php echo VmHtml::checkbox ($field['name'], $tos10'class="terms-of-service"'); ?> <?php echo $field['title'?>
</label>
<?php endif; ?>
</div>
<?php else : ?>
<fieldset class="vm-fieldset-<?php echo str_replace('_''-'$field['name']) ?>">
<div class="form-group">
<label for="<?php echo $field['name'?>_field"><?php echo $field['title'?></label>
<?php echo $field['formcode'?>
</div>
</fieldset>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>

<?php echo $hiddenFields?>
Title: Re: Terms of Service can not be turned off - Required field
Post by: Jörgen on January 09, 2018, 08:25:17 AM
Hello
http://forum.virtuemart.net/index.php?topic=104795.0 (http://forum.virtuemart.net/index.php?topic=104795.0)

Not much to go on, but You have probably a commercial template, ask Your developer.

regards

Jörgen @ Kreativ Fotografi

Title: Re: Terms of Service can not be turned off - Required field
Post by: jenkinhill on January 09, 2018, 11:02:56 AM
Make sure that both "agreed" and "tos" are set to unrequired in the Shopper Field List.
Title: Re: Terms of Service can not be turned off - Required field
Post by: pkubik on January 09, 2018, 18:48:00 PM
Yes, i have "agreed" and "tos" set to unrequired in the Shopper Field List. If I give a standard shopping cart that's how it works. The problem is likely to be in the code, see above, but I do not know where. :(