X-Cart:Canada Post

From X-Cart 4 Classic
Jump to: navigation, search

Setting up Canada Post real-time shipping calculator

To set up shipping cost calculation through Canada Post real-time shipping calculator:

1. If you haven't yet done so, provide your company address in the 'General settings->Company options' section. Make sure you provide this address correctly - it will be submitted to the real-time shipping calculator as the origin address for all shipments from your store and thus will affect the shipping rates.

2. Obtain an account with Canada Post (Sign up at http://www.canadapost.ca/).

3. In your store's Admin area, go to the 'General settings->Shipping options' page and enable Canada Post:

  • Select the check box Enable real-time shipping calculation.
  • Make sure the check box Use InterShipper calculation service is not selected.
  • In the CanadaPost API Key subsection, provide the following information:
X-Cart v4.6 and later:
  • The below API Key is for: Select Development or Production based on whether you will be using Canada Post in Development or Production mode. Depending on your selection, you will be supposed to enter the respective type of API key in the fields below.
  • CanadaPost username and CanadaPost password: Enter the API key you obtained from Canada Post. To learn about API keys, click here.
Earlier X-Cart versions:
  • CanadaPost merchant ID: Enter the merchant ID you obtained from Canada Post.

4. Adjust Canada Post options:

a. Go to the 'Shipping methods' page of your store's Admin area (Shipping and Taxes menu->Shipping methods).
Shipping methods.png
b. X-Cart versions 4.6.1 and later: In the 'Real-time calculated shipping methods' section, click the button Add/remove real-time shipping methods:
Add remove ship methods.png
The 'Add/remove real-time shipping methods' page opens:
Add remove ship meth page.png
On this page, click the [+] Canada Post link to expand the list of available Canada Post shipping methods:
Canada Post methods1.png
Enable the methods you are going to use (Select the respective check boxes and click Apply changes).
After this you will be redirected back to the 'Shipping methods' page where you will see the [+] Canada Post item added to the 'Real-time calculated shipping methods' section:
Canada Post opts link.png
X-Cart versions 4.6.0 and earlier: In the 'Real-time calculated shipping methods' section, click the [+] Canada Post link:
Shipping meth.png
The list of available Canada Post methods will be expanded:
Canada Post methods.png
Disable the methods you are not going to use (Unselect the respective check boxes in the 'Active' column). Click the [-] Canada Post link; the list of Canada Post methods will be collapsed.
c. Click the Options >> link opposite the [+] Canada Post item. The 'Canada Post options' page opens.
d. Adjust the settings on the 'Canada Post options' page.
e. Click the Apply button.

That is all. Now you can test whether your store can receive real-time shipping rates correctly. For details, see X-Cart:Testing Your Store's Ability to Receive Real-time Shipping Rates page.


Notes on Canada Post options for X-Cart 4.6.1 and later:

CanadaPost opts461.png
  • Your Canada Post commercial customer number: Your Canada Post commercial customer number. This value is required.
  • Your contract number (This must be provided for commercial (contracted) rates, if exists. Leave empty for non-contract rates): Your contract number.
  • Quote type: Choose "commercial" to get contracted rates (as contracted between you and Canada Post). Choose "counter" to get rates you'd get over the counter (without a customer or contract number).

Notes on Canada Post options for X-Cart 4.6:

CanadaPost opts.png
  • The customer number of the owner of the mail (mailed on behalf of customer). (up to 10 digits)(required): Your Canada Post commercial customer number. This value is required. Important: The customer number must be entered without the leading zeros. For example, if the Customer Number in your Canada Post account says "0001234567", you must enter just "1234567".
  • Omit the element for non-contract rates or provide the contract number for commercial (contracted) rates. (up to 10 digits)(optional): Your contract number. This must be provided for commercial (contracted) rates, if exists. Leave empty for non-contract rates.
  • Either commercial or counter. (quote-type): Choose "commercial" to get contracted rates (as contracted between you and Canada Post). Choose "counter" to get rates you'd get over the counter (without a customer or contract number).

Shipping in multiple packages

X-Cart now provides a packaging algorithm that allows splitting an entire purchase into multiple packages that fit certain limitations (maximum package weight and dimensions). This algorithm allows to get real-time shipping rates even when the cart contains a large quantity of products with the total weight and dimensions exceeding the values allowed for a single package.

With the Dimensional Shipping feature, you can specify dimensions for each product you have got at your store (See the Product details page) and use those dimensions for calculating shipping rates using the on-line shipping rate calculation service.

For more information, please refer to Setting Up Dimensional Shipping.

Note: When using the Ship in a separate box option for products, make sure that the Split the shipment into multiple packages if its weight/dimensions exceed the limitations option is enabled.

Troubleshooting

Problem:

When testing real-time shipping rates calculation, I am getting the following error from Canada Post:

X-Cart HTTPS: libcurl error(7): couldn't connect to host

Solution:

To get the Canada Post rates, X-Cart sends requests from your server to sellonline.canadapost.ca (Canada Post's server) via port 30000. If outgoing connections via port 30000 are not allowed on your server, it will cause the error in question.

To fix this issue contact your hosting support or the server admins, and ask them to allow outgoing connections via port 30000.

Script to test connection to Canada Post's server via port 30000

  1. Download the File:Test connection to canadapost.php.txt, save the downloaded file as 'test_connection_to_canadapost.php'.
  2. Upload test_connection_to_canadapost.php to your web server's document root.
  3. Use the following URL to test:
http://yourwebsite.com/test_connection_to_canadapost.php

See also: