Jump to content

T&C's not showing


keat
 Share

Recommended Posts

On 5/17/2018 at 3:52 PM, bsmither said:

As seen in the code shown in the second post, {if $TERMS_CONDITIONS} being true-like, the HTML for the checkbox will get included in the page.

Have your browser show you the page's HTML source. You should be able to find the checkbox.

As I'm logged in as a user at the time, is something maybe halting the triggering of this ?

Link to comment
Share on other sites

We have established that $TERMS_CONDITIONS is true-like. It has a value.

Examining the Mican template content.checkout.confirm.php, we see that it is basically in two sections:  {$IS_USER} and {else}.

If a user is logged in, CubeCart assumes the T&C's were read when registering. But you want to assert the requirement regardless of this.

So, we need to add the HTML to show the checkbox when the user is logged in.

It might be tricky to place it exactly, but try:

Near line 27, find:

{else}

On a new blank line ABOVE that, add:

		{if $TERMS_CONDITIONS}
		<div><label for="reg_terms">&nbsp;</label><span><input type="checkbox" id="reg_terms" name="terms_agree" value="1" {$TERMS_CONDITIONS_CHECKED} /> <a href="{$TERMS_CONDITIONS}" target="_blank">{$LANG.account.register_terms_agree}</a></span></div>
		{/if}

 

Link to comment
Share on other sites

With the code added to cubecart.class and the new code above added to content.confirm.php, the check box appears, the hyperlink also takes me to the correct page.

However, I can still progress to checkout without completing the checkbox.

Link to comment
Share on other sites

Try:

ABOVE the code that was added to cubecart.class.php, on a new blank line, add:

if (!$GLOBALS['config']->get('config', 'disable_checkout_terms') && ($GLOBALS['db']->select('CubeCart_documents', false, array('doc_terms' => '1')) !== false) && !isset($_POST['terms_agree'])) {
	$GLOBALS['gui']->setError($GLOBALS['language']->account['error_terms_agree']);
	$errors['terms_agree'] = true;
}

 

Link to comment
Share on other sites

It works.

 

For clarity to save scrolling through the trial and error:

In classes\cubecart.class

find:   foreach ($GLOBALS['hooks']->load('class.cubecart.construct.confirm') as $hook) include $hook;

below this add:

// t&c
        
        if (!$GLOBALS['config']->get('config', 'disable_checkout_terms') && ($GLOBALS['db']->select('CubeCart_documents', false, array('doc_terms' => '0')) !== false) && !isset($_POST['terms_agree'])) {
    $GLOBALS['gui']->setError($GLOBALS['language']->account['error_terms_agree']);
    $errors['terms_agree'] = true;
}
        
        $GLOBALS['smarty']->assign('TERMS_CONDITIONS', (!$GLOBALS['config']->get('config', 'disable_checkout_terms') && (($terms = $GLOBALS['db']->select('CubeCart_documents', false, array('doc_terms' => '1'))) !== false))
 ? $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"' : '' );
        

// end t&c

 

 

Using the mican skin, in templates/content.checkout.confirm.php

Find:

<option value="{$address.address_id}" {$address.selected}>{$address.description} - {$address.first_name} {$address.last_name}, {$address.line1}, {$address.postcode}</option>
        {/foreach}
      </select>
    </p>
    {/if}

 

below this add:

 

{if $TERMS_CONDITIONS}
        <div><label for="reg_terms">&nbsp;</label><span><input type="checkbox" id="reg_terms" name="terms_agree" value="1" {$TERMS_CONDITIONS_CHECKED} /> <a href="{$TERMS_CONDITIONS}" target="_blank">{$LANG.account.register_terms_agree}</a></span></div>
        {/if}

Edited by keat
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.

 Share

×
×
  • Create New...