Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Aug 2006
    Posts
    33
    Plugin Contributions
    0

    Default USPS First Class Mail Weight Range Change

    I would like to offer USPS First Class mail, but restrict the weight to orders of less than 10 oz or .6249lbs. Essentially preventing it from being offered as an option for orders with weights of 10-13 oz. I would like to achieve this without having to add a tare, or changing product weights. Is there a way to edit the USPS scripts to do this? Any help with this would be greatly appreciated.

    Using Zen 1.3.8a clean.

  2. #2
    Join Date
    Aug 2006
    Posts
    33
    Plugin Contributions
    0

    Default Re: USPS First Class Mail Weight Range Change

    If this cannot be accomplished by modifying the USPS shipping module, could another module such as 'Flat Rate' or 'Free Shipping' be retooled to offer a flat charge for orders under a certain weight?

    I could be missing something, but looking at the existing modules there doesn't seem to be an option to allow this.

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

    Default Re: USPS First Class Mail Weight Range Change

    You should be able to customize the usps.php shipping module by checking the $type against the current quote and skip First Class when the shipping weight is >= .6249 ...

    Seems to work in testing ...
    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!

  4. #4
    Join Date
    Aug 2006
    Posts
    33
    Plugin Contributions
    0

    Default Re: USPS First Class Mail Weight Range Change

    Hey Ajeh, thanks for the quick reply, and cheers for the Alpha sorter the customers love it.

    Any chance you can share the code you used for the test? I'm not quite savvy enough to generate my own.

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

    Default Re: USPS First Class Mail Weight Range Change

    It wouldn't be any fun if I didn't make you beg for it first ...

    Try editing the file:
    /includes/modules/shipping/usps.php

    and change the lines:
    PHP Code:
              $methods[] = array('id' => $type,
                                 
    'title' => $title,
                                 
    'cost' => ($cost MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes); 
    to read:
    PHP Code:
              if ($type == 'FIRST CLASS' && $shipping_weight >= .6249) {
                
    // skip First Class on >= .6249
              
    } else {
              
    $methods[] = array('id' => $type,
                                 
    'title' => $title,
                                 
    'cost' => ($cost MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
              } 
    See if that doesn't block the First Class when you hit 10oz ...

    NOTE: make sure you have addressed the Tare weight in the Shipping/Packaging before testing ...
    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!

  6. #6
    Join Date
    Aug 2006
    Posts
    33
    Plugin Contributions
    0

    Default Re: USPS First Class Mail Weight Range Change

    I must still not be begging enough because that code kills the estimator and shipping page. They both end up blank.

    The tares are set to 0:0, but I'm assuming this was only to make sure I wasn't adding weight that could throw off the test.

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

    Default Re: USPS First Class Mail Weight Range Change

    Make sure that you don't have any errors in the Admin ... Modules ... Shipping ...

    If you do, there is a typo in the code or a blank space or line perhaps before the beginning <?php or after the ending ?> of the file ...
    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!

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

    Default Re: USPS First Class Mail Weight Range Change

    And just in case this is how lines 188 to 210 read in case you miss placed a bracket etc.

    PHP Code:
            $methods = array();
            
    $size sizeof($uspsQuote);
            for (
    $i=0$i<$size$i++) {
              list(
    $type$cost) = each($uspsQuote[$i]);

              
    // BOF: UPS USPS
              
    $title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
              if(
    in_array('Display transit time'explode(', 'MODULE_SHIPPING_USPS_OPTIONS)))    $title .= $transittime[$type];
              
    /*
              $methods[] = array('id' => $type,
              'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
              'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
              */
              
    if ($type == 'FIRST CLASS' && $shipping_weight >= .6249) {
                
    // skip First Class on >= .6249
              
    } else {
              
    $methods[] = array('id' => $type,
                                 
    'title' => $title,
                                 
    'cost' => ($cost MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
              }
            }

            
    $this->quotes['methods'] = $methods
    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!

  9. #9
    Join Date
    Aug 2006
    Posts
    33
    Plugin Contributions
    0

    Default Re: USPS First Class Mail Weight Range Change

    I was missing the last bracket. It seems to be working perfectly now. Thank you for your time and the help. I'll be sure to treat you and the staff to a cup of coffee!

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

    Default Re: USPS First Class Mail Weight Range Change

    Kinda thought that might be it so I tossed in the extra large block of code so you wouldn't miss that one ...

    Thanks for the coffee ... always a help to have support of the Zen Cart Software ...
    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!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. USPS First Class International weight limit
    By commdiver in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 22 Dec 2010, 03:44 PM
  2. USPS International - first class mail disappeared
    By andy1234 in forum Built-in Shipping and Payment Modules
    Replies: 10
    Last Post: 22 Sep 2010, 04:39 AM
  3. Max weight for first class mail international
    By riosouza in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 17 Feb 2010, 06:49 AM
  4. USPS First Class Mail?
    By rchlst in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 28 Jan 2009, 06:25 PM

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