This is my first post so please forgive me if I don't have the protocol down. I have installed the module re: above, and it works great. I integrated some the Priority Mail flat rate boxes based on weight of package, all good, and am now trying to do a test during the quote process to see if a shipment is eligible for media mail shipping. I added a field to the products table called 'product_media_mail_eligible', and added it to the Product set up page for the only two product types I use -- regular product and music product. All that is working great. Now, I am setting up the test in usps.php. Below is the code:
Code:
// bof: test for media mail eligible
$cart_count = $_SESSION['cart']->count_contents();
$chk_products = 0;
$chk_products += $_SESSION['cart']->in_cart_check('product_media_mail_eligible','1');
if ($type == "MEDIA" && $cart_count > 0 && $chk_products = $cart_count) {
echo 'We made it to the methods stuff ' . $type;
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? $usps_handling_fee * $shipping_num_boxes : $usps_handling_fee) );
} else {
if($type != "MEDIA") {
// echo ' we are not media mail we are ' . $type;
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? $usps_handling_fee * $shipping_num_boxes : $usps_handling_fee) );
//skip the method
} else {
echo 'we ARE MEDIA MAIL AND SHOULDN"T DO ANYTHING!!!' . $type;
}
}
The line that isn't working is if ($type == "MEDIA" && $cart_count > 0 && $chk_products = $cart_count)
I've tried parentheses around each test and verified that the test was right (I think ) and either can get media mail to NEVER show up even when it should or always show up even when it shouldn't. The only change is those parentheses! But nothing is working. My coding is really rusty I will admit, and it was never php in the past, so it could be as simple as breaking syntax rules. But I'm stumped. Please help!!
Bookmarks