To control when Media mail is available for when the shopping cart contains only Products from specific master_categories_id you can edit the module:
/includes/modules/shipping/usps.php
and add to code in RED around line 370:
Code:
// eof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart
// bof: Media for specific master_categories_id
$media_categories = 0;
$media_categories += $_SESSION['cart']->in_cart_check('master_categories_id','10');
$media_categories += $_SESSION['cart']->in_cart_check('master_categories_id','12');
if ($_SESSION['cart']->count_contents() != $media_categories) {
$skip_media = true;
} else {
$skip_media = false;
}
// bof: Media for specific master_categories_id
for ($i=0; $i<$PackageSize; $i++) {
and the code around line 629 in RED:
Code:
//echo '<br />USPS info: ' . '<br />$type: ' . $type . '<br />$type_rebuilt: ' . $type_rebuilt . '<br />$title: ' . $title . ' $cost: ' . $cost . '<br />';
// bof: Media for specific master_categories_id
if ($skip_media && preg_match('#MEDIA#i', $type)) {
continue;
}
// eof: Media for specific master_categories_id
if ($this->usps_countries == 'US' && MODULE_SHIPPING_USPS_FIRST_CLASS_FILTER_US == 'True' && preg_match('#First\-Class#i', $type) && $cnt_first > 1) continue;
Just change or add the master_categories_id for:
Code:
$media_categories += $_SESSION['cart']->in_cart_check('master_categories_id','10');
to the ones you need and add additional ones if needed ...
Bookmarks