These will check for what the products_type are in the cart ...
Let's assume you are testing for products_type 1 and 2 ...
Type 1 only in cart:
Code:
// bof: check products type for products_type 1 only
if (!IS_ADMIN_FLAG) {
global $cart;
$chk_products_in_cart_type1 = 0;
$chk_products_in_cart_type1 = $_SESSION['cart']->in_cart_check('products_type', '1');
$full_count = $_SESSION['cart']->count_contents();
if ($chk_products_in_cart_type1 > 0 && $full_count == $chk_products_in_cart_type1) {
$this->enabled = true;
} else {
$this->enabled = false;
}
}
// eof: check products type for products_type 1 only
Type 2 only in cart:
Code:
// bof: check products type for products_type 2 only
if (!IS_ADMIN_FLAG) {
global $cart;
$chk_products_in_cart_type2 = 0;
$chk_products_in_cart_type2 = $_SESSION['cart']->in_cart_check('products_type', '2');
$full_count = $_SESSION['cart']->count_contents();
if ($chk_products_in_cart_type2 > 0 && $full_count == $chk_products_in_cart_type1) {
$this->enabled = true;
} else {
$this->enabled = false;
}
}
// eof: check products type for products_type 2 only
Type 1 and 2 in the cart:
Code:
// bof: check products type for products_type 1 and products_type 2
if (!IS_ADMIN_FLAG) {
global $cart;
$chk_products_in_cart_type1 = 0;
$chk_products_in_cart_type2 = 0;
$chk_products_in_cart_type1 = $_SESSION['cart']->in_cart_check('products_type', '1');
$chk_products_in_cart_type2 = $_SESSION['cart']->in_cart_check('products_type', '2');
$full_count = $_SESSION['cart']->count_contents();
if ($chk_products_in_cart_type1 > 0 && $chk_products_in_cart_type2 > 0 ) {
$this->enabled = true;
} else {
$this->enabled = false;
}
}
// eof: check products type for products_type 1 and products_type 2
To use them, let's say you were customizing flat.php, you would place the piece of code you need under the code:
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);
}