Jump to content

Agree to TOS on every order


xpert

Recommended Posts

We noticed, Agree to TOS is available to only new users when they place first order or guest checkouts (see attachment)

we need this option must be checked for any orders (Like old users login and placing order)

is there a setting or shortcut to do this without custom code?

 

ATT03743.png

Link to comment
Share on other sites

There is no setting to force a T&C Agree checkbox for logged in customers.

However, we can get one to display and make it work for every order at checkout regardless of the customer being logged in or the customer being a 'ghost' customer (which has the T&C Agree anyway). Be aware that there will need to be an edit to the skin.

In admin, Manage Hooks, Code Snippets tab, click Add Snippet. Make these settings:

Enabled: checked
Unique ID: always_t&c
Execution Order: 1
Description: Always Show T&C Agree Checkbox at Checkout
Trigger: class.cubecart.construct.confirm
Version: 1.0
Author: https://forums.cubecart.com/topic/49842-agree-to-tos-on-every-order/
PHP Code:
<?php
$GLOBALS['smarty']->assign('TERMS_CONDITIONS', (!$GLOBALS['config']->get('config', 'disable_checkout_terms') && $terms = $GLOBALS['db']->select('CubeCart_documents', false, array('doc_terms' => '1'))) ? $GLOBALS['seo']->buildURL('doc', $terms[0]['doc_id'], '&') : false);
if (isset($_POST['terms_agree']) && $_POST['terms_agree']==1) {
  $this->_basket['terms_agree'] = true;
}
$GLOBALS['smarty']->assign('TERMS_CONDITIONS_CHECKED', (isset($this->_basket['terms_agree']) && $this->_basket['terms_agree']) ? 'checked="checked"' : '');
?>

Save.

In the skin template file content.checkout.confirm.php:

Near the end of the file, find:
<label for="delivery_comments" class="return"><strong>{$LANG.basket.your_comments}</strong></label>
<textarea name="comments" id="delivery_comments">{$VAL_CUSTOMER_COMMENTS}</textarea>

Above that, add:
{if $IS_USER && $TERMS_CONDITIONS}
   <div class="row">
      <div class="small-12 large-8 columns"><span id="error_terms_agree"><input type="checkbox" id="reg_terms" name="terms_agree" value="1" {$TERMS_CONDITIONS_CHECKED} rel="error_terms_agree"><label for="reg_terms">{$LANG.account.register_terms_agree_link|replace:'%s':{$TERMS_CONDITIONS}}</label></span></div>
   </div>
{/if}

In admin, Maintenance, Rebuild tab, check Clear cache and Submit. This makes sure CubeCart uses a fresh copy of the edited template.

Log in as a customer and proceed to checkout. Test the T&C Agree checkbox.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...