Originally created by gregmac, this module has been updated and is now maintained by TR.
Module that interfaces with Canada Post's "SellOnline" service (http://sellonline.canadapost.ca) to obtain shipping quotes. Works for both domestic and international shipments.
Module description from gregmac:
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 0.2 to include splitting boxes for every x kg. View the details in his comment below.
----------------------------------------
Version 0.3 implements the missing "Markup" functionality on the admin page. Now you can apply a rate markup to the Canada Post rates before presenting the quote to your customer.
Version 0.4 adds minor fixes:
- An updated Canada Post services list (see comment #62)
- A new theme function theme_uc_canadapost_option_label() for displaying the quote line items on the checkout page
- A .pot file to facilitate translations
- Integration with the I18N module, to request French language quotes from Canada Post when I18N is set to 'fr' (see comment #63)
- Use of format_plural where needed
| Attachment | Size |
|---|---|
| uc_canadapost-5.x-0.4.tar.gz | 10.36 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.
Re: Re: New version of uc_canadapost
TR, On behalf of all Canada-based Ubercarters, thanks - appreciate the work on this mod.
Timeout error
No matter what I do, I always get a timeout error ('110 Connection timed out') when opening the socket in _uc_canadapost_drupal_http_request() (line 391).
Anybody else is having the same error message or knows how to fix it? I tried increasing the connection timeout parameter from 15 seconds to 30 but to no avail.
Thanks in advance!
Re: Timeout error
I haven't had time to work on my sites but I just tried it and it works fine here. Did you make sure port 30000 is open? If not ask your host to open it. If they don't find and new host
Re: Re: Timeout error
The error means that the application can't open a socket (network connection) to the Canada Post server - 99.99% sure that's due to your server configurations. Perhaps your web host doesn't allow outgoing socket connections, perhaps your host requires outgoing connections to go through a proxy, etc. You should look at your host's FAQ or call their support to find out.
Re: Re: Timeout error
Wrong port. It's port 3000
end user wrote:Wrong port.
Wrong port. It's port 3000
No, you were right the first time. It's port 30000 (with four zeros).
Re: New version of uc_canadapost
Markup isn't being applied
In uc_canadapost_quote it grabs the value you set in admin and assigns it to a variable but it doesn't actually do anything with it
Re: Re: New version of uc_canadapost
A curious omission in the original code! I added the code to do the markup - download version 0.3 at the top of this thread.
Re: Re: Re: New version of uc_canadapost
thanks
Re: Canada Post Shipping
It doesn't work for me. I don't know what I'm doing wrong, but when I click calculate shipping, its just a blank screen, no error or anything, anyone mind helping me?
Re: Re: Canada Post Shipping
http://www.ubercart.org/faq/2246
Re: Re: Re: Canada Post Shipping
Thanks but none of those worked, here's what shows up:
http://img177.imageshack.us/img177/6023/ucerrorob8.jpg
Re: Re: Re: Re: Canada Post Shipping
Please be a little more specific. That screen shot is from the /cart page. And it's not blank. Does any shipping module work for you? Have you set your store address? Have you entered your Canada Post credentials (& are they valid)?
Re: Re: Re: Re: Re: Canada Post Shipping
Yes, UPS was working, Yes I have entered my store address, and I'm pretty sure my Canada Post credentials are correct.
Re: Re: Re: Re: Re: Re: Canada Post Shipping
I still haven't gotten it to work, I am 99% sure my Canada Post credentials are correct. If ANYONE can help me, I would truly, truly, appreciate it.
Re: Re: Re: Re: Re: Re: Re: Canada Post Shipping
Give me a URL to look at, otherwise all I can do is guess.
www.punjabstateinc.com thanks
www.punjabstateinc.com
thanks.
Re: www.punjabstateinc.com thanks
I can see nothing obviously wrong from looking at your site. The fact that the quote doesn't return anything really seems to be a configuration problem on your end. You can uncomment lines 268 and 269 in uc_canadapost.module to print out some debugging information - that will show the request being sent to the Canada Post server, and the reply from the server. You should also verify that your Canada Post SellOnline preferences are configured properly on the Canada Post server. You should also make sure your web host allows outgoing http requests without a proxy - maybe you have to open a port in the firewall. You can test from your server command line with wget http://sellonline.canadapost.ca/ - this command should save the contents of index.html to your local disk. If it fails then the problem is with your web host.
Re: Re: www.punjabstateinc.com thanks
Turns out my host doesn't allow outgoing port access, and in order to gain access to it I must purchase a dedicated IP address.
You think this is the issue here? Because I am really not wanting to spend money on a dedicated IP if its not the problem at all.
Re: Re: Re: www.punjabstateinc.com thanks
Well YES it's a problem. This module obtains quotes by connecting to the Canada Post server, passing details about the package, and receiving a quote from Canada Post in response. There's no other way to get information from Canada Post except by making an outgoing web request. That whole thing about purchasing a dedicated IP is bogus - it's not needed for any technical reasons. Shared hosts / shared IPs can do this without a problem. It must be a business policy for your web host, rather than a technical limitation.
Re: Re: Re: Re: www.punjabstateinc.com thanks
Yeah they said shared IP's cannot access some ports because it creates security loopholes an can compromise the security and what not.
Re: Re: Re: Re: Re: www.punjabstateinc.com thanks
Do you already have a dedicated SSL certificate for your account/site? If so you're already on a dedicated IP other wise there is no serious reason why they would need to charge you for a dedicated IP just to open a port. How much are they asking for the IP?
$2.50 per month. I did it,
$2.50 per month.
I did it, yet its STILL not working, I'll try talking with their customer support.
Re: Re: www.punjabstateinc.com thanks
I have tried this command and it seems successful. I used the windows program called Putty and got this response:
--08:52:44-- http://sellonline.canadapost.ca/
=> `index.html'
Resolving sellonline.canadapost.ca... 66.110.6.131
Connecting to sellonline.canadapost.ca|66.110.6.131|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,650 (1.6K) [text/html]
100%[====================================>] 1,650 --.--K/s
08:52:45 (80.12 MB/s) - `index.html' saved [1650/1650]
Any idea what to try next?
Re: Re: Re: www.punjabstateinc.com thanks
You have to run that command from your web host, not your personal computer. The object is to try to see if an application running on your web host can connect to the Canada Post server.
Re: Re: Re: Re: www.punjabstateinc.com thanks
Yes, I got my webhost to run the command, that was their reply.
Re: Re: Re: Re: Re: www.punjabstateinc.com
I'm finding it really hard to help you when you give incomplete and inconsistent answers, and don't provide any background information. Your site runs on Unix, yet you say you ran the command with Putty, a Windows program. If you simply used Putty to telnet to your web server then ran the wget command from your web server, why mention Putty at all?
You don't say anything about how you've set up the shipping, what you did with Workflow-ng, what version of Drupal, Ubercart and uc_canadapost (& Workflow-ng) you're using, why you know your CPCID is correct, etc. You don't say anything about how you've set up your Canada Post SellOnline account. It's clear to me that the problem is a configuration problem on your side, but you don't give me any of the information I need to help you, so all I can do is guess at things. If you uncommented the lines like I asked and sent me the output I could tell whether you forgot to set some of your configuration options, or whether your CPC ID is valid, or whether you've even selected any valid Canada Post services for your product types. There's a lot of information about debugging shipping quotes here in these forums. Right now I'm just blindly guessing what's wrong on your end.
Re: Re: Re: Re: Re: Re: www.punjabstateinc.com
I did uncomment the 2 lines, but nothing showed up, tell me if this is the right line:
//if (user_access('configure quotes') && variable_get('uc_quote_display_debug', FALSE)) {
// not quite right - need to get response object before JSimpleXML ...
Its Drupal 5.2, Ubercart 1.0
latest version of uc_canadapost
I'm not sure which version of Workflow but I'll check for a new one. I also noticed theres a new Ubercart version so I'll upgrade.
I know my CPC ID is correct because I have a VentureOne card from Canada Post, and I put that number into my Shipping Profile on the Sell Online site, and I put the same number in on the module
I now noticed theres a new drupal, 5.9, so I'll try upgrading to that also.
EDIT:
Now I've updated everything, still no luck, in my Canada Post client info thing, I have for general info:
my legal company name, website, email, postal code, my CPC #, my distribution agreement number is #0, turnaround time is 12 hours, and the sell online status is Live/En Production
for my shipping services I have everything enabled. and the calculated rate for everything is Small Business Rate
for the boxes I have the default Purolator box, and a Small Package which is 38.1 x 38.1 x 7.6
the handling fees are set to flatrate 3 dollars
in Ubercart, for the Canada Post Settings, the CPC ID is the same CPC # in my Canada Post profile, the interface URL is sellonline.canadapost.ca:30000, all services are checked, markup type is addition, and shipping rate markup is 3, turn around 24 hours, delivery date format is estimated delivery: Wednesday, July 30, 2008 and the shipping from postal code is the same as the one in my Canada Post profile.
And also, since I'm in desperate need, if you think it'll help you find whats wrong, I'm willing to give you my Canada Post user and pass and create you an administrator account on the site.
Re: Re: Re: Re: Re: Re: Re: www.punjabstateinc.com
Please tell me if the lines I uncommented were the right ones..
//if (user_access('configure quotes') && variable_get('uc_quote_display_debug', FALSE)) {
// not quite right - need to get response object before JSimpleXML ...
Re: Canada Post Shipping
What're the chances of some nice person updating this to run with the v6 ubercart?
Re: Re: Canada Post Shipping
Ubercart for D6 doesn't even have an alpha release yet - it is still a work in progress. It makes no sense for me to update this module until Ubercart D6 is ready for testing.
Having problem with the Canada Post 0.2 module
Hello,
I've got a couple of problems with the Canada Post module in that:
1) The user is only requested to provide their postal code, and not country when estimating shipping cost.
2) When they do enter their postal code, they get the standard error message of:
"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."
What I have done is:
1) Installed and configured this module for shipping quotes with the "Ubercart Deluxe Installation".
2) Enabled port 30000 (that is thirty thousand) on my server (am using Hostgator).
3) I tried this with the CPC_DEMO_XML ID, as well as an illegal ID. When I used the illegal ID, I saw in the logs:
Merchant CPC Id not found on server.
That verified we were communicating with Canada Post. I don't get any log entries if we use CPC_DEMO_XML and valid postal codes.
5) I made sure I had a product to chose from, that it was in my shopping cart, and that the product had a weight of 5 grams.
When I entered a postal code of 999 (remember, there was no place to enter the country on the shipping estimation form, only a postal code), I saw in the logs:
6) I'd also enabled several Canada Post shipping methods, such as Canada Post Xpresspost, Air US, Xpresspost US.
7) I enabled logging errors to the watchdog and debug information to the administrator.
(Note: this may not show up properly)
Shipping failed. Request was: <?xml version="1.0" ?>encpc_demo_xml2429111111 itemsCA999, response was <?xml version="1.0" ?> ]> -3001 Destination Postal Code/State Name/ Country is illegal. 2103102
9) In country settings, I have enabled both Canada and the US.
Any idea of what I may be doing wrong or is there other information you'd like?
atuline wrote:I've got a
I've got a couple of problems with the Canada Post module in that:
1) The user is only requested to provide their postal code, and not country when estimating shipping cost.
2) When they do enter their postal code, they get the standard error message of:
It sounds like you're referring to the optional "Estimated shipping cost" field on the cart page. uc_quote is the module that handles this field, not uc_canadapost. When the button is pressed, uc_canadapost is passed the postal code and the store's default country (set at admin/store/settings/store/edit). If you enter a Canadian postal code, and your store's address is set to Canada, this will work, but if you enter a US postal code it won't. Nothing else uc_canadapost can really do here, since the customer's country information isn't passed in.
Note this is only a problem if you're using Canada Post to ship worldwide - if you are just shipping within Canada you'll never see an error.
As a workaround, you can turn off that estimate calculation at admin/store/settings/cart/edit/panes. Your customers will still see the calculated shipping cost on the cart/checkout page, before they complete the purchase. The shipping calculation on cart/checkout will always work because all the address information is available at that point, not just the postal code.
The place for a proper fix is in uc_quote, to request the country in addition to the postal code.
Error in Ship Packages
Hi there, I'm getting this error in my drupal/ubercart store. I'm logged in as a store admin and am trying to ship an order with Canada Post:
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '' was given in /home/sitename/public_html/includes/form.inc on line 218.
Any ideas?
fix quote error due to slow server response
Hi all,
If you find that sometimes you are not getting a quote returned from this module, it's possible that the CP's sellonline server (or the internet) is slow, and that breaks the modules handling of the server response.
I have made the following changes to the module file (uc_canadapost.module) to work around this:
(near/below the line "// Fetch response" )
1. comment out lines 471, 472, 473 like this:
// while (!feof($fp) && $chunk = fread($fp, 1024)) {// $response .= $chunk;
// }
2. added this line:
$response = stream_get_contents($fp);Now this "fectch response" section of code (lines 469~475) should look like this:
// Fetch response.$response = '';
// while (!feof($fp) && $chunk = fread($fp, 1024)) {
// $response .= $chunk;
// }
$response = stream_get_contents($fp);
fclose($fp);
And finally save the file. That's it.
(this works only for PHP5 and up)
(attached the module file with the patched work around)
Re: fix quote error due to slow server response
It's not clear to me why stream_get_contents() would do anything different than fread() in this case, since they're both blocking reads. Perhaps it's the PHP max_execution_time setting that's causing the problem?
Regardless, I really hate the whole _uc_canadapost_drupal_http_request() as a replacement for drupal_http_request() thing that I inherited with this module. I see why it was done, but it makes the module unmaintainable. Rather than patch drupal_http_request() further like you suggest, I'm inclined to just throw that whole section of the code out and replace it with calls to cURL. That will save >100 lines of code, make it easier to read, and make it more robust as well, but it does add the dependency on cURL. I don't see that as too big an issue, because all the other shipping modules also seem to depend on cURL.
yes....cleaner code
I am all for cleaner code!
As why fread() doesn't work as it should... I think it might have something to do with, as specified in the documentation, it stops reading from a socket "after a packet is available". I know it sounds strange, but I guess it reads fine with the specified chuck size if the data coming in from the socket is continuous without pauses or interruptions (caused by slow server or network response). If there is any pause, and at the moment more data starts to come in, fread() stop reading... ?_?
I did some tcpdump and console debug, what I found was that the sellonline server would stop for about 3~4 seconds in the middle of a response before continuing...and it seems the module's fread() would break at that point and not receive the rest of the response, and the whole module returns with an error.
Anyway... again, I am all for cleanser code!
Are the shipping rates accurate?
Hi,
I've just installed the Canada Post module. I have my Canada Post credentials and everything seems to connect properly on the checkout page. The only problem is that the quotes that I'm getting back are very low when I compare them to the quote I get when I go on line at the Canada Post shipping calculator site.
Has anyone else experienced this problem? So far, my store only has a few products as I am still building, but I don't want to go too far with this if the shipping rates are out to lunch!
By the way, my porducts have both their dimensions (in cm) and weight (in lbs) listed.
Thanks in advance,
partyman
Re: Are the shipping rates accurate?
This module gets the rate quotes directly from the Canada Post server. If the quotes from this module don't match what you get when you use the Canada Post site directly, the only explanation is you're comparing apples to oranges - i.e. the two quotes are not based on the same data. To see what you're sending to the Canada Post server, uncomment the following two lines in uc_canadapost.module:
//drupal_set_message('<pre>'. check_plain(var_export($xml, TRUE)) .'</pre>');//drupal_set_message('<pre>'. check_plain(var_export($response, TRUE)) .'</pre>');Examine the fields closely to see what is being sent to the server. That will show you where the problem is.
Re: Are the shipping rates accurate?
I haven't checked lately but normally the quotes did very by a few cents between UC and the Canda post website although the UC quotes where the same as when I tested out Zencart. I don't know why there was a difference but it wasn't that great of a difference.
Check that that at you don't have any surcharges set on the Canada post site.
Canada Post isn't seeing the dimensions
Further to my previous: I just spoke to the tech services at Canada Post. When I request shipping quotes for a product that was 10 kg and 80 cm x 40 cm x 10 cm the server saw a request for a 5 kg package (close enough) that was 10 mm (yes, mm) x 10 mm x 10 mm. The postal code was correct as was the type of shipping requested.
Can you give me an idea what configuration I would have to check? Any suggestions would be appreciated. Thanks.
Partyman
Re: Canada Post isn't seeing the dimensions
Canada Post's XML doesn't let you specify units, just amounts. So this module explicitly converts the product weights to kg (which is what the Canada Post server expects), regardless of what your store units are. If you've set the product weight units and entered the product weight in those units on the product edit page, the conversion to kilograms is done automatically in the code. But this is why I really need you to do what I asked and print out *exactly* what is being sent to the Canada Post server, because the quote returned depends only on the numbers you send it.
The issue with dimensions ... this module uses a package size of 1x1x1 cm. Shipping rates (for *all* carriers, not just Canada Post) are based entirely on weight *except* in cases where the package is exceptionally light for its size - then the rate is based on the *expected* weight, known as "dimensional rate". If your package is not exceptionally light for its size, then choosing a small package size like this is the correct strategy, and indeed this is exactly what the carriers do on their own web sites when you get a "quick quote" (i.e., when you just type in origin, destination, and weight). The only time this is a problem is when a dimensional rate should be charged.
None of Ubercart's shipping modules handles dimensional weights, because the packaging problem is intractable without many constraints. For example, what size package would you have Ubercart assume if you had two 80cm x 40cm x 10cm products in an order? Would it be 80x80x10, or 80x40x20, or 160x40x10 ? Do you really have boxes that fit exactly two of these items with no room to spare, or do you have to use a larger box? How about 3 of these items? How about two of these items plus some number of smaller 10cm x 10cm x 10cm items? Without knowing exactly what your available box sizes are, and without a packing algorithm that boxes up items exactly as a human would (i.e., not necessarily the most efficient way in the smallest possible box for that order, but with cushioning material and extra padding material for items that aren't already individually boxed and without the extra padding for items that ship in a manufacturer's packaging, etc.) there is no way to accurately determine the true dimensions of the shipping box. I suppose a packaging module could be written to make a fair guess, but it would have to have a lot of configuration parameters. Regardless, that's outside the scope of a shipping module like this.
Depends on what you're shipping, of course, but I think a common reason people need to deal with dimensional rates is when they have large, light items that ship alone. For those, it's easy to just enter a dimensional weight rather than the real weight on the product page. Other common situations might be just as easy to deal with.
I appreciate the insight
Hi TR,
Thanks very mich for the insight. I can see your point. My wife sells wooden toys, so they are generally much heavier than the dimensionnal weight. Now, part of the problem might be that my test product is probably the biggest item she sells: a wooden Brio-type train set. The other products are mostly wooden puzzles. The quote for those would probably more appropriate.
As far as printing out what you asked, I think that I ma have hit my limit as an amateur webmaster: I went through the module and found the code you asked for, but as far as I can tell, it was already uncommented (no // in front on the text). Apart from that, I must admit that I am not even sure where I would find what is being sent to the Canada Post server. I'm not sure where the log in question is located.
(Sorry, I only started using Drupal about a month ago and ubercart last week. I'm pretty quick at picking this stuff up, but I have my limits. That's why I really appreaciate the tips and assistance I get from this forum. Thanks again!!!
)
partyman
Eureka! It works!!!
Hi again,
Needless to say, TR was bang on the money WRT weight vs. volumetric weight. The link below from Canada Post provides a great explanation.
http://www.postescanada.ca/tools/pg/manual/pgabcmail-e.asp#1378832
I've converted my products to volumetric weight and now I get the exact price that the Canada Post site quotes me. Yes!!!
I've come to realise that I have more products than I expected that require the volumetric weight: my wife also sells carboard jigsaw puzzles. The volumetric weight is always higher than the actual weight.
This may be asking for much, but since the uc_canada_post module already asks for the dimensions of the product as well as the weight, could the module calculate the volumetric weight and then subit the greater of the two? This would reduce quite a bit of manual number crunching. I'm sure that I'm not the only one in this position. Just as thought...
Thanks again for the great module and all your help. It's really appreciated.
Partyman
A fix for this?
KTerry, did you ever find a fix for this problem? I'm having it now, too.
Looking into this, I can't find any code that seems to actually implement the shipment, which seems like a big problem. What have the rest of you been doing to work around this?
In any case, I decided that something other than a fatal error might be nice for people looking after the store I'm working on. I made one small change on line 756 in uc_shipping_make_shipment in uc_shipping. Change:
if (isset($method)) {to:
if (isset($method) && $method['ship']['callback']) {Re: Canada Post Shipping
I find that the list of Canada post services managed by this module is causing me a problem.
It seems that because the list is not exhaustive, some shipping methods are not being offered to the customer. In this case it is Small packets for international customers, the cheapest method of shipping overseas.
I don't understand how it is useful to have a second filter for shipping methods in the module since this is already being managed in the canadapost account. In fact, since the methods are hard coded, it is a potential problem if canada post changes or adds methods.
For the time being I've commented out lines 277, 282 and 296
if (isset($services[$id]) && ($services[$id] == $id))
Multilingual
Canadapost can respond in french also.
For sites using i18n, adding the following code in the _uc_canadapost_make_request() function will do the trick.
<?php// ennable support for i18n - canadapost can respond in french
if (module_exists(i18n)) {
(i18n_get_lang() == 'fr') ? ($lang = 'fr') : ($lang = 'en');
}
?>
After which the following line
<?php'<eparcel><language>en</language><ratesAndServicesRequest>'.
?>
needs to be changed to
<?php'<eparcel><language>' . $lang . '</language><ratesAndServicesRequest>'.
?>
Problem with date format on international orders
The following code around line 288 creates invalid dates in some instances when a string describing a delay (1 to 2 months, 2 to 4 weeks) is returned by the canadapost server instead of the expected date format. This happens with overseas surface shipping.
<?php// add est. delivery date
if ($datefmt && isset($product->deliverydate[0]) && ($deliverydate = $product->deliverydate[0]->data())) {
$deliverydate = strtotime($deliverydate);
$rates[$id]['option_label'] .= ' ('. t("Estimated delivery") .': '. date($datefmt, $deliverydate) .')';
?>
When date() is executed with the inappropriate data, the result is 1969/12/31.
The quick fix is to remove date formatting options, but that's not great.
I am also under the impression that in some instances the data returned by the server is buggy. Right now the sellonline team is busy with a software update, but I'll get back to this one when they get back to me.
Quote:In any case, I decided
In any case, I decided that something other than a fatal error might be nice for people looking after the store I'm working on. I made one small change on line 756 in uc_shipping_make_shipment in uc_shipping. Change:
if (isset($method)) {to:
if (isset($method) && $method['ship']['callback']) {I just noticed this comment. Probably a good idea, since the only module which implements the shipping methods is UPS. However, since the fix is in uc_shipping, that's not something I can change. I suggest you post this as an issue in the general issue queue so the uc_shipping maintainer will see it.
Quote:Canadapost can respond
Canadapost can respond in french also.
Your fix will be in the next version. Thanks.
Re: Problem with date format on international orders
If you can come up with a patch that does the date properly, I will be happy to put it in. In the next version of this module this information is displayed by a theme function, making it easy for you to override the formatting without modifying the module code. In the meantime, if its causing problems for you, you can just turn off the display of the estimated delivery date using the menu option at admin/store/settings/quotes/methods/canadapost.
Quote:I find that the list
I find that the list of Canada post services managed by this module is causing me a problem.
It seems that because the list is not exhaustive, some shipping methods are not being offered to the customer. In this case it is Small packets for international customers, the cheapest method of shipping overseas.
The next version of the module will have an updated service list. I don't know why some were left out in the first place by the original author.
I don't understand how it is useful to have a second filter for shipping methods in the module since this is already being managed in the canadapost account. In fact, since the methods are hard coded, it is a potential problem if canada post changes or adds methods.
Let me turn your question around and ask, how is it useful to have *Canada Post* be a second filter? All the other Ubercart shipping modules are self-contained. Breaking that paradigm and requiring the store owner to keep configuration data on both the Ubercart server and the Canada Post server seems to me to be a recipe for trouble and confusion.
Quote:This may be asking for
This may be asking for much, but since the uc_canada_post module already asks for the dimensions of the product as well as the weight, could the module calculate the volumetric weight and then subit the greater of the two? This would reduce quite a bit of manual number crunching. I'm sure that I'm not the only one in this position. Just as thought...
Yes, I think this is a good idea. It won't cover all cases, but it should come closer than ignoring the volumetric weight altogether. I'll add this to a future version of the module.
I've lost Xpresspost
For some reason, I can no longer get a quote for Xprespost. Even though it is selected as a shipping method, and that my CPC Sell Oline include it, it no longer appears. Anyone else noticed this? Or is it a case that my module is corrupted?
Thanks.
Pat
Re: I've lost Xpresspost
Anyone working on an Drupal 6 / Ubercart 2 port of this?
Re: Re: I've lost Xpresspost
I intend to port it when I get some free time or when a client needs it, whichever comes first. I will have a new D5 release in a few days to cover the issues I discussed above.
Port to Ubercart 2 / Drupal 6
Is there anything I can do to push this up your priority list? I have a very limited budget right now, but I am a drupal developer. Would you like me to look into doing the initial port and you can review it after to make sure it is as you expect?
I am planning on launching a store in the next month and this is something I need.
Cheers,
Will
Re: Port to Ubercart 2 / Drupal 6
D6 port would be nice as I'm about to start my own store and most modules that I need seem to have D6 port now so don't see the need for D5.
Re: Re: Port to Ubercart 2 / Drupal 6
Actually could I get a quote on how much it would cost to get the module ported to D6. I'll need to start the shop in D5 but won't take to long to switch over if the price is right.
New version now available.
New version 0.4 posted today, containing some of the fixes suggested above plus other minor improvements.
Re: Re: Port to Ubercart 2 / Drupal 6
I would also consider putting in a little cash to get this ported. Between 'end user' and I, we may be able to make it worth it for you to bump it up in your queue. I have a store that I am hoping to have live in a month which I would like to have this functionality.
I can go live with just UPS, but I would like to offer CP as well.
Cheers,
Will
Re: New version now available.
Thanks for the update.
change compatibility
If this is working with Drupal 6 and ubercart 2, then it should be reflected in the compatibility titles above eg Ubercart 1.x to 2.x.
I will test with Drupal 6 today.
Re: change compatibility
My bad, this does not work with drupal6/ubercart 2.x
Will this be ported soon?
Please&Thanks.
Moved to Drupal.org
This module is now hosted on Drupal.org at http://drupal.org/project/uc_canadapost
Please post any issues or support requests on the above project page, not here.
New site doesn't appear to have much in the way of content...?
Other than the front page blurb, there doesn't seem to be much going on there yet. I'd also like to chime in to request D6/UC2.x support - TR, if you've already started looking into this perhaps you could point out the portions of the code that need to be rewritten/refactored to get the port going, and then a few of us could help out by submitting patches?
thanks!
i wanted to thank you for the updates as well as for moving the module to d.o.
one further request would be that when the module becomes available for download on d.o, could you include a .info file so we'll get notices of available updates?
thanks a gain for cleaning up a critical module for us here in canada.
Re: thanks!
All the code is currently on drupal.org, in CVS, it just doesn't have a release generated for it. You can still download the code. I have to create the branches and tags before I generate a release and start the D6 port. There is an .info file included already.
Re: Canada Post Shipping
I have a question and need info on a solution. I asked this before but didn't get an answer. I'm also not sure if this has to to with attributes module or with shipping.
I have a site where a product will have multiple sizes and weight (bottles) so with out creating a different product for each size I want to use attributes (bottle size 500ML, 1L, 4L, etc..) problem is, and maybe I missed it you can only set Package quantity: one for each product and Package quantity: cant be set for attributes. This makes shipping calculation a bit off as say a 500ml bottle will be say 4x4x4 inches while a 4L bottle will be 4x10x8 inches in size.
Is there a way around this or will I be forced to create a different product for each bottle size?
Regarding attributes
From what I understand, Canada Post only cares about the weight (basically) for the product, not the dimensions. I am able to update the weight of my different skus (my attributes break up my one product into different skus). This allows me to set a different weight for each of my attributes.
I am using the following modules:
Attribute
Ajax Attribute Calculations
Attribute Stock Filter
stock manager with attributes
Hope that helped...
Will
Hi Yah I did some more
Hi
Yah I did some more testing yesterday and seems it might be ok for items with several options that don't very in size too much. I still haven't tested it with an item that has small (say 6x6x12" in size. Max 12 per box) and large bottles (6x10x14" max 4 per box) and see how CP seperates them into different boxes.