in_cart() works on the complete product-id value. And if you've got attributes on the product, the hash code after the main product number is also part of the in_cart() search.
So, if the product-id assigned by the cart after selecting attribute combinations is 115:58203828a348f838e8f8d8c then testing in_cart(115) will fail.
Instead, you'll need to get $_SESSION['cart']->get_products() into a variable, and then loop through the array of products dumped into that variable, and find a match on the number you're looking for, perhaps using (int) to force the removal of the hash when doing your comparison. (Can't use (int) on the parameters to in_cart() calls because that's going the opposite direction to what you're seeking.)


Reply With Quote
