Print

Installing Postcode Anywhere Capture+ for Addresses in OpenCart

First, in order for appropriate "State / Province" or zone population by Postcode Anywhere (PCA) you will need to change that field to an input type field. PostCode Anywhere will not populate the select menu correctly. So in each address file you will need to replace the select like so:


OpenCart's default template has one feature that is advantageous at times and poses problems other times. This feature is that the address field names are always the same regardless of form:

address_1
address_2
postcode
county
country
zone_id

If you are using Postcode Anywhere with OpenCart's default accordion checkout then you may run into problems on attempted installation for this reason.

First, go to the /catalog/view/theme/default/template/checkout/shipping_address.tpl.php file and find all instances of name=" for the address fields and replace with name="ship_

Then go the corresponding controller file here:

/catalog/controller/checkout/shipping_address.php

Replace all instances of those fields that are passed with their new names. So if you see $this->request->post['address_1']

Replace with $this->request->post['ship_address_1']

This will allow postcode anywhere to differentiate between the two addresses.

You will need to create two postcode anywhere profiles. One for standard named addresses and one for those prepended with ship_

So we took the code for ours named Profile 1 and pasted it into the file:

/catalog/view/theme/default/template/checkout/payment_address.tpl.php

justed inside the payment-new id div

and the code for ours named Profile 1 Shipping and pasted it into file:

/catalog/view/theme/default/template/checkout/shipping_address.tpl.php

just inside the shipping-new id div.

Important: Prior to initiation Postcode Anywhere's on page setup you will need to comment out the echo'd display none functionality so PCA can see the fields on accordion transition. After setup you can uncomment that functionality as the fields will be locked in.

 


Do this for both payment-new and shipping new divs.

Next, go to the PostCode Anywhere profile and activate "On Page Setup" for the profile. If you have previously told PCA that the fields were correct then you will need to refresh the page and enable "On Page Setup".

Then refresh the checkout page. On accordion transition to Billing Address you will need to enter the code for your standard profile. On accordion transition to the shipping address enter the code for your shipping profile.

The system should recognize all fields except for the zone id which will have to be manually entered.

Now your Postcode Anywhere installation should work correctly.

Here are the other files for which you must only add the default profie PCA css and javascript in addition to replacement of the select menu with a text box:
/catalog/view/theme/default/template/account/address.tpl.php
/catalog/view/theme/default/template/checkout/guest_shipping.tpl.php
/catalog/view/theme/default/template/checkout/register.tpl.php


Certain accomodations must be taken for appropriate shipping rate quoting in relationship to PCA. One of the major one's we found is that the UPS requires a State/Province designation of Greater London when shipping to London. There for anywhere where $this->request->post['city'] is handled we added this code:
//$zone_id = $this->model_localisation_zone->getZoneId($this->request->post['zone_id']); if (strtolower(trim($this->request->post['city']))=='london') $this->request->post['zone_id'] = 3553;
  • 0 Users Found This Useful
Was this answer helpful?