You would need to test then, in the Flat Rate flat shipping module to see if the cart only holds products from Category A and B ...
To customize the Flat Rate file add the code to:
/includes/modules/shipping/flat.php
Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
}
// bof: only run Flat Rate if all Products in the cart are from categories_id 10 and 15
if (!IS_ADMIN_FLAG) {
global $cart;
$chk_categories_a = $_SESSION['cart']->in_cart_check('master_categories_id', '10');
$chk_categories_b = $_SESSION['cart']->in_cart_check('master_categories_id', '15');
if ($chk_categories_a + $chk_categories_b != $_SESSION['cart']->count_contents()) {
$this->enabled = false;
}
}
// eof: only run Flat Rate if all Products in the cart are from categories_id 10 and 15
Now for you, customize the categories_id of 10 and 15 to your categories_id for Category A and Category B
Next, for your USPS shipping module, you would use the same code that is in red, but change the categories_id that are being tested to those for Category C and Category D ...
NOTE: while we are wanting to test Products in Category A and B etc. we are using the master_categories_id as that is the categories_id that these Products belong to ... the master_categories_id makes it easier as it is in the products table and there is a handy function to this type of test in the shopping_cart class ...
Bookmarks