Results 1 to 10 of 46

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Posts
    3
    Plugin Contributions
    0

    Default Media Mail Option

    I'm trying to figure out how to add a USPS Media Mail option to my cart for books.

    I found this thread which is exactly what I want to do
    http://www.zen-cart.com/forum/showth...ght=media+mail
    using the following code,

    Code:
             if ($type == 'MEDIA' && $_SESSION['cart']->in_cart_check('master_categories_id','10') != $_SESSION['cart']->count_contents()) {
                // skip MEDIA when whole cart is not from master_categories_id 10
              } else {
              $methods[] = array('id' => $type,
                                 'title' => $title,
                                 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
              }
    but I seem to be doing something wrong as the media mail option shows up for all sales, not just those restricted to the master_category_id. I'm sure I'm inserting the correct master category id, but I'm not sure I'm placing the code in the correct place in the usps.php file.

    So could someone please tell me where exactly the code should be placed in the file?

    Thanks for your help.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Media Mail Option

    I added your code to my site and when categories_id 10 products, tested via the master_categories_id is equal to the full count of items I get the Media choice and when they are not equal I do not get the Media choice ...

    Make sure that you uploaded your changes to the right directory and that master_categories_id is actually 10 in the products table ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Feb 2008
    Posts
    3
    Plugin Contributions
    0

    Default Re: Media Mail Option

    Thanks for your quick response, but where exactly do I place the code in the file? The file has a lot of code and I've tried placing it at different places sometimes with not very good results.

    Thanks so much for your help.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Media Mail Option

    In the USPS shipping module, around line 209, you find the code:
    Code:
              $methods[] = array('id' => $type,
                                 'title' => $title,
                                 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
    So you are adding your code for the IF around that piece of code and changing it ...

    Code:
             if ($type == 'MEDIA' && $_SESSION['cart']->in_cart_check('master_categories_id','10') != $_SESSION['cart']->count_contents()) {
                // skip MEDIA when whole cart is not from master_categories_id 10
              } else {
              $methods[] = array('id' => $type,
                                 'title' => $title,
                                 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
              }
    That will allow MEDIA to show only when ALL Products in the shopping cart are using master_categories_id 10 ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Feb 2008
    Posts
    3
    Plugin Contributions
    0

    Default Re: Media Mail Option

    Thank you so much - it works! You are awesome!

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Media Mail Option

    Thanks for the update that this is now working for you ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. v139h USPS Media Mail problem.
    By Beau91324 in forum Addon Shipping Modules
    Replies: 4
    Last Post: 8 Jul 2014, 08:50 PM
  2. v150 USPS Module RateV3 -- trying to integrate Media Mail eligible option
    By jaheadlee in forum Addon Shipping Modules
    Replies: 1
    Last Post: 24 Jul 2012, 10:59 PM
  3. Media mail surcharge
    By Arunachala in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 13 Jun 2011, 01:42 AM

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