-
Re: USPS Question
You could use the code:
Code:
global $cart;
$chk_products15 = $_SESSION['cart']->in_cart_check('products_id','15');
$chk_products16 = $_SESSION['cart']->in_cart_check('products_id','16');
$chk_products42 = $_SESSION['cart']->in_cart_check('products_id','42');
$chk_products43 = $_SESSION['cart']->in_cart_check('products_id','43');
$skip_type = false;
if ( ($type == 'Express Mail International (EMS) Flat-Rate Envelope' || $type == 'Priority Mail International Flat-Rate Envelope') && ($chk_products15 + $chk_products16 + $chk_products42 + $chk_products43) > 0) {
$skip_type = true;
}
if ( ($type == 'First Class Mail International Package' ) && ($chk_products42 + $chk_products43) > 0) {
$skip_type = true;
}
if ($skip_type) {
// do not show excluded shipping types
} else {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
-
Re: USPS Question
Thanks a million! Works a charm!
-
Re: USPS Question
Thanks for the update that this customized code works for you ... remember us when you are rich and famous ... :cool:
-
Re: USPS Question
I've tried to change the code somewhat and it still displays the shipping options ive excluded. Any help would be appreciated!
I'm using the newest version of zen-cart and USPS module.
PHP Code:
global $cart;
$chk_products15 = $_SESSION['cart']->in_cart_check('products_id','15');
$chk_products16 = $_SESSION['cart']->in_cart_check('products_id','16');
$chk_products42 = $_SESSION['cart']->in_cart_check('products_id','42');
$chk_products43 = $_SESSION['cart']->in_cart_check('products_id','43');
$chk_products73 = $_SESSION['cart']->in_cart_check('products_id','73');
$chk_products74 = $_SESSION['cart']->in_cart_check('products_id','74');
$chk_products76 = $_SESSION['cart']->in_cart_check('products_id','76');
$chk_products77 = $_SESSION['cart']->in_cart_check('products_id','77');
$chk_products81 = $_SESSION['cart']->in_cart_check('products_id','81');
$chk_products82 = $_SESSION['cart']->in_cart_check('products_id','82');
$chk_products83 = $_SESSION['cart']->in_cart_check('products_id','83');
$chk_products84 = $_SESSION['cart']->in_cart_check('products_id','84');
$skip_type = false;
if ( ($type == 'First-Class Mail International Large Envelope' ||$type == 'First-Class Mail International Package' ||$type == 'Priority Mail International Flat Rate Envelope' ||$type == 'Priority Mail International Small Flat Rate Box' ||$type == 'Express Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box') && ($chk_products15 +$chk_products16 + $chk_products42 + $chk_products43 + $chk_products73 + $chk_products74 + $chk_products76 + + $chk_products77 + $chk_products81 + $chk_products82 $chk_products83 + $chk_products84 +) > 0) {
$skip_type = true;
}
if ( ($type == 'Priority Mail International Medium Flat Rate Box' ) && ($chk_products42 + $chk_products43 + $chk_products74 + $chk_products77 + $chk_products83 + $chk_products84 ) > 0) {
$skip_type = true;
}
if ($skip_type) {
// do not show excluded shipping types
} else {
-
Re: USPS Question
Fix this IF statement:
Code:
if ( ($type == 'First-Class Mail International Large Envelope' || $type == 'First-Class Mail International Package' || $type == 'Priority Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box' || $type == 'Express Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box') && ($chk_products15 + $chk_products16 + $chk_products42 + $chk_products43 + $chk_products73 + $chk_products74 + $chk_products76 + $chk_products77 + $chk_products81 + $chk_products82 + $chk_products83 + $chk_products84) > 0) {
then ... check what the $type is by adding above the two IF statements the line:
Code:
echo 'I SEE TYPE: ' . $type . '<br>';
Make sure that you are testing for the correct spellings ...
-
Re: USPS Question
What's wrong with the IF statement? This is what I did!
PHP Code:
$skip_type = false;
echo 'I SEE TYPE: ' . $type . '<br>';
if ( ($type == 'First-Class Mail International Large Envelope' || $type == 'First-Class Mail International Package' || $type == 'Priority Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box' || $type == 'Express Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box') && ($chk_products15 + $chk_products16 + $chk_products42 + $chk_products43 + $chk_products73 + $chk_products74 + $chk_products76 + $chk_products77 + $chk_products81 + $chk_products82 + $chk_products83 + $chk_products84) > 0) { $skip_type = true;
}
echo 'I SEE TYPE: ' . $type . '<br>';
if ( ($type == 'Priority Mail International Medium Flat Rate Box' ) && ($chk_products42 + $chk_products43 + $chk_products74 + $chk_products77 + $chk_products83 + $chk_products84 ) > 0) {
$skip_type = true;
}
if ($skip_type) {
// do not show excluded shipping types
} else {
Is this what you mean? nothing happened! Most likely its something I did I'd say!
-
Re: USPS Question
Your IF:
Code:
if ( ($type == 'First-Class Mail International Large Envelope' ||$type == 'First-Class Mail International Package' ||$type == 'Priority Mail International Flat Rate Envelope' ||$type == 'Priority Mail International Small Flat Rate Box' ||$type == 'Express Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box') && ($chk_products15 +$chk_products16 + $chk_products42 + $chk_products43 + $chk_products73 + $chk_products74 + $chk_products76 + + $chk_products77 + $chk_products81 + $chk_products82 $chk_products83 + $chk_products84 +) > 0) {
My IF:
Code:
if ( ($type == 'First-Class Mail International Large Envelope' || $type == 'First-Class Mail International Package' || $type == 'Priority Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box' || $type == 'Express Mail International Flat Rate Envelope' || $type == 'Priority Mail International Small Flat Rate Box') && ($chk_products15 + $chk_products16 + $chk_products42 + $chk_products43 + $chk_products73 + $chk_products74 + $chk_products76 + $chk_products77 + $chk_products81 + $chk_products82 + $chk_products83 + $chk_products84) > 0) {
You have extra + signs and missing + signs ...
-
Re: USPS Question
Oops... I see my mistakes! :blush: I changed the IF statement but still no change?
-
Re: USPS Question
Have you an URL to your site that we could perhaps peek at? :smile:
-
Re: USPS Question
You are using the New USPS shipping module for January 4, 2010 correct?
http://www.zen-cart.com/forum/showthread.php?t=144992