Hi, I have read through all the posts and have been testing for few days but still can't a solution. Could someone please help me with my code?
I have 3 Zone Rate, singpost, pos_malaysia and singpost_plus_posmalaysia
1. singpost - enable for all categories except cat #20
PHP Code:
// bof: disable for these master_categories_id
if (IS_ADMIN_FLAG == false) {
// check master_categories_id add one line per master_categories_id
$chk_cat = 0;
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','20');
if ($chk_cat > 0) {
$this->enabled = false;
}
}
// eof: disable for these master_categories_id
2. pos_malaysia - enable when cart only have cat #20
PHP Code:
// bof: disable for these master_categories_id
if (IS_ADMIN_FLAG == false) {
// check master_categories_id add one line per master_categories_id
$chk_cat = 0;
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','2');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','3');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','4');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','6');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','8');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','13');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','14');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','15');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','16');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','17');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','18');
if ($chk_cat > 0) {
$this->enabled = false;
}
}
// eof: disable for these master_categories_id
3. singpost_plus_posmalaysia - mixed cart enable only when cart have cat #20 plus any other cat
PHP Code:
// bof: enable for mixed cart where cat #20 must be present plus any other cat
global $db, $cart;
if (IS_ADMIN_FLAG == false) {
// check master_categories_id add one line per master_categories_id
$chk_cat = 0;
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','2');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','3');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','4');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','6');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','8');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','13');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','14');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','15');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','16');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','17');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','18');
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','20') > 0)&&(IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check($chk_cat ) > 0)) {
$this->enabled = true;
} else{
$this->enabled = false;
}
}
singpost_plus_posmalaysia is working fine if cat #20 plus 1 other cat with quantity of 1 but it will not working when
cat #20 plus more than 2 other cat or cat #20 plus one other cat with quantity of more than 1 . Problem solved if I remove
PHP Code:
else{
$this->enabled = false;
}
but singpost_plus_posmalaysia will appear in all other categories which not suppose to. I am going crazy, any help will be very much appreciated.