Jump to content

USPS, unable to disable postcard shipping


sparky5693

Recommended Posts

Starting this morning, if I have first class enabled, first class mail postcards is also on. Very heavy orders now how the option to choose postcard shipping. I noticed that USPS updated their API this morning, could this have something to do with it? Is there a way I can entirely remove the postcard shipping, as I'll never use this in my store. Currently the only way I can remove it is to disable ALL first class shipping. 

Link to comment
Share on other sites

The USPS module uses CubeCart's Request class which may log the response for a rate quote.

 

Please view the admin Request Log for an entry for a USPS rate quote and reproduce it here. We may be able to edit the USPS module shipping calculator to remove the postcard rate.

Link to comment
Share on other sites

Request Sent - http://production.shippingapis.com/ShippingAPI.dllAPI=RateV4&XML=<RateV4Request USERID="872WWWTH7071"> <Package ID="0"> <Service>ALL</Service> <ZipOrigination>24523</ZipOrigination> <ZipDestination>24523</ZipDestination> <Pounds>1</Pounds> <Ounces>5</Ounces> <Container>VARIABLE</Container> <Size>REGULAR</Size> <Machinable>False</Machinable> <ReturnLocations>TRUE</ReturnLocations> </Package> </RateV4Request>
Response received<?xml version="1.0" encoding="UTF-8"?> <RateV4Response><Package ID="0"><ZipOrigination>24523</ZipOrigination><ZipDestination>24523</ZipDestination><Pounds>1</Pounds><Ounces>5</Ounces><Size>REGULAR</Size><Machinable>FALSE</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>19.15</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>19.15</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.95</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="0"><MailService>First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Postcards</MailService><Rate>0.34</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail Parcel</MailService><Rate>3.17</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail Parcel</MailService><Rate>3.02</Rate></Postage></Package></RateV4Response>
Link to comment
Share on other sites

I've been looking for a up-to-date list of the CLASSID values and the <MailService> those values relate to.

 

In the meantime, what happens when you disable the Domestic Service named "First Class"? The USPS Control Panel identifies this service as CLASSID=0, which is what the USPS Response says is now named "First-Class Mail Postcards" at $0.34.

Link to comment
Share on other sites

International First Class is messed up, too. Almost all of our items are 10 ounces or less, and customers usually only order one item. When I test with an International address, there are NO shipping choices when only USPS shipping is enabled.

 

For the time being I have By Weight AND USPS enabled, with First Class on USPS disabled. That provides a choice list for the customers with First Class coming from By Weight for Domestic and International. The Priority Mail choices come from USPS for Domestic, but customers are not getting any International Priority Choices showing.

 

(I have posted an urgent request for help on this with CC GitHub)

Link to comment
Share on other sites

I've been looking for a up-to-date list of the CLASSID values and the <MailService> those values relate to.

 

In the meantime, what happens when you disable the Domestic Service named "First Class"? The USPS Control Panel identifies this service as CLASSID=0, which is what the USPS Response says is now named "First-Class Mail Postcards" at $0.34.

When I disable the domestic service "first class", the postcard option is disabled. I've shifted our store to only use priority shipping for the time being, This has decreased orders, but at least I don't lose all our profit in a shipping error.

Link to comment
Share on other sites

From a USPS Update to the Web API document dated July 2013, the USPS is using the same CLASSID code for several First Class services:

CLASSID  Service
0        First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Large Envelope       
0        First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Letter       
0        First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Parcel       
0        First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Postcards

I assume the names have changed a bit since then.

So the question I now have is:
Is there someone whose Response Log for a rate quote contains and entry that has more than one <Postage CLASSID="0"> section?

If there is such a response, please try this edit in /modules/shipping/USPS/shipping.class.php, near line 151:

Was:
foreach($xml->Package->Postage as $option){
  if($this->_settings['class_id_'.$option['CLASSID']]) {
    $package[] = array(

Now:
foreach($xml->Package->Postage as $option){
  if($this->_settings['class_id_'.$option['CLASSID']]) {
    if(strpos((string)$this->cleanName((string)$option->MailService),'Postcards') !== false) continue;
    $package[] = array(

Again, assuming the USPS response includes more than just Postcards for First Class, and assuming you don't want to ship your package stapled to a postcard, try this and let us know.

Link to comment
Share on other sites

Here's a piece of a test order with only USPS, where the customer chose First Class Parcel. It has TWO entries with CLASSID="0"

 

<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="0"><MailService>First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Parcel</MailService><Rate>2.50</Rate></Postage><Postage CLASSID="0"><MailService>First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Postcards</MailService><Rate>0.34</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail Parcel</MailService><Rate>2.69</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail Parcel</MailService><Rate>2.56</Rate></Postage></Package></RateV4Response>

 

I made your suggested edit to shipping.class.php and did NOT get the postcard choice, as hoped. Here's part of the response:

 

<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="0"><MailService>First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Parcel</MailService><Rate>2.50</Rate></Postage><Postage CLASSID="0"><MailService>First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Postcards</MailService><Rate>0.34</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail Parcel</MailService><Rate>2.69</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail Parcel</MailService><Rate>2.56</Rate></Postage></Package></RateV4Response>

 

BUT the problem for me, at least, is that NO International shipping choices are available to the customer when only USPS module is in use. There's just a dash where there should be a price.

 

So here's the response I get from an International customer attempt:

 

Request Sent - http://production.shippingapis.com/ShippingAPI.dll API=IntlRateV2&XML=<IntlRateV2Request USERID="521DIRTY0492"> <Package ID="0"> <Pounds>0</Pounds> <Ounces>4</Ounces> <Machinable>false</Machinable> <MailType>Package</MailType> <ValueOfContents>4.80</ValueOfContents> <Country>Great Britain</Country> <Container>VARIABLE</Container> <Size>REGULAR</Size> <Width>10</Width> <Length>10</Length> <Height>10</Height> <Girth/> </Package> </IntlRateV2Request>
Response received <?xml version="1.0" encoding="UTF-8"?> <IntlRateV2Response><Package ID="0"><Error><Number>-2147218043</Number><Source>;IntlRateV2.ProcessRequest</Source><Description>Unable to calculate international postage. No services available. Invalid Country Name</Description><HelpFile/><HelpContext/></Error></Package></IntlRateV2Response>
Link to comment
Share on other sites

I can get an International choice when I add the By Weight plugin. I hurredly put it together, so I'm not seeing International choices as I expected. but at least I get something!

 

Here's the response from that with a UK address:

 

 

Request Sent - http://production.shippingapis.com/ShippingAPI.dll API=IntlRateV2&XML=<IntlRateV2Request USERID="521DIRTY0492"> <Package ID="0"> <Pounds>0</Pounds> <Ounces>11</Ounces> <Machinable>false</Machinable> <MailType>Package</MailType> <ValueOfContents>20.00</ValueOfContents> <Country>Great Britain</Country> <Container>VARIABLE</Container> <Size>REGULAR</Size> <Width>10</Width> <Length>10</Length> <Height>10</Height> <Girth/> </Package> </IntlRateV2Request>
Response received <?xml version="1.0" encoding="UTF-8"?> <IntlRateV2Response><Package ID="0"><Error><Number>-2147218043</Number><Source>;IntlRateV2.ProcessRequest</Source><Description>Unable to calculate international postage. No services available. Invalid Country Name</Description><HelpFile/><HelpContext/></Error></Package></IntlRateV2Response>
Link to comment
Share on other sites

Looking at the USPS site, I do not find any reference to the UK as simply "Great Britain", but rather "Great Britain and Northern Ireland".

 

So, on the off-chance that this is correct, in the shipping.class.php file, near line 35:

Was:
        if($name == "United Kingdom") {
            return "Great Britain";
 
Now:
        if($name == "United Kingdom") {
            return "Great Britain and Northern Ireland";
Link to comment
Share on other sites

  • 1 month later...

It's funny.. testing this now USPS returns mail services that don't exist in their documentation. 

 

Brian quoted;

First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Letter

From my testing the following is returned;

First-Class Mail&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt; Stamped Letter
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...