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:
// 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) {
Linda McGrath
If you have to think ... you haven't been zenned ...
**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!