If you're using USPS K11a, then including a modified version of the autoloaded observer example (present in the zip-files /extras sub-directory) should disable media-mail unless all products in the cart are from category 15:
Code:
case 'NOTIFY_USPS_UPDATE_OR_DISALLOW_TYPE':
// -----
// Disallow "Media Mail" unless all products in the cart have their master_categories_id within category 15.
//
if (stripos($p1, 'Media Mail') !== false) {
$chk_media = 0;
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id', '15');
if ($chk_media == $_SESSION['cart']->count_contents()) {
$p2 = false;
}
}
break;
If that books category contains sub-categories, you'll need to add additional lines to check for the presence of each of the sub-categories.
Bookmarks