Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Canada Post


pmakulski

Recommended Posts

I just installed Canada Post module 4.1.

It all seems to work ok, except for the weight calculation.

I have a product that weighs .1kg

As I change my order volume from 1 to 2 to 6 etc.,

the weights are right for 1 to 4:

The box weights .03 so the weights returned for 1 to 4 are: .13 .23 .33 .43

But when I have 5 units, the weight says 1.18 (it should be .53) but worse,

when I have 6 units it still says 1.18 ??

 

Any suggestions?

Edited by pmakulski
Link to comment
Share on other sites

  • 1 month later...

Well, I'm back, working on this issue again.

I am most disappointed to see that nobody bothered to answer this after I posted the question over a month ago.

 

I've crawled through my implementation of my code for the CP 4.1 module.

I did find 2 errors (one line in the wrong place, one SQL statement change missed.)

But after fixing these two, the problem persists.

 

I can see the Canada Post module providing correct weights (package weight + product weight) for up to 4 units.

When I enter 5 or more units:

- the weight becomes a much higher number than it should be

- and it never changes.

 

Here are the weights for 1 thru 7: .111, .211, .327 (bigger package), .427, 1.33, 1.33, 1.33, ...

(The correct weights are .111, .211, .327, .427, .6, .7, .8, ... )

 

Is there a bug that causes errors at 5 units, or .5 kg. Like a data type conversion or something stupid like that?

 

How do I find what the problem is?

Link to comment
Share on other sites

How do I find what the problem is?

Look the code where the weight is calculated, add print() statements and make sure that everything is correct at every step. Canada Post needs the weight in kg, so make sure that's the case in the code as well as your database.

 

I recommend hiring a PHP dev, if you don't know programming -- osCommerce requires programming knowledge. Then you would also get instant replies to your questions...

Link to comment
Share on other sites

Just a tip, check your admin section. There is an area that increases your shipping costs by a defined percentage should the weight exceed a certain weight. Also, OSC is set up in imperial pounds, not kilograms as Canada Post ships. You may want to ensure that you have changed the default weight measurement to Kg.

 

 

 

Chris

Link to comment
Share on other sites

  • 2 weeks later...
Just a tip, check your admin section. There is an area that increases your shipping costs by a defined percentage should the weight exceed a certain weight. Also, OSC is set up in imperial pounds, not kilograms as Canada Post ships. You may want to ensure that you have changed the default weight measurement to Kg.

Thanks Chris.

I see the the large package percent increase. It's set to zero.

I've got the weight set to KG and I've input all the weights in kg.

 

It seems to be calcing correctly to the point of 5 items. I think maybe Canada Post has my account set in test mode or something.

I'll have to call them, but the tech line was swamped before Christmas.

Link to comment
Share on other sites

Love it when people assume just because I post it, some one must answer it.

 

This is a free forum and all answers are given free gratis and for nothing. If you don't get an answer maybe no one knows or can't tell from your description or have never used the contribution you are having a problem with.

 

That said, would suggest you check tare wt and max wt settings.

Edited by geoffreywalton

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Look the code where the weight is calculated, add print() statements and make sure that everything is correct at every step.

I'm not a programming novice; but I'm far from a php pro.

Thanks for the reminder about using print statements.

 

I've captured a few details when I ask for a quote.

My shopping cart has 2 products, 3 of one and 2 of another. All weigh .1 kg, all are 14x14x1 cm (they're CDs)

 

In canadapost.php , the prints yielded:

shipping_weight: 0.51

total_weight: 0.5

This looks good.

 

This is what canada post returns:

packingInfo: P_0 Homemade for 5 or more 1.33 0.6 40.0 40.0 5.0 5 online_product

The 1.33 purports to be the weight of the package, but it should be 0.5 plus the weight of the box. In the serverlet, that box does not weigh 0.83 !)

 

From what I can tell, this is what is being sent to CanadaPost

data: enCPC_MINEB0J1N007530.1014.0014.001.00online_product20.1014.0014.001.00online_productWaterlooOnt

arioCAN2J1T7

 

In that, I can see the language, the CPC account, the from and the to postal codes, and the array for the two products.

I can't puzzle out the product info

075

30.1014.0014.001.00online_product

20.1014.0014.001.00online_product

 

I see numbers that look like the quantity( 2 & 3), weight (0.1), and dimensions (14 14 1)

I don't know why the numbers all run together like that. Perhaps the print statement is ignoring tabs?

 

So, the program on my side looks ok (maybe), so how is CP coming up with the weight of 1.33? Could it be an error on their side?

Link to comment
Share on other sites

@pmakulski:

Now this report is actually useful. Please try logging in to http://sellonline.canadapost.ca/servlet/Lo...vlet?Language=0 to change the default box that Canada Post uses to calculate a rate for you. I would set their box weight to as close to zero as possible, so that the osC tare weight is used instead. Hope this helps :)

 

I don't know why the numbers all run together like that. Perhaps the print statement is ignoring tabs?

It's probably XML. You can view source of the page to see the full syntax or use htmlspecialchars() function before printing.

Edited by natrium42
Link to comment
Share on other sites

It's probably XML. You can view source of the page to see the full syntax or use htmlspecialchars() function before printing.

 

Yes, that's it. Played with it a bit more today and it is a bunch of xml tags.

And this was really informative. This is what the return bit from CanadaPost actually says:

<packingID>P_0</packingID>
<box>
  <name>Homemade for 5 or more</name>
  <weight>1.33</weight>
  <expediterWeight>0.6</expediterWeight>
  <length>40.0</length>
  <width>40.0</width>
  <height>5.0</height>>
  <packedItem>
		<quantity>5</quantity>
		<description>online_product</description>
  </packedItem>>
</box>

The CP 4.1 script is picking up the thing called "weight". I have no idea how they came up with that 1.33, but there is another number called "expiditerWeight". That looks more like the number I want.

I think I can change the code in the CP shipping module to find and use that number instead.

 

Thanks for your help. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...