Try this ...
Customize the file:
/includes/modules/shipping/fedexwebservices.php
with the code in RED:
Code:
$methods = array();
// bof: check FedEx for > 40.00
$_SESSION['usps_first_class'] = 0;
foreach ($response->RateReplyDetails as $rateReply) {
Code:
$methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType),
'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))) . $transitTime,
'cost' => $cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? ($cost * (float)$this->types[$rateReply->ServiceType]['handling_fee'] / 100) : (float)$this->types[$rateReply->ServiceType]['handling_fee']));
$chk_cost = ($cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? ($cost * (float)$this->types[$rateReply->ServiceType]['handling_fee'] / 100) : (float)$this->types[$rateReply->ServiceType]['handling_fee']));
if ($_SESSION['usps_first_class'] == 0 || $chk_cost < $_SESSION['usps_first_class']) {
$_SESSION['usps_first_class'] = $chk_cost;
}
//echo 'FedEx Cost Calc: ' . $chk_cost . ' $_SESSION[usps_first_class]: ' . $_SESSION['usps_first_class'] . '<br><br>';
// bof: check FedEx for > 40.00
}
}
}
$this->quotes['methods'] = $methods;
Then customize the file:
/includes/modules/shipping/usps.php
Code:
if ($this->usps_countries == 'US' && MODULE_SHIPPING_USPS_FIRST_CLASS_FILTER_US == 'True' && preg_match('#First\-Class#i', $type) && $cnt_first > 1) continue;
// bof: check FedEx for > 40.00
//echo 'USPS FedEx $_SESSION[usps_first_class]: ' . $_SESSION['usps_first_class'] . ' $type: ' . $type . '<br>';
//echo 'USPS $type_rebuilt: ' . $type_rebuilt . '<br>';
if (preg_match('#(first-class)#i', $type_rebuilt) && $_SESSION['usps_first_class'] > 40) {
$methods[] = array('id' => $type_rebuilt,
'title' => $title,
'cost' => $cost,
);
}
// eof: check FedEx for > 40.00
} else {
//echo 'MISSING! USPS $type: ' . $type . (in_array($type, $this->typeCheckboxesSelected) ? ' YES' : ' NO') . ' $method: ' . $method . ' $usps_shipping_weight: ' . $usps_shipping_weight . ' $minweight: ' . $minweight . ' $maxweight: ' . $maxweight . '<br>';
}
} // end for $i to $PackageSize
if (sizeof($methods) == 0) return false;
Be sure that on the Modules ... Shipping ... that you set a Sort Order on FedEx such as 10 and on USPS a Sort Order of 20 so that FedEx runs before USPS for this to work ...
Bookmarks