
Originally Posted by
lat9
... and what are "the statements that should be able to find it"?
I'm still using the old usps.php module, since it includes filters that I set up years ago. I have not been able to figure out how to add those filters to the new code, or I'd have already done that. I'll list a couple of lines of the code below, but it is working just fine for every single product id that I add, except for one. The only thing I can think of is that there is some invisible character in the product id that's causing it not to be recognized. I've confirmed that I can substitute any other product id in our inventory, and the code does as it always has done for those id's, just not for this one particular item.
Code:
//bof: example to block USPS PriorityMailTM Flat Rate Padded Envelope when certain products are in the cart
if (true) {
$chk_cart_env = 0;
$chk_cart_env += $_SESSION['cart']->in_cart_check('master_categories_id','1'); // Golden paste
$chk_cart_env += $_SESSION['cart']->in_cart_check('master_categories_id','2'); // spices
$chk_cart_env += $_SESSION['cart']->in_cart_check('master_categories_id','3'); // accessories
$chk_cart_env += $_SESSION['cart']->in_cart_check('master_categories_id','5'); // livestock feed
$chk_cart_env += $_SESSION['cart']->in_cart_check('master_categories_id','10'); // oils
$chk_cart_env += $_SESSION['cart']->get_quantity('76') > 0; // original bar
$chk_cart_env += $_SESSION['cart']->get_quantity('78') > 0; // ginger bars
$chk_cart_env += $_SESSION['cart']->get_quantity('150') > 0; // One of each of the turmeric bars
$chk_cart_env += $_SESSION['cart']->get_quantity('166') > 0; // ChickiBams box of 20
$chk_cart_env += $_SESSION['cart']->get_quantity('167') > 0; // WhamBams box of 20
$chk_cart_env += $_SESSION['cart']->get_quantity('168') > 0; // GingiBams box of 20
$chk_cart_env += $_SESSION['cart']->get_quantity('161') > 0; // PawSkin
$chk_cart_env += $_SESSION['cart']->get_quantity('171') > 0; // Snack Pack
This works to prevent the customer from choosing a flat rate padded envelope for every single product code except the last one in the list. No matter what I do, that one is being ignored. I need to know what product id the code is actually finding there so hopefully I can tell why it's falling through the last statement with a zero value when the quantity is greater than zero. And yes, I'm aware that there is no ending curly brace, This is just a snippet.
Bookmarks