Created
June 24, 2015 18:23
-
-
Save travisulrich/f9bbf611e8d4d1c5728c to your computer and use it in GitHub Desktop.
Update USPS shipping in Lemondstand - Rates to Canada with origin ZIP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IntlRateV2Request USERID="<?= h($user_id) ?>"> | |
<Revision>2</Revision> | |
<Package ID="PACKAGE"> | |
<Pounds><?= h($pounds) ?></Pounds> | |
<Ounces><?= h($ounces) ?></Ounces> | |
<Machinable><?= $machinable ? 'true' : 'false' ?></Machinable> | |
<MailType>Package</MailType> | |
<ValueOfContents><?= $total_price ?></ValueOfContents> | |
<Country><?= $country ?></Country> | |
<? if (strlen($container)): ?> | |
<Container><?= $container ?></Container> | |
<? else: ?> | |
<Container>RECTANGULAR</Container> | |
<? endif ?> | |
<Size>REGULAR</Size> | |
<Width><?= $dimension ?></Width> | |
<Length><?= $dimension ?></Length> | |
<Height><?= $dimension ?></Height> | |
<? if($container == 'NONRECTANGULAR'): ?> | |
<Girth><?= $dimension ?></Girth> | |
<? else: ?> | |
<Girth></Girth> | |
<? endif ?> | |
<OriginZip><?= h($origination_zip) ?></OriginZip> | |
<CommercialFlag>Y</CommercialFlag> | |
</Package> | |
</IntlRateV2Request> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This gist provides instructions for updating the USPS shipping file to accommodate for changes to the USPS API regarding Canadian | |
* shipments on May 31, 2015. As of that date, Canadian shipments require an origin zip code to determine shipping zones/rates. | |
*/ | |
// STEP 1: Update the get_quote() function in modules/shop/shipping_types/shop_uspsshipping.php to set the origination | |
$request_doc = $this->format_xml_template('international.xml', array( | |
'user_id'=>$host_obj->api_user_id, | |
'pounds'=>$pounds, | |
'ounces'=>$ounces, | |
'machinable'=>$host_obj->machinable, | |
'container'=>$host_obj->intl_container, | |
'total_price' => $total_price, | |
'dimension' => $dimension, | |
'country'=>mb_strtoupper($usps_country_name), | |
'origination_zip'=>$shipping_params->zip_code | |
)); | |
// STEP 2: Add lines 2 and 24 to international.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist provides instructions for updating the USPS shipping file to accommodate for changes to the USPS API regarding Canadian shipments on May 31, 2015. As of that date, Canadian shipments require an origin zip code to determine shipping zones/rates.