You can test if a product is in the cart, for example, to see if products_id 12 is in the cart use either:
$chk_cart = $_SESSION['cart']->in_cart_check('products_id','12')
$chk_cart = $_SESSION['cart']->get_quantity('12');
If a product is in the cart, then you can disable a shipping module by setting the $this->enabled to false ...
I do not have the Canada Post module handy, but if you were using UPS, you could use, to disable it when products_id 12 or 37 are in the cart with the following change:
Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_UPS_STATUS == 'True') ? true : false);
}
// bof: do not show if products_id 12 or 37 are in the cart
global $cart;
if (!IS_ADMIN_FLAG) {
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','37');
if ($chk_cart > 0) {
$this->enabled = false;
}
}
// eof: do not show if products_id 12 or 37 are in the cart
if ($this->enabled) {