
Originally Posted by
Justwade
I forget how to make a direct link but here is a quote with date stamp. The only change we made in /includes/modules/shipping/usps.php is change 'false" to 'true' as she described below. Worked perfect then and the later versions as I recall. But no other shipping is available which is okay.
I've opened a GitHub issue (https://github.com/lat9/usps/issues/17) to track these changes in a subsequent USPS shipping-module release.
The change will be twofold.
First, edit /includes/modules/shipping/usps.php, making the highlighted changes:
Code:
protected function _getQuote()
{
global $order, $shipping_weight, $currencies;
$package_id = 'USPS DOMESTIC RETURNED: ' . "\n";
// -----
// Force GroundOnly results in USPS Retail Ground only being offered. See the shipping-module's
// language file for additional information.
//
$usps_groundonly = '';
if (MODULE_SHIPPING_USPS_GROUNDONLY == 'force' || (MODULE_SHIPPING_USPS_GROUNDONLY == 'true' && $_SESSION['cart']->in_cart_check('products_groundonly', '1'))) {
$usps_groundonly = '<Content><ContentType>HAZMAT</ContentType></Content><GroundOnly>true</GroundOnly>';
}
and then create/edit a template-override of the shipping-module's language file, e.g. /includes/languages/english/modules/shipping/YOUR_TEMPLATE/usps.php, changing that 'soft' configuration value to 'force':
Code:
// -----
// Identifies whether/not a check for the database field 'products::products_groundonly' should be made. If any products
// in the cart have that field set to '1', then the shipping request will indicate 'HAZMAT' contents and the
// shipping type will be forced to USPS Ground. Valid values are 'true', 'false' (the default) or 'force' to force the USPS Ground shipping.
//
// NOTE: Setting this value to 'true' if that field doesn't exist in your database will result in a fatal MySQL error
// when the quote-request is made.
//
if (!defined('MODULE_SHIPPING_USPS_GROUNDONLY')) define('MODULE_SHIPPING_USPS_GROUNDONLY', 'force');
Bookmarks