Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2012
    Posts
    10
    Plugin Contributions
    0

    help question USPS Module RateV3 -- trying to integrate Media Mail eligible option

    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!!

  2. #2
    Join Date
    Jul 2012
    Posts
    10
    Plugin Contributions
    0

    Default Re: USPS Module RateV3 -- trying to integrate Media Mail eligible option

    Argghh! I knew if I did that I would see it right away -- why can't we bypass the embarrassing step?? Anyway, the problem is the test of $chk_products == $cart_count, which of course is not what I had written in the code. And I can't even blame it on php... Thanks for looking!

 

 

Similar Threads

  1. v151 Media Mail restriction mod to new, 3-7-14 usps module, any help?
    By linniedarling in forum Addon Shipping Modules
    Replies: 61
    Last Post: 13 Aug 2023, 01:25 AM
  2. v139h USPS Media Mail problem.
    By Beau91324 in forum Addon Shipping Modules
    Replies: 4
    Last Post: 8 Jul 2014, 08:50 PM
  3. Media Mail Option
    By ozgirl57 in forum Built-in Shipping and Payment Modules
    Replies: 45
    Last Post: 21 Aug 2010, 03:39 AM
  4. Product Customization USPS Media Mail
    By rfloyd in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 30 May 2008, 09:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR