CRE Loaded Integration Guide

Integration with CRE address forms made simple

A step-by-step guide to integration with CRE Loaded address forms.

Preparation

Download

Download our CRE Loaded plugin from the plugins page. For CRE Loaded, we currently only offer a plugin for Postcode Lookup (UK only). The plugin is free to download.

Visit the download page  

Sign Up

Next, you need to sign up for a Crafty Clicks account.

When you sign up, you will receive an access token by email. There is no obligation to buy anything and you automatically get 30 trial credits. If you need more credits to test the integration, please get in touch (support@craftyclicks.co.uk) and we will try to accommodate you.

Installation

If you have an unmodified, default CRE Loaded CE v6.4 installation, simply extract the archive into your /catalog folder (or whatever you called it).

If you have a modified installation, follow the steps below.

Step 1

Paste your access token in place of xxxxx-xxxxx-xxxxx-xxxxx at the top of the file crafty_html_output.php.

Step 2

Copy the following files, creating directories if missing:

catalog/ext/craftyclicks/crafty_html_output.php

catalog/includes/craftyclicks/crafty_postcode_busy.gif catalog/includes/craftyclicks/crafty_postcode.class.js catalog/includes/craftyclicks/button_find_address.gif

Step 3

In file catalog/address_book_process.php

FIND (around line 274)

require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE);

INSERT BEFORE:

// CraftyClicks start
require('ext/craftyclicks/crafty_html_output.php');
//CraftyClicks end

FIND (around line 274)

require(DIR_WS_INCLUDES . 'application_bottom.php');

INSERT BEFORE:

// CraftyClicks start
echo tep_crafty_country_handler();
// CraftyClicks end

Step 4

In file catalog/checkout_payment_address.php

FIND (around line 223)

require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE);

INSERT BEFORE:

// CraftyClicks start
require('ext/craftyclicks/crafty_html_output.php');
//CraftyClicks end

FIND (around line 225)

require(DIR_WS_INCLUDES . 'application_bottom.php');

INSERT BEFORE:

// CraftyClicks start
echo tep_crafty_country_handler();
// CraftyClicks end

Step 5

In file catalog/checkout_shipping_address.php

FIND (around line 231)

require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE);

INSERT BEFORE:

// CraftyClicks start
require('ext/craftyclicks/crafty_html_output.php');
//CraftyClicks end

FIND (around line 233)

require(DIR_WS_INCLUDES . 'application_bottom.php');

INSERT BEFORE:

// CraftyClicks start
echo tep_crafty_country_handler();
// CraftyClicks end

Step 6

In file catalog/create_account.php

FIND (around line 305)

require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE);

INSERT BEFORE:

// CraftyClicks start
require('ext/craftyclicks/crafty_html_output.php');
//CraftyClicks end

FIND (around line 306)

require(DIR_WS_INCLUDES . 'application_bottom.php');

INSERT BEFORE:

// CraftyClicks start
echo tep_crafty_country_handler();
// CraftyClicks end

Step 7

In file catalog/templates/content/create_account.tpl.php

FIND (around line 4)

echo $cre_RCI->get('createaccount', 'top');
// RCI code eof

INSERT BEFORE:

// CraftyClicks start
echo tep_crafty_script_add('create_account');
// CraftyClicks end

FIND (around line 155)

<td class="main"><?php echo tep_draw_input_field('postcode') . '&nbsp;' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>

INSERT before the last semicolon

. '&nbsp;&nbsp;' . tep_crafty_button()

THE RESULT SHOULD BE

<td class="main"><?php echo tep_draw_input_field('postcode') . '&nbsp;' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''). '&nbsp;&nbsp;' . tep_crafty_button(); ?></td>

FIND (just below around line 156)

</tr>

INSERT AFTER

<tr>
<td class="main">&nbsp;</td>
<td class="main" id="crafty_postcode_result_display">&nbsp;</td>
</tr>

Step 8

In file catalog/includes/javascript/address_book_process.php

FIND (around line 6)

?>

INSERT BEFORE:

// CraftyClicks start
echo tep_crafty_script_add('addressbook');
// CraftyClicks end

Step 9

In file catalog/includes/javascript/checkout_payment_address.js.php

FIND (around line 52)

?>

INSERT BEFORE:

// CraftyClicks start
echo tep_crafty_script_add('checkout_address');
// CraftyClicks end

Step 10

In file catalog/includes/javascript/checkout_shipping_address.js.php

FIND (around line 51)

?>

INSERT BEFORE:

// CraftyClicks start
echo tep_crafty_script_add('checkout_address');
// CraftyClicks end

Step 11

In file catalog/includes/modules/address_book_details.php

FIND (around line 99)

<td class="main"><?php echo tep_draw_input_field('postcode', (isset($entry['entry_postcode']) ? $entry['entry_postcode'] : '')) . '&nbsp;' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>

INSERT before the last semicolon

. '&nbsp;&nbsp;' . tep_crafty_button()

THE RESULT SHOULD BE

<td class="main"><?php echo tep_draw_input_field('postcode', (isset($entry['entry_postcode']) ? $entry['entry_postcode'] : '')) . '&nbsp;' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''). '&nbsp;&nbsp;' . tep_crafty_button(); ?></td>

FIND (just below, around line 100)

</tr>

INSERT AFTER

<tr>
<td class="main">&nbsp;</td>
<td class="main" id="crafty_postcode_result_display">&nbsp;</td>
</tr>

Step 12

In file catalog/includes/modules/checkout_new_address.php

FIND (around line 79)

<td class="main"><?php echo tep_draw_input_field('postcode') . '&nbsp;' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>

INSERT before the last semicolon

. '&nbsp;&nbsp;' . tep_crafty_button()

THE RESULT SHOULD BE

<td class="main"><?php echo tep_draw_input_field('postcode') . '&nbsp;' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''). '&nbsp;&nbsp;' . tep_crafty_button(); ?></td>

FIND (just below, around line 80)

</tr>

INSERT AFTER

<tr>
<td class="main">&nbsp;</td>
<td class="main" id="crafty_postcode_result_display">&nbsp;</td>
</tr>

Step 13

In file catalog/includes/modules/Order_Info_Check.php

FIND (around line 20)

<?php

INSERT AFTER

// CraftyClicks start
require('ext/craftyclicks/crafty_html_output.php');
echo tep_crafty_script_add('account_edit');
// CraftyClicks end

FIND (around line 306)

echo tep_draw_input_field('postcode') . '&nbsp;' . ENTRY_POST_CODE_ERROR;

INSERT before the last semicolon

. '&nbsp;&nbsp;' . tep_crafty_button()

THE RESULT SHOULD BE

echo tep_draw_input_field('postcode') . '&nbsp;' . ENTRY_POST_CODE_ERROR . '&nbsp;&nbsp;' . tep_crafty_button();

FIND (around line 311)

echo tep_draw_input_field('postcode', (isset($account['entry_postcode']) ? $account['entry_postcode'] : '')) . '&nbsp;' . ENTRY_POST_CODE_TEXT;

INSERT before the last semicolon

. '&nbsp;&nbsp;' . tep_crafty_button()

THE RESULT SHOULD BE

echo tep_draw_input_field('postcode', (isset($account['entry_postcode']) ? $account['entry_postcode'] : '')) . '&nbsp;' . ENTRY_POST_CODE_TEXT . '&nbsp;&nbsp;' . tep_crafty_button();

FIND (just below, around line 314)

</tr>

INSERT AFTER

<tr>
<td class="main">&nbsp;</td>
<td class="main" id="crafty_postcode_result_display">&nbsp;</td>
</tr>

AT THE BOTTOM OF THE FILE ADD:

<?php
// CraftyClicks start
echo tep_crafty_country_handler();
// CraftyClicks end
?>

Configuration (optional)

Play around with configuration options near the top of the file catalog/ext/craftyclicks/crafty_html_output.php.

On line 4: set CP_ADDRESS_LOOKUP_BUTTON_STYLE = 1 for a graphical button, or = 0 for a plain browser generated button. Or modify the html in the function tep_crafty_button_add() to make up your own flavour.

To leave county out, simply remove the field in your html. If you want to keep the field, but want to prevent CraftyPostcode from populating it, go to line 9 and change the define CP_COUNTY_NAME to 2.

If you prefer to use county names we provide two options: Traditional County Name and Postal County Name. To get the traditional county name set CP_COUNTY_NAME to 1. To go for the Royal Mail postal county name set it to 0 (default).

FAQ

Test

Before you go live, test the integration to make sure it is working properly.

For the Postcode Lookup integration only, we have the following free postcodes for testing: AA1 1AA, AA1 1AB, AA1 1AD and AA1 1AE.

If you need assistance, drop us an email on support@craftyclicks.co.uk – we will help!

Go Live

Once your trial credits run out, you will need to decide on the best purchasing option based on the volume of usage you expect on your site. If you would like us to advise you then please get in touch.

FAQ

  • Do you offer support? Yes, we do offer support during normal business hours in the UK. If you run into any issues, let us know and we will be happy to help.
  • Is this free? The extension is free to download and try, but to use it on a live site you will need a paid account with us.
  • Do I need to sign up for an account to try it? Yes, you’ll need a trial account, at least. You can easily sign up for a free trial account.
Last Updated: 9/11/2018, 1:32:56 PM