See if this works for you ...
Edit the file:
/includes/modules/shipping/usps.php
and add the code in
RED:
Code:
function quote($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes, $currencies, $shipping;
// bof: Allow individual Products to use Flat disable USPS
// set allowed products_id 12, 13, 15
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','13');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_cart == $_SESSION['cart']->count_contents()) {
// allow flat rate only disable USPS
return;
}
// eof: Allow individual Products to use Flat disable USPS
//echo 'USPS function quote BEFORE IF $this->enabled $this->uspsQuote $this->enabled: ' . ($this->enabled ? ' ON' : ' OFF') . ' $shipping_weight: ' . $shipping_weight . '<br>';
$usps_shipping_quotes = '';
Then edit the code:
/includes/modules/shipping/flat.php
and add the code in
RED:
Code:
function quote($method = '') {
global $order;
// bof: Allow individual Products to use Flat
// set allowed products_id 12, 13, 15
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','13');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_cart == $_SESSION['cart']->count_contents()) {
// allow flat rate
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
'cost' => MODULE_SHIPPING_FLAT_COST)));
} else {
// skip flat rate
}
// eof: Allow individual Products to use Flat
if ($this->tax_class > 0) {
Just change the products_id 12, 13, 15 to the products_id values that you need and you can add extra products_id values ...
Bookmarks