I have a magento store that needs to be able to ship orders to Curacao. By default this is grouped as Netherland Antilles in Magento, however, I found that even setting the order to this, wont get me the correct shipping rates from USPS even though international shipping is enabled.
I have added the country to magento via the en.xml file, and through the admin. I have enabled it as a country we can ship to under the USPS shipping method, and in the directory_country table in magento.
When the USPS API is called, I see this as a request and result:
2015-11-30T22:08:15+00:00 DEBUG (7): Array
(
[request] => <?xml version="1.0" encoding="UTF-8"?>
<IntlRateV2Request USERID="725CIGAR7315"><Revision>2</Revision><Package ID="0"><Pounds>0</Pounds><Ounces>0.8</Ounces><MailType>All</MailType><ValueOfContents>1</ValueOfContents><Country/><Container>VARIABLE</Container><Size>REGULAR</Size><Width/><Length/><Height/><Girth/></Package></IntlRateV2Request>
[result] => <?xml version="1.0" encoding="UTF-8"?>
<IntlRateV2Response><Package ID="0"><Error><Number>-2147219080</Number><Source>;IntlRateV2.UnpackIntlRateV2Node</Source><Description>Missing value for Country.</Description><HelpFile/><HelpContext/></Error></Package></IntlRateV2Response>
[__pid] => 2786
)
Notice the empty Country tag in the request. I have dug through the code, and see where the country is supposed to be set via the app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php file.
Of course, I have to override this file (not edit core magento directly) which i have done, but still I cannot get the Country tag to populate on the send. I added this to the setRequest function:
Mage::log("Destination Country: ");
Mage::log($request->getDestCountryId());
if ($request->getDestCountryId()) {
$destCountry = $request->getDestCountryId();
} else {
$destCountry = self::USA_COUNTRY_ID;
}
$r->setDestCountryId($destCountry);
This outputs in my log "CW" which is the correct country code for the transaction, based on my DB settings. So what gives? Why doesnt the country code get passed to the API so I can get some pricing?
I figure this isnt a new issue, and that Im probably looking over something painfully obvious, so I was hoping someone out there can point me in the right direction as I am currently "stumped".
Thanks in advance!