Results 1 to 10 of 15

Hybrid View

  1. #1
    Join Date
    Jun 2009
    Posts
    42
    Plugin Contributions
    0

    cart error Setting Shipping Methods Based on Weight

    Setting Shipping Methods Based on Weight

    Hello all,
    So I have searched around for this but I have mainly found people wanting to restrict certain carriers based on things such as individual items, weight, cost, etc. What I have not found is where change the usps.php file so that I can do the following scenario (ONLY for International shipments):

    When the total weight is <0.99lbs, then show the options:
    USPS Priority Mail Int Flat Rate Env
    USPS Express Mail Int Flat Rate Env

    and NOT show:
    USPS Priority Mail International
    USPS Express Mail Int


    The reason is to reduce the shipping cost to my customers since the items that are the least amount of weight (which you would have to buy a ton of to get to 0.99lbs total weight) are small and can be shipped via an envelope and dont need a box.

    Please let me know what php lines are needed to solve this, thanks
    -Nolan

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

    Default Re: Setting Shipping Methods Based on Weight

    You would need to test the shipping method $type in the: function quote

    And mask/hide/skip the results when the $usps_shipping_weight is <= 0.99 ...
    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
    Jun 2009
    Posts
    42
    Plugin Contributions
    0

    Default Re: Setting Shipping Methods Based on Weight

    Ok so I think this is the part of the usps.php file you are saying I should change:
    PHP Code:
           // BOF: UPS USPS
            
    $this->quotes = array('id' => $this->code,
            
    'module' => $this->title $show_box_weight);
            
    // EOF: UPS USPS

            
    $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);
              */
              
    $methods[] = array('id' => $type,
                                 
    'title' => $title,
                                 
    'cost' => ($cost MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
            } 
    So how do I set up the "if else" statement so that one of the types is allowed only when less than 0.99 lbs. I dont see anything about the different types, so is it in whatever the MODULE_SHIPPING_USPS_OPTIONS is referring to?
    Sorry this is my first time with PHP, and though related to html I am still in the learning stage.

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

    Default Re: Setting Shipping Methods Based on Weight

    Add this echo below the list:
    Code:
              list($type, $cost) = each($uspsQuote[$i]);
    echo 'I SEE usps type: ' . $type . '<br>';
    Based on the results of the $type you can add an IF condition or a CASE condition to control the building of the:
    Code:
              $methods[] = array('id' => $type,
                                 'title' => $title,
                                 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
    If nothing is added to the $methods[] based on the $type then it will be excluded from the shipping options ...
    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
    Jun 2009
    Posts
    42
    Plugin Contributions
    0

    Default Re: Setting Shipping Methods Based on Weight

    Ok so something like this?

    PHP Code:
    // BOF: UPS USPS
            
    $this->quotes = array('id' => $this->code,
            
    'module' => $this->title $show_box_weight);
            
    // EOF: UPS USPS

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

           echo 
    'I SEE usps type: ' $type '<br>';

              
    // 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($usps_shipping_weight is <= 0.99){

              
    $methods[] = array('id' => $type,
                                 
    'title' => $title,
                                 
    'cost' => ($cost MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);

          } else{

          
    $methods[] = array('id' => $type,
                                 
    'title' => $title,
                                 
    'cost' => ($cost MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
          }

            } 
    But how do I specify which type to filter for?

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

    Default Re: Setting Shipping Methods Based on Weight

    Note: on the IF you might use:
    Code:
          if($usps_shipping_weight <= 0.99){
    Look at the output of the echo for the $type when you are looking at shipping costs ...

    Which one(s) do you want to turn off when <= .99 ...
    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. Different shipping methods based on quantity
    By falariem in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 19 Aug 2011, 12:06 AM
  2. Shipping multiple items based on total weight, but need weight per box.
    By Nineve in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 2 Aug 2010, 07:42 AM
  3. Zone Shipping Cost based on Individual item weight, not total order weight
    By pohnean in forum Built-in Shipping and Payment Modules
    Replies: 15
    Last Post: 16 Sep 2009, 09:02 AM
  4. Changing shipping methods based on item weight??
    By krhody in forum Built-in Shipping and Payment Modules
    Replies: 11
    Last Post: 12 Sep 2009, 09:11 PM
  5. Setting Up Shipping Prices based on categories or Based on Table?
    By CoolCarPartsOnline in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 21 May 2008, 07:22 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