Jump to content

T&C's not showing


keat
 Share

Recommended Posts

Under 'Store Settings' - 'Layout', I have 'disable show T&C's on checkout' unchecked.

I have a document checked as T&C's, however, I don't see any T&C's on checkout.

I'm using the Mican skin.

Any pointers.

 

edit: I also tried on a Foundation skin and connot see anything there either.

Edited by keat
Link to comment
Share on other sites

I found that if I register as a new customer, then T&C's box appears.

If I log in, the T&C's doesn't show.

 

I want the T&C's checkbox to appear with each order confirmation.

I found the following line in content.checkout.confirm.php

 

{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}

 

are there any changes I can make so have the T&C's box appear with each order confirmation.

Link to comment
Share on other sites

Please try this. In admin, Manage Hooks, Code Snippets tab, click Add Snippet.

Enabled: checked
Unique ID: always_t&[email protected]+
Execution Order: 1
Description: Always show T&C Checkbox at Checkout Confirmation
Trigger: class.cubecart.construct.confirm
Version: 1.0
Author: https://forums.cubecart.com/topic/53903-tcs-not-showing/
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"' : '');

I did this a while ago, but I can't find the forum post that prompted me to write it.

Link to comment
Share on other sites

Could there be something missing from the php code ?

If I add the code as it is, then code sort of becomes corrupted, the code area fills with alpha numerical data.

Thinking it may be missing an end statement, I added  } ?> to the end, and this then causes a white screen.

 

Tried this on another site, and again, the data becomes corrupted when I make the save.

Edited by keat
Link to comment
Share on other sites

If what you see is a hash of letters and numbers, then the code is getting converted to Base64, but not getting converted back to plain text when getting loaded into the editor.

This leads me to believe that there is a mismatch in the code that runs this editor.

Remind us the exact version of CubeCart you are running.

Link to comment
Share on other sites

Hmm.

Using a database management utility, such as phpMyAdmin, look at the CubeCart_code_snippet table. Does the code column have contents that are a mix of hash and real PHP code? The hash would start with: PD9waH

 

Edited by bsmither
Link to comment
Share on other sites

I found this thread.

If I add:

{if $TERMS_CONDITIONS}
   <div class="right"><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>
{/if}

 

to content.checkout.php, nothing appears.

I remove the two 'If statements, and now the box appears.

However, I can proceed without checking the box and when I click on the hyperlink for T&C's it loops me back to the confirm page.

www.latexglovesonline.co.uk

Edited by keat
Link to comment
Share on other sites

Guys

 

I could really do with this to comply with GDPR, so if anyone could shed any light how I would enforce T&C's with each order, i'd very much appreciate any help.

At least until i can consider any CC software updates.

 

Adding

 

<div class="right"><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>

 

to contecnt.checkout.php half does the job,.

I just could do with some help making the checkbox enforceable and a link to my T&C's pages working.

If this means encoding the actual URL it will suffice.

Link to comment
Share on other sites

Please review:
https://github.com/cubecart/v6/commit/61b7720ee08d020e531de6464d23b32757f83113

Verify if the statements in your installation match these changes (which were implemented in CC614).

With respect to:

{if $TERMS_CONDITIONS}
   <div class="right"><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>
{/if}

Try:

{if true || $TERMS_CONDITIONS}
   <div class="right"><span id="error_terms_agree"><input type="checkbox" id="reg_terms" name="terms_agree" value="1" rel="error_terms_agree"><label for="reg_terms">{$LANG.account.register_terms_agree_link|replace:'%s':"{$STORE_URL}/friendly_path_to_t&c_doc.html"}</label></span></div>
{/if}

 

Link to comment
Share on other sites

Actually, let's try adding the PHP code directly where the hook is. So, in /classes/cubecart.class.php:

Find:

private function _checkout()

About 15 lines later, find:

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

On a new blank line after that, add:

$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"' : '' );

 

Edited by bsmither
Link to comment
Share on other sites

I tried adding the lines to cubecart.class.php, but the page seems to hang with just a white screen.

No errors are produced in error.log.

 

I then went up to the suggestion above that comment and added:

{if true || $TERMS_CONDITIONS}
   <div class="right"><span id="error_terms_agree"><input type="checkbox" id="reg_terms" name="terms_agree" value="1" rel="error_terms_agree"><label for="reg_terms">{$LANG.account.register_terms_agree_link|replace:'%s':"{$STORE_URL}/friendly_path_to_t&c_doc.html"}</label></span></div>
{/if}

to content.checkout.php.

I can now get the link to open T&C's, but can still proceed to checkout without having to check the agree button.

Edited by keat
Link to comment
Share on other sites

Let's try creating the error_log.

But you say you already have an error_log. Anything new in it?

You will also get a blank screen if there is a problem with Smarty code in the template. Finding those errors can be rough. They sometimes show up in the admin, System Error Logs.

Edited by bsmither
Link to comment
Share on other sites

error log inside the cart shows

 

[Exception] /home/xxxxxxx/public_html/classes/cubecart.class.php:910 - syntax error, unexpected ';', expecting ',' or ')'

 

If I modify the end of the last line to             : '');

I get this.

 

[Exception] /home/xxxxxxxx/public_html/classes/cubecart.class.php:906 - Call to a member function assign() on string

 

Although i don't understand PHP so it would be no surprise that i did wrong.

Edited by keat
Link to comment
Share on other sites

Working on the assumption the version of PHP you are running, I've adjusted the code just a bit. Try:

$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"' : '' );

 

Link to comment
Share on other sites

Open the skin template main.php for editing. At the every end, add {debug}.

Visit the page where you expect the T&C checkbox to be.

The browser will want to toss up a popup window. Let it. (You may need to refresh the page.)

You can now remove the {debug} from the template.

In the popup, in the left pane, scroll to $TERMS_CONDITIONS. Verify there is a web address as its value.

Link to comment
Share on other sites

$TERMS_CONDITIONS

Origin: "Smarty object"

Value

"https://www.xxxxxxxx.co.uk/terms-conditions.html"
 

$TERMS_CONDITIONS_CHECKED

Origin: "Smarty object"

Value

""

Do I need to add anything to content.checkout.php to make it appear.

All I have at the moment is the edit to cubecart.class

Edited by keat
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

I'm confused.

In content.checkout.confirm.php I see:

{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}

 

But when I view the page source I see no reference to terms other than the site links which appear at the bottom of the page.

I don't see the checkbox anywhere.

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...