Module that interfaces with Canada Post's "SellOnline" service (http://sellonline.canadapost.ca).
I believe the majority of it is working at this point, but I have not extensively tested it so I'm listing it as alpha/work-in-progress. I'm not yet using it on a live site, but I will be as soon as I'm done the rest of the site.
Right now, for simplicity, I am totally ignoring product dimensions. It sends the quote with dimensions 1x1x1cm and marked as "ready to ship" so Canada Post does not attempt to pack it into boxes for you. The shipping price is based entirely on weight. In my very limited testing so far this seems to work fine, but I'd love some feedback.
I chose to leave dimensions out of the picture for a number of reasons - mostly that it is incredibly complex. It is a lot of extra work when adding products to the store. There are no dimensions fields for a product, so they would have to be supplied by this module (much like the UPS module does), which is redundant and makes it even more tedious for the store admin. Canada Post will do the "box packing" for you (based on predefined box sizes you set up on your SellOnline account) -- which is fine unless you're a small business (like the one I'm writing this for) that just ships with whatever boxes happen to be available.
The implication of this is that for large but light objects, you'll have to enter the weight a bit higher than usual. There is a calculation the shipping companies do to calculate what they call "dimensional weight" - if it's higher than the real weight, they base the price on that instead (to simplify it).
It also means that prices for multi-box shipments will be off - perhaps this can be handled by splitting up shipments into separate "boxes" for every x kg.
----------------------------------------
This module has been updated by TR to version .2 to include splitting boxes for every x kg. View the details in his comment below.
| Attachment | Size |
|---|---|
| uc_canadapost-5.x-0.2.tar.gz | 7.32 KB |


Re: Canada Post Shipping
Products have dimension fields, and have had them since alpha7e at least. They are available to the shipping method via node_load().
Fix for Ubercart 7e
I have messed around with the module to get it working, turns out it isn't that bad.
Two things need changing:
1 - Change the switch line that calculates the weight into KG as the variable changed at some point:
function _uc_canadapost_make_request($products, $details) {
$cpcid = variable_get('uc_canadapost_cpcid', '');
$turnaround = variable_get('uc_canadapost_turnaround', false);
$from_postalcode = variable_get('uc_canadapost_postalcode', false);
$weight = 0;
$price = 0;
foreach ($products as $product){
$product->weight *= $product->qty;
// convert to kg
switch ($product->units){
To:
switch ($product->weight_units){2 - Add the new workflow_ng function: (Copied the one from USPS and modified it)
/******************************************************************************
* Workflow-ng Hooks *
******************************************************************************/
function uc_canadapost_configuration(){
$enabled = variable_get('uc_quote_enabled', array('canadapost' => true));
$configurations = array(
'uc_canadapost_get_quote' => array(
'#label' => t('Shipping quote from Canada Post'),
'#event' => 'get_quote_from_canadapost',
'#module' => 'uc_canadapost',
'#active' => $enabled['canadapost'],
),
);
$action = workflow_ng_use_action('uc_quote_action_get_quote', array(
'#label' => t('Fetch a shipping quote'),
));
$configurations['uc_canadapost_get_quote'] = workflow_ng_configure($configurations['uc_canadapost_get_quote'], $action);
return $configurations;
}
Note: Work still needs to be done as some countries return nothing at all, and orders that exceed the 30KG limit don't display an error.
Let me know if you have any questions.
I am also attaching a copy of my modified module, replace your own module file
broken link ??
this mod is just what I'm looking for, eh ? I'm also hoping for a canada post tracking mod ??
Unfortunately the link seems broken. Please repost ?
Re: broken link ??
Does anyone have a copy of this mod that you can pm to me ? The link here seems broken.
Re: Canada Post Shipping
Has anyone implemented this module on a live site, what kindof problems will this module give me if I start using it.
Do I have a choice on how to do Canadian shipping without this?
rolandk wrote: Does anyone
Does anyone have a copy of this mod that you can pm to me ? The link here seems broken.
The link appears broken because the default Drupal .htaccess forbids serving .module files. I'm sure the file actually exists on the server, but you'll have to get one of the admins to zip it up and fix the above link so it can actually be served.
Re: rolandk wrote: Does anyone
Ryaaaaaaaaaaaaaaaaaaaaan !
Re: Re: rolandk wrote: Does anyone
Admins have confirmed and I look forward to seeing the zip attachment soon.
Re: Re: Re: rolandk wrote: Does anyone
Forgot about it by the time I got to work yesterday.
Re: Re: Canada Post Shipping
Not live but I tried it out yesterday and the quotes were a bit off. Probably because dimensions are not used. It would be really beneficial to have dimensions as this is how CP would let you know how many boxes would be needed for multiple items.
For example with Zen cart CP addon a customer will be shown how many boxes are going to be used if you have multiple items.
Status of Canada Post Module
I'm about to set the shipping for my site and wondering how you're doing with the CP module? Would it be possible to chat with you about it? I can be reached at 250-612-9161.
Re: Canada Post Shipping
Discovered a problem today with weight and box sizes.
I have an item that I set the weight to 5kg and box size to 20-20-20cm. I've also created a box on the Sellonline profile page size 25-25-25cm.
Whats happening is the module keeps giving me quotes until I get over 30kg in product weight. So if I have 6 of my 5KG items I'm ok but on the 7th one I just get an error and the module doesn't allow to put items into several boxes.
There were problems getting a shipping quote. Please verify the delivery and product information and try again.If this does not resolve the issue, please call in to complete your order.
When I was running Zencart every time a box reached its limit in weight or the items filled the dimensions the CP module would list the amount of boxes need for the shipment and then adjust the shipping cost accordingly.
What are the chances of modifying this modules to perform the same task. I'm willing to put up money to get it done as this kinds puts a crinkle in getting my site live.
Re: Canada Post Shipping
I did some more testing and I can't get CP quotes if the total weight of all the items reaches past 30K. Also I've attached a screen shot of how Zencart CP modules handles boxes.
New version of uc_canadapost
Development of this new version of uc_canadapost was sponsored by PnwGardenSupply.com / MyGreenPlanet.com
The differences between this version and the previously posted versions are listed below. The main feature of this version is the automatic division of order products into packages of 30kg or less. 30kg is the Canada Post weight limit for a package. This version will calculate how many packages need to be sent, calculate the cost of shipping each package, and display the total number of packages and the total shipping cost to the customer.
Modifications to the uc_canadapost.module posted at the top of this thread include:
Re: New version of uc_canadapost
Thanks TR for the quick work
I have attached a screen shot for those who want to see what this will look like when I user gets a quote at checkout time.
Re: New version of uc_canadapost
You da man, TR. gregmac hasn't been around in a couple of months, so I'm going to go ahead and add your version to the project page. I don't want to rope you into supporting something long term that you got paid to improve once, but let me know if you'd want this contrib to be assigned to you if he has no objections.