Zen Cart Logo
Forums / Addon Shipping Modules / Need help with Canpar...

Need help with Canpar...

Locked

Views: 6,736

Results 1 to 20 of 20
This thread is locked. New replies are disabled.
6 May 2008, 4:39 PM
#1
moonlilly avatar

moonlilly

New Zenner

Join Date:
Jan 2008
Posts:
18
Plugin Contributions:
0

Need help with Canpar...

Hi! I'm using zencart version 1.3.8a with the Canpar Module. I can't seem to get the module to calculate anything. The price is always 0.00$. Hopefuly someone can tell me what to do!!:shocking:

14 May 2008, 6:45 PM
#2
moonlilly avatar

moonlilly

New Zenner

Join Date:
Jan 2008
Posts:
18
Plugin Contributions:
0

Re: Need help with Canpar...

I have a feeling it may not be going to the right address to find it's information... Does/did anyone else have this problem?

27 May 2008, 12:27 AM
#3
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

Hello Moonlilly

Not sure if I can help solve the problem, but I can make a suggestion.

  1. I had the same issue when I was using Canpar with another cart I will leave unanmed. LOL

The issue with it was that it was using the incorrect URL to obtain pricing quotes.

Look in store/includes/modules/shipping/canpar.php

This is the correct line and URL: $body = file_get_contents('http://www.canpar.com/CanparRateXML/BaseRateXML.jsp?' . $request);

Just confirm it is correct.

  1. The original Canpar module only gave quotes for Canada locations and gave $0.00 for USA locations. Or maybe it's the other way around.

The module was never written for use with both countries. Also note, that Canpar doesn't ship to some USA locations, so that may cause $0.00 pricing.

I have edited the store/includes/modules/shipping/canpar.php to work in both countries with the help of other members here.

I will attach the canpar.php file for you to use and copy it into the location I gave above.

I have also found another problem with the Canpar module.
It allows you to markup the shipping fee, but it doesn't seem to be working.
I am going to post this problem and see if someone can help fix it.

21 Mar 2009, 8:16 PM
#4
wecawebdotcom avatar

wecawebdotcom

New Zenner

Join Date:
Mar 2009
Posts:
18
Plugin Contributions:
0

Re: Need help with Canpar...

Has there been any headway on this module at all?

21 Mar 2009, 9:44 PM
#5
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

It works, but the markup feature doesn't work.
I decided not to use it because the quotes seem lower than canadapost and UPS. I use these 2 for shipping quotes and if canpar is cheaper, I use it and keep the little bit of extra I might get.

22 Mar 2009, 1:15 PM
#6
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,604
Plugin Contributions:
0

Re: Need help with Canpar...

canadapost and UPS

Just a note: If you are using live quotes from one of the shipping companies and then actually shipping with someone else you could lose your access privileges. Not to mention, as a consumer, if I chose UPS and someone else delivered my package I might be upset.

22 Mar 2009, 1:45 PM
#7
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

I have never had the chance to do it. Canadapost is the most selected service and always the cheapest and easiest.

Canpar mod quotes prices $3-5 less then it should be, so I would lose money using this mod.

I would suggest to anyone not to use it.

15 Aug 2009, 4:22 PM
#8
mgmoore avatar

mgmoore

New Zenner

Join Date:
Oct 2008
Posts:
13
Plugin Contributions:
0

Re: Need help with Canpar...

I was having the same problem with my Canpar module. The shipping calculation had been working for over a year and then all of a sudden stopped working and would only calculate zero.

Long story short, the solution for me was to replace the following code in the canpar.php file (in modules/shipping)

Replace these two lines:
$srcFSA = substr(strtoupper(SHIPPING_ORIGIN_ZIP), 0, 3);
$desFSA = substr(strtoupper($order->delivery['postcode']), 0, 3);

With this:
$srcFSA = substr(str_replace(" ", "", strtoupper(SHIPPING_ORIGIN_ZIP)), 0, 6);
$desFSA = substr(str_replace(" ", "", strtoupper($order->delivery['postcode'])), 0, 6);

Explanation -- Canpar recently changed it so they need all six postal code digits sent when calculating shipping (instead of just 3 before)

Hope this solves it for you as well!!

16 Aug 2009, 11:34 PM
#9
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

Mine was working until like you said, they went to all 6 chacracter postal codes.

My problem is that the quotes are much lower than what the price is when I go to ship it.

Seems to be 25-30% lower than the counter price.

I tried using the mark up feature, but it doesn't seem to work.

15 Sep 2009, 8:48 PM
#10
luxifer avatar

luxifer

New Zenner

Join Date:
Mar 2009
Posts:
57
Plugin Contributions:
0

Re: Need help with Canpar...

breck:

Mine was working until like you said, they went to all 6 chacracter postal codes.

My problem is that the quotes are much lower than what the price is when I go to ship it.

Seems to be 25-30% lower than the counter price.

I tried using the mark up feature, but it doesn't seem to work.

I have the same problem. I really wish I could figure out the mechanics of how pricing is calculated. I can make a url string out of the code and submit it, and I get the correct number back, so it's not the canpar module that's the problem. Somewhere that number is changed.
Also there's the price adjustments not working, which is just insult to injury at this point.
I'm willing to modify code, and I will even provide good code back to the community, but I need to know where to look for it. I don't have the time to go through all of zencart. someone point me in the right direction please.

15 Sep 2009, 9:33 PM
#11
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

If the mark up part was working, you could add a percentage to the retrieved amount to come more in line with the actual price you would pay at the canpar outlet.

Just to do a test, I selected an item on my site shipping from CAN to USA and canpar module gives me a quote of $12.69.

If I go to canpar.ca for a quote on the same item, I get a quote of $22.26

The same item from CAN to CAN on my site quotes $7.59.

On canpar.ca it quotes $8.04

A bit closer, but still a loss.

I am going to contact canpar and ask them if they are providing counter rates or rates for people with accounts. And I will ask them about the difference in the quotes.

Some things that may help anyone inquiring into this mod:

http://www.canpar.com/XML/BaseRateXML.jsp?service=null&quantity=null&unit=null&weight=null&origin=null&dest=null&cod=null&dec=null&put=null&xc=null

http://www.canpar.com/XML/base_rate.xsd

15 Sep 2009, 9:44 PM
#12
luxifer avatar

luxifer

New Zenner

Join Date:
Mar 2009
Posts:
57
Plugin Contributions:
0

Re: Need help with Canpar...

yes, I could modify that, but the problem I have is, for small orders it's too high, but for big orders it's way too low. If I just add $30 to every order to match the big ones, then the guy that orders 1 item with $5 shipping will have to pay $35.
The real problem is, my quote matches up with just doing a live quote on the canpar site. but somewhere in the guts of Zencart, it's changing that. Where? so I can fix it.

15 Sep 2009, 10:50 PM
#13
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

I figured out what is wrong.

The xml as it is returns quote for weights in pounds.
If you use KG on your site, then you get a drastic difference in prices the heavier the parcel.

Also, the xml returns quotes without the 9.05% fuel surcharge.

I am not a coder, so I can't provide a fix, but I can supply the how to for the way this should work.

If your site uses pounds for weight

totalquote=xmlquote(with weight as pounds)+(xmlquote(with weight as pounds)*0.0905)

Elseif

totalquote=xmlquote(with weight as kg/2.2)+(xmlquote(with weight as kg/2.2)*0.0905)

Hope it's not too confusing.

Basically, you would have to use an if / endif to determine if your sites weights are pounds or kilograms.
If in kilograms, you have to convert to pounds in the module before requesting the quote.
Once you retrieve the quote, you have to add the 9.05%(0.0905) fuel surcharge to get the correct quote that will match canpar.ca

16 Sep 2009, 1:46 AM
#14
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

lol

Wasn't sure if my post went up.

My ip got banned on this site for a couple hours.

17 Sep 2009, 1:38 AM
#15
luxifer avatar

luxifer

New Zenner

Join Date:
Mar 2009
Posts:
57
Plugin Contributions:
0

Re: Need help with Canpar...

breck:

I figured out what is wrong.

The xml as it is returns quote for weights in pounds.
If you use KG on your site, then you get a drastic difference in prices the heavier the parcel.
No, I'm quoting in Kg and getting a reply in Kg. There is a key in the URL for format, either L for pounds or K for kilos. I wish it were that easy.

breck:

Also, the xml returns quotes without the 9.05% fuel surcharge.
I don't need the fuel surcharge.
I'm saying that if I submit the url by hand (the same url that the page will send), I get back the correct answer in the XML. But somewhere after that, the page nerfs the data.

I could just add a calculation to the canpar form that would give me something close to the right answer in all cases, but that's a lot of work and JUST WRONG. I'd rather have a solution than a workaround. Why doesn't it work as it should?

I guess I'll have to go into the files and find out. If I do solve it, I'll provide some answers here.

17 Sep 2009, 2:53 AM
#16
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

Thanks for the lb to kg fix.

I see the issue too. I tested with 100kg weight, and canpar.ca and using the link come back correct, but the module comes up with a price almost half the correct price.

17 Sep 2009, 2:08 PM
#17
luxifer avatar

luxifer

New Zenner

Join Date:
Mar 2009
Posts:
57
Plugin Contributions:
0

Re: Need help with Canpar...

Here's some info on the canpar API:

Parameters:

service: 1=Ground, 2=U.S.A., 3=Select Letter, 4=Select Pak, Select Parcel
quantity: Number of pieces in the shipment
unit: Weight unit of measure L=lbs, K=kgs
weight: Weight of the shipment
origin: Origin postal code
dest: Destination postal code
cod (cash on delivery): Value of the COD; 0 if not a COD shipment
dec (declared value): Value in Canadian dollars
put (Pickup Tag): 1=Pickup Tag Shipment, 0=Not a Pickup Tag Shipment
xc (Extra Care): Number of Extra Care pieces in the shipment

This is a sample http request to get a rate

http://www.canpar.com/XML/BaseRateXML.jsp?service=1&quantity=1&unit=L&weight=10&origin=M4X1W7 &dest=L4Y2N9&cod=100&dec=200&put=0&xc=1

Sorry, I had to wrap that in <code> tags so it would display.

Sample XML data returned:

<?xml version="1.0" encoding="windows-1252"?> <CanparRate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.canpar.com/XML/base_rate.xsd"> <CanparShipment> <COD>100.00</COD> <Declared>200.00</Declared> <Origin>M4X1W7</Origin> <Destination>L4Y2N9</Destination> <ExtraCare>1.00</ExtraCare> <PUT>No</PUT> <Quantity>1</Quantity> <ServiceType>1</ServiceType> <Weight>10</Weight> <Unit>L</Unit> </CanparShipment> <CanparCharges> <BaseRate>8.65</BaseRate> </CanparCharges> </CanparRate>

So if you want to ship in Kilos, just use the 'unit=K' in your string.
Note, check your URL, there are several URLs and I've gotten different results from different ones. This is the one Canpar just gave me, so I assume it's the one we should be using.

Just out of curiosity, if someone else would try the experiment, make the URL as above and paste it in your browser, and tell me if you get the same results as when you submit with Zencart. I don't, but I would like to see someone else try.

17 Sep 2009, 8:41 PM
#18
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

One issue I saw is "K" must be in caps. If lower case, it reverts back to "L"

I tested your above url and get a different quote.
Also Firefix and Explorer are same quote, but look a little different.

Firefox:

<CanparRate xsi:noNamespaceSchemaLocation="http://www.canpar.com/XML/base_rate.xsd"> − <CanparShipment> <COD>100.00</COD> <Declared>200.00</Declared> <Origin>M4X1W7</Origin> <Destination>L4Y2N9</Destination> <ExtraCare>1.00</ExtraCare> <PUT>No</PUT> <Quantity>1</Quantity> <ServiceType>1</ServiceType> <Weight>10</Weight> <Unit>L</Unit> </CanparShipment> − <CanparCharges> <BaseRate>9.25</BaseRate> <ExtraCareCharge>10.00</ExtraCareCharge> <CODCharge>4.50</CODCharge> </CanparCharges> <TransitTime>1</TransitTime> </CanparRate>

Explorer:

<?xml version="1.0" encoding="windows-1252" ?>
  • <CanparRate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.canpar.com/XML/base_rate.xsd">
  • <CanparShipment> <COD>100.00</COD> <Declared>200.00</Declared> <Origin>M4X1W7</Origin> <Destination>L4Y2N9</Destination> <ExtraCare>1.00</ExtraCare> <PUT>No</PUT> <Quantity>1</Quantity> <ServiceType>1</ServiceType> <Weight>10</Weight> <Unit>L</Unit> </CanparShipment>
  • <CanparCharges> <BaseRate>9.25</BaseRate> <ExtraCareCharge>10.00</ExtraCareCharge> <CODCharge>4.50</CODCharge> </CanparCharges> <TransitTime>1</TransitTime> </CanparRate>

I get a quote of $9.25

I don't know a great deal about coding, but learning a lot in the past 2 nights doing a little reading on php. Gonna be a wiz in time lol.

17 Sep 2009, 9:13 PM
#19
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

Seems it is getting the incorrect info to use.

I did another test by adding the line

$body = file_get_contents('http://www.canpar.com/XML/BaseRateXML.jsp?' . $request);
echo $body;

I used an item that was 5.3kg from Can to USA

I get returned:

0.00
0.00
K2P2N2
08854
0.00
No
1
2
8
K
23.15

NOTE: 5.3kg is now 8kg.

I then changed the item to 100kg to test it and it returned:

0.00
0.00
K2P2N2
08854
0.00
No
3
2
36
K
80.39

NOTE: Service=3 and quantity=3 but I only have 1 item in my cart.

I looked at my UPS module, and it shows the same. Seems to be an issue with zencart and not the module.

I am going to post this as a bug and see what they say.

17 Sep 2009, 9:34 PM
#20
breck avatar

breck

Zen Follower

Join Date:
Sep 2007
Posts:
106
Plugin Contributions:
0

Re: Need help with Canpar...

Fixed it.

Go to Configuration>Shipping/Packaging menu.

Change:

Enter the Maximum Package Weight you will ship
Change to 500 or 1000 or whatever you choose.
If you have it set to max 50, and your order weight is 110, it changes it to 3 pieces and averages out the weight. This will cause under estimated prices.

Package Tare Small to Medium - added percentage:weight
Leave it blank or if you change it, it adds to weight which increases price.

Larger packages - added packaging percentage:weight
Same as line above.