Jump to content

Resolved - USPS Canada Parcel Rate Zone Change causing issue??


Dirty Butter

Recommended Posts

One of my test shipping addresses is to Canada. Just noticed that there us an extra s/h price choice on Checkout that only shows my handling charge. It has NO shipping choice name by it.

Here's part of the Request Log:

All</ExpressMail><AreasServed>Please reference Express Mail for Areas Served.</AreasServed><AdditionalRestrictions>No Additional Restrictions Data found.</AdditionalRestrictions><Service ID="12"><Pounds>1</Pounds><Ounces>0</Ounces><Machinable>true</Machinable><MailType>Package</MailType><Container>VARIABLE</Container><Size>REGULAR</Size><Width>10</Width><Length>10</Length><Height>10</Height><Girth>0.0</Girth><Country>CANADA</Country><Postage>65.75</Postage><ExtraServices><ExtraService><ServiceID>1</ServiceID><ServiceName>Insurance</ServiceName><Available>True</Available><Price>0.00</Price></ExtraService></ExtraServices><ValueOfContents>100.00</ValueOfContents><SvcCommitments>1 - 3 business days to many major markets</SvcCommitments><SvcDescription>USPS GXG&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Envelopes</SvcDescription><MaxDimensions>USPS-Produced regular size cardboard envelope (12-1/2" x 9-1/2"), the legal-sized cardboard envelope (15" x 9-1/2") and the GXG Tyvek envelope (15-1/2" x 12-1/2")</MaxDimensions><MaxWeight>70</MaxWeight></Service><Service ID="1"><Pounds>1</Pounds><Ounces>0</Ounces><Machinable>true</Machinable><MailType>Package</MailType><Container>VARIABLE</Container><Size>REGULAR</Size><Width>10</Width><Length>10</Length><Height>10</Height><Girth>0.0</Girth><Country>CANADA</Country><Postage>41.75</Postage><ExtraServices><ExtraService><ServiceID>1</ServiceID><ServiceName>Insurance</ServiceName><Available>True</Available><Price>0.00</Price></ExtraService></ExtraServices><ValueOfContents>100.00</ValueOfContents><SvcCommitments>3 - 5 business days to many major markets</SvcCommitments><SvcDescription>Priority Mail Express International&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</SvcDescription><MaxDimensions>Max. length 42", max. length plus girth combined 79"</MaxDimensions><MaxWeight>66</MaxWeight></Service><Service ID="15"><Pounds>1</Pounds><Ounces>0</Ounces><Machinable>true</Machinable><MailType>Package</MailType><Container>VARIABLE</Container><Size>REGULAR</Size><Width>10</Width><Length>10</Length><Height>10</Height><Girth>0.0</Girth><Country>CANADA</Country><Postage>11.75</Postage><ExtraServices/><ValueOfContents>100.00</ValueOfContents><InsComment>SERVICE</InsComment><SvcCommitments>Varies by destination</SvcCommitments><SvcDescription>First-Class Package International Service&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</SvcDescription><MaxDimensions>Other than rolls: Max. length 24", max length, height and depth (thickness) combined 36"&lt;br>Rolls: Max. length 36". Max length and twice the diameter combined 42"</MaxDimensions><MaxWeight>4</MaxWeight></Service><Service ID="2"><Pounds>1</Pounds><Ounces>0</Ounces><MailType>Package</MailType><Container>VARIABLE</Container><Size>REGULAR</Size><Width>10</Width><Length>10</Length><Height>10</Height><Girth>0.0</Girth><Country>CANADA</Country><Postage>0.00</Postage><ExtraServices><ExtraService><ServiceID/><ServiceName/><Available>False</Available><Price/></ExtraService></ExtraServices><ServiceErrors><ServiceError><Id>50050</Id><Description>The Origin ZIP Code and the Destination Postal Code is required for Priority Mail International when mailing to Canada.</Description></ServiceError></ServiceErrors></Service></Package></IntlRateV2Response>

 I know USPS has changed to Zone charges for US to CA. I tried the same address on the Calculate a Price page of usps.com, and it asks for the From and To Zip codes for Canada now.

Here's the screenshot of this odd Checkout:canadashippingissue.thumb.jpg.55dd2fc153

Edited by Dirty Butter
Link to comment
Share on other sites

Ok, so we have:

Service ID=1: Priority Mail Express International
Service ID=2: <Error>
Service ID=12: USPS GXG Envelopes
Service ID=15: First-Class Package International

The Origin ZIP Code and the Destination Postal Code is required for Priority Mail International when mailing to Canada.

Link to comment
Share on other sites

Unchecked, cleared all cache, emptied basket, and logged out of customer I was in store as. Tried same thing, used Shipping Estimate this time for same Canada address - got same results. When I use another country address I do not get this issue. So it has to be something to do with this recent postal change to Zone charges for Canada.

The Parcel rate is there, but it's AFTER this weird handling choice.

Link to comment
Share on other sites

In the USPS module's shipping.class.php file, make the following edit near the middle of the file:

/* NEW */	$xml->writeElement('OriginZip',$this->_settings['ziporigin']);
/* NEW */	// $xml->writeElement('DestinationPostalCode',trim($delivery['postcode']));

		}
		$xml->endElement(); ## End Package
		$xml->endElement(); ## End RateV4Request

		## Send request
		$request	= new Request($this->_url, $this->_path);

 

Link to comment
Share on other sites

When I went through the online Calculate Postage for the same Canadian address I had to input the destination zip. Of course at that point they give you ALL the shipping choices, so for Priority it would have been needed. So I tried uncommenting your line, but it still throws the error message.

Link to comment
Share on other sites

Request Sent - http://production.shippingapis.com/ShippingAPI.dll API=RateV4&XML=<RateV4Request USERID="521DIRTY0492"> <Package ID="0"> <Service>ALL</Service> <ZipOrigination>35178</ZipOrigination> <ZipDestination>35178</ZipDestination> <Pounds>1</Pounds> <Ounces>0</Ounces> <Container>VARIABLE</Container> <Size>REGULAR</Size> <Machinable>True</Machinable> <ReturnLocations>TRUE</ReturnLocations> </Package> </RateV4Request>
Response received <?xml version="1.0" encoding="UTF-8"?> <RateV4Response><Package ID="0"><ZipOrigination>35178</ZipOrigination><ZipDestination>35178</ZipDestination><Pounds>1</Pounds><Ounces>0</Ounces><Size>REGULAR</Size><Machinable>TRUE</Machinable><Zone>1</Zone><Postage CLASSID="3"><MailService>Priority Mail Express 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</MailService><Rate>17.95</Rate></Postage><Postage CLASSID="2"><MailService>Priority Mail Express 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Hold For Pickup</MailService><Rate>17.95</Rate></Postage><Postage CLASSID="55"><MailService>Priority Mail Express 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Flat Rate Boxes</MailService><Rate>44.95</Rate></Postage><Postage CLASSID="56"><MailService>Priority Mail Express 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Flat Rate Boxes Hold For Pickup</MailService><Rate>44.95</Rate></Postage><Postage CLASSID="13"><MailService>Priority Mail Express 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Flat Rate Envelope</MailService><Rate>19.99</Rate></Postage><Postage CLASSID="27"><MailService>Priority Mail Express 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Flat Rate Envelope Hold For Pickup</MailService><Rate>19.99</Rate></Postage><Postage CLASSID="30"><MailService>Priority Mail Express 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Legal Flat Rate Envelope</MailService><Rate>19.99</Rate></Postage><Postage CLASSID="31"><MailService>Priority Mail Express 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Legal Flat Rate Envelope Hold For Pickup</MailService><Rate>19.99</Rate></Postage><Postage CLASSID="62"><MailService>Priority Mail Express 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Padded Flat Rate Envelope</MailService><Rate>19.99</Rate></Postage><Postage CLASSID="63"><MailService>Priority Mail Express 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Padded Flat Rate Envelope Hold For Pickup</MailService><Rate>19.99</Rate></Postage><Postage CLASSID="1"><MailService>Priority Mail 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</MailService><Rate>5.75</Rate></Postage><Postage CLASSID="22"><MailService>Priority Mail 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Large Flat Rate Box</MailService><Rate>17.90</Rate></Postage><Postage CLASSID="17"><MailService>Priority Mail 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Medium Flat Rate Box</MailService><Rate>12.65</Rate></Postage><Postage CLASSID="28"><MailService>Priority Mail 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Small Flat Rate Box</MailService><Rate>5.95</Rate></Postage><Postage CLASSID="16"><MailService>Priority Mail 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Flat Rate Envelope</MailService><Rate>5.75</Rate></Postage><Postage CLASSID="44"><MailService>Priority Mail 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Legal Flat Rate Envelope</MailService><Rate>5.90</Rate></Postage><Postage CLASSID="29"><MailService>Priority Mail 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Padded Flat Rate Envelope</MailService><Rate>6.10</Rate></Postage><Postage CLASSID="38"><MailService>Priority Mail 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Gift Card Flat Rate Envelope</MailService><Rate>5.75</Rate></Postage><Postage CLASSID="42"><MailService>Priority Mail 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Small Flat Rate Envelope</MailService><Rate>5.75</Rate></Postage><Postage CLASSID="40"><MailService>Priority Mail 1-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Window Flat Rate Envelope</MailService><Rate>5.75</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail Parcel</MailService><Rate>2.72</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail Parcel</MailService><Rate>2.59</Rate></Postage></Package></RateV4Response>

It's using RateV4. Shouldn't it be using RateV2?

Link to comment
Share on other sites

Request Sent - http://production.shippingapis.com/ShippingAPI.dll API=IntlRateV2&XML=<IntlRateV2Request USERID="521DIRTY0492"> <Package ID="0"> <Pounds>1</Pounds> <Ounces>0</Ounces> <Machinable>true</Machinable> <MailType>Package</MailType> <ValueOfContents>100.00</ValueOfContents> <Country>Canada</Country> <Container>VARIABLE</Container> <Size>REGULAR</Size> <Width>10</Width> <Length>10</Length> <Height>10</Height> <Girth/> <OriginZip>35178</OriginZip> </Package> </IntlRateV2Request>
Response received <?xml version="1.0" encoding="UTF-8"?> <IntlRateV2Response><Package ID="0"><Error><Number>-2147219045</Number><Source>;IntlRateV2.UnpackIntlRateV2Node</Source><Description>Invalid options requested for this revision of International Rate V2.</Description><HelpFile/><HelpContext/></Error></Package></IntlRateV2Response>
Link to comment
Share on other sites

I know it says some don't need destination zip, but I'm thinking it does, so it can show all possible shipping options I have checked. What if I took the Priority Internationals off to see if that worked?

NO - that didn't work, either. But here's the  log entry:

Request Sent - http://production.shippingapis.com/ShippingAPI.dll API=IntlRateV2&XML=<IntlRateV2Request USERID="521DIRTY0492"> <Package ID="0"> <Pounds>1</Pounds> <Ounces>0</Ounces> <Machinable>true</Machinable> <MailType>Package</MailType> <ValueOfContents>100.00</ValueOfContents> <Country>Canada</Country> <Container>VARIABLE</Container> <Size>REGULAR</Size> <Width>10</Width> <Length>10</Length> <Height>10</Height> <Girth/> <OriginZip>35178</OriginZip> </Package> </IntlRateV2Request>
Response received <?xml version="1.0" encoding="UTF-8"?> <IntlRateV2Response><Package ID="0"><Error><Number>-2147219045</Number><Source>;IntlRateV2.UnpackIntlRateV2Node</Source><Description>Invalid options requested for this revision of International Rate V2.</Description><HelpFile/><HelpContext/></Error></Package></IntlRateV2Response>

 

Edited by Dirty Butter
Link to comment
Share on other sites

First, make this edit:

From:
		/* IMPORTANT NOTE - USPS XML Parser is so totally shitty you have to send the XML elements in the correct order!!??!?! */
		$xml->startElement($this->_api.'Request');
		$xml->writeAttribute('USERID',$this->_settings['username']);
		$xml->startElement('Package');
		$xml->writeAttribute('ID',0);

		## Calculate Lbs/Oz
		$this->weightLbsOz();
		
		// the following should be 'country_id' NOT 'country'!  If you think otherwise, talk to Bill!
		if($delivery['country_id']==$GLOBALS['config']->get('config','store_country')) { // National "RateV4Request"
			$xml->writeElement('Service',"ALL");
			$xml->writeElement('ZipOrigination',$this->_settings['ziporigin']);


To:
		/* IMPORTANT NOTE - USPS XML Parser is so totally shitty you have to send the XML elements in the correct order!!??!?! */
		$xml->startElement($this->_api.'Request');
		$xml->writeAttribute('USERID',$this->_settings['username']);

		## Calculate Lbs/Oz
		$this->weightLbsOz();
		
		// the following should be 'country_id' NOT 'country'!  If you think otherwise, talk to Bill!
		if($delivery['country_id']==$GLOBALS['config']->get('config','store_country')) { // National "RateV4Request"
    		$xml->startElement('Package');
	    	$xml->writeAttribute('ID',0);
			$xml->writeElement('Service',"ALL");
			$xml->writeElement('ZipOrigination',$this->_settings['ziporigin']);

Then, make this edit:

From:
        } else { 
            // International Rates

            $xml->writeElement('Pounds',$this->_lbs);
            $xml->writeElement('Ounces',$this->_oz);


To:
        } else { 
            // International Rates
            $xml->startElement('Package');
            $xml->writeAttribute('ID',0);

            $xml->writeElement('Pounds',$this->_lbs);
            $xml->writeElement('Ounces',$this->_oz);

We have just moved two common statements from the comman area to each of the specific API areas.

Please leave your settings as they were.

Link to comment
Share on other sites

It seems that even though 'OriginZip' is now required, it is still only understood when IntlRateV2 is of Revision 2.

So, make this next edit:

From:
} else { 
            // International Rates
            $xml->startElement('Package');
            $xml->writeAttribute('ID',0);

            $xml->writeElement('Pounds',$this->_lbs);
            $xml->writeElement('Ounces',$this->_oz);


To:
} else { 
            // International Rates
            $xml->writeElement('Revision',2);
            $xml->startElement('Package');
            $xml->writeAttribute('ID',0);
 
            $xml->writeElement('Pounds',$this->_lbs);
            $xml->writeElement('Ounces',$this->_oz);

 

Edited by bsmither
Link to comment
Share on other sites

I put the International Priority choices back, made the edits, and tried again. Still error message.

Request Sent - http://production.shippingapis.com/ShippingAPI.dll API=IntlRateV2&XML=<IntlRateV2Request USERID="521DIRTY0492"> <Package ID="0"> <Pounds>1</Pounds> <Ounces>0</Ounces> <Machinable>true</Machinable> <MailType>Package</MailType> <ValueOfContents>100.00</ValueOfContents> <Country>Canada</Country> <Container>VARIABLE</Container> <Size>REGULAR</Size> <Width>10</Width> <Length>10</Length> <Height>10</Height> <Girth/> <OriginZip>35178</OriginZip> </Package> </IntlRateV2Request>
Response received <?xml version="1.0" encoding="UTF-8"?> <IntlRateV2Response><Package ID="0"><Error><Number>-2147219045</Number><Source>;IntlRateV2.UnpackIntlRateV2Node</Source><Description>Invalid options requested for this revision of International Rate V2.</Description><HelpFile/><HelpContext/></Error></Package></IntlRateV2Response>
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
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...