Zen Cart Logo
Forums / Addon Shipping Modules / zencart plays with my shipping data -Canpar

zencart plays with my shipping data -Canpar

Locked

Views: 1,166

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
15 Sep 2009, 4:00 PM
#1
luxifer avatar

luxifer

New Zenner

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

zencart plays with my shipping data -Canpar

I've heard other people going through similar problems, and the fixes all seem to be just workarounds, so I'm going to give an explicit case and try to get a real solution.

Zen Cart 1.3.8a Patch: 1. with Canpar shipping module.

I can post the code, if you like, but it basically writes a url requesting shipping data, and then gets the XML response.

If I do this by hand, I get an XML with the correct pricing. But if I let the form do it, I get a totally unrelated price and there is NO logic to it.

I have the Package Tares set to 0:0, nothing fancy. I just want it to use the information it gets back from the XML and not play with it. How can I do this?

Thanks in advance.
P.S. an otherwise excellent product, it's just that this is driving me nuts.

15 Sep 2009, 4:26 PM
#2
luxifer avatar

luxifer

New Zenner

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

Re: zencart plays with my shipping data -Canpar

Just so you can see what I'm doing, the guts of the shipping module are thus:

//Connect to CanPar here to get quote, and parse XML.
      $request = join('&', array('service=1',
                                 'quantity=' . $shipping_num_boxes,
                                 'unit=K',  //Weight is in Kilos
                                 'origin=' . $srcFSA, //postal code of the store
                                 'dest=' . $desFSA,  //postal code of the buyer
                                 'cod=0',  //no COD charges
                                 'weight=' . intval($shipping_weight), //Interger weight
                                 'put=0',
                                 'xc=0',
                                 'dec=0'));
		
	  $body = file_get_contents('http://www.canpar.com/CanparRateXML/BaseRateXML.jsp?' . $request);
      $body_array = explode("<BaseRate>", $body);

      $ShippingCost = $body_array[1];
      $ShippingCost = ereg_replace('</BaseRate></CanparCharges></CanparRate>', '', $ShippingCost);

This writes a URL something like:

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  

if I write my own url, I will get back XML data like this:

<?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>0.00</COD>

            <Declared>0.00</Declared>

            <Origin>M4X1W7</Origin>

            <Destination>L4Y2N9</Destination>

            <ExtraCare>0.00</ExtraCare>

            <PUT>No</PUT>

            <Quantity>1</Quantity>

            <ServiceType>1</ServiceType>

            <Weight>10</Weight>

            <Unit>K</Unit>

      </CanparShipment>

      <CanparCharges>

            <BaseRate>[B]8.65[/B]</BaseRate>

      </CanparCharges>

</CanparRate>

and yet, Zencart will NEVER give me a value of 8.65 for shipping.