Page 1 of 7 123 ... LastLast
Results 1 to 10 of 64
  1. #1
    Join Date
    May 2010
    Location
    Texas
    Posts
    491
    Plugin Contributions
    0

    help question Conditional shipping option?

    Is there a way I can control which shipping options are presented based on the shipping costs of FedEx.

    Normally we only offer FedEx for International. Shipping averages around $23. However for some destinations, the shipping can be $50-70. For FedEx costs > $40, I would like the USPS first Class option to appear with the FedEx option. For FedEx costs < $40, only the FedEx option should appear.

    The reason for this is that USPS FC international is slow and unreliable and we want to avoid it unless the FedEx cost is simply too high.

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

    Default Re: Conditional shipping option?

    This is what FedEx and USPS shows at 13oz ...

    Code:
    FedEx (1 x 0.81lbs) (International Priority) $75.18
    FedEx (1 x 0.81lbs) (International Economy) $71.47
    FedEx (1 x 0.81lbs) (Fedex Ground (2 days)) $19.70
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (First-Class Mail® International Large Envelope) $5.25
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (First-Class Package International Service™) $9.50
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (Priority Mail International® Flat Rate Envelope) $19.95
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (Priority Mail International®) $27.40
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (Priority Mail Express International™ Flat Rate Envelope) $34.95
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (Priority Mail Express International™) $35.48
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (Priority Mail International® Medium Flat Rate Box) $40.95
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (Priority Mail International® Large Flat Rate Box) $53.95
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (Global Express Guaranteed® (GXG)) $55.41
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (USPS GXG™ Envelopes) $55.41
    United States Postal Service (1 Boxes) (0 lbs, 13 oz) (Priority Mail Express International™ Flat Rate Boxes) $64.95
    What Ship To, Ship From and Weight are you testing with?

    What do you want to see differently on these costs?
    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: v1.5.5]
    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
    May 2010
    Location
    Texas
    Posts
    491
    Plugin Contributions
    0

    Default Re: Conditional shipping option?

    The weight is always 2lbs or less, and typically 13 oz.
    The from is USA, the to is any international destination.
    If price > $40, show USPS first class and FedEx option, else show FedEx option on the shopping cart page and on the checkout page.
    Said differently, if price <=$40, only show FedEx option
    Last edited by split63; 2 Nov 2013 at 06:37 PM.

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

    Default Re: Conditional shipping option?

    Try this ...

    Customize the file:
    /includes/modules/shipping/fedexwebservices.php

    with the code in RED:
    Code:
            $methods = array();
    // bof: check FedEx for > 40.00
            $_SESSION['usps_first_class'] = 0;
            foreach ($response->RateReplyDetails as $rateReply) {
    Code:
                  $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType),
                                     'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))) . $transitTime,
                                     'cost' => $cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? ($cost * (float)$this->types[$rateReply->ServiceType]['handling_fee'] / 100) : (float)$this->types[$rateReply->ServiceType]['handling_fee']));
    $chk_cost = ($cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? ($cost * (float)$this->types[$rateReply->ServiceType]['handling_fee'] / 100) : (float)$this->types[$rateReply->ServiceType]['handling_fee']));
    if ($_SESSION['usps_first_class'] == 0 || $chk_cost < $_SESSION['usps_first_class']) {
      $_SESSION['usps_first_class'] = $chk_cost;
    }
    //echo 'FedEx Cost Calc: ' . $chk_cost . ' $_SESSION[usps_first_class]: ' . $_SESSION['usps_first_class'] . '<br><br>';
    // bof: check FedEx for > 40.00
                }
              }
            }
            $this->quotes['methods'] = $methods;
    Then customize the file:
    /includes/modules/shipping/usps.php
    Code:
              if ($this->usps_countries == 'US' && MODULE_SHIPPING_USPS_FIRST_CLASS_FILTER_US == 'True' && preg_match('#First\-Class#i', $type) && $cnt_first > 1) continue;
    // bof: check FedEx for > 40.00
    //echo 'USPS FedEx $_SESSION[usps_first_class]: ' . $_SESSION['usps_first_class'] . ' $type: ' . $type . '<br>';
    //echo 'USPS $type_rebuilt: ' . $type_rebuilt . '<br>';
    if (preg_match('#(first-class)#i', $type_rebuilt) && $_SESSION['usps_first_class'] > 40) {
              $methods[] = array('id' => $type_rebuilt,
                                 'title' => $title,
                                 'cost' => $cost,
                                );
    }
    // eof: check FedEx for > 40.00
            } else {
    //echo 'MISSING! USPS $type: ' . $type . (in_array($type, $this->typeCheckboxesSelected) ? ' YES' : ' NO') . ' $method: ' . $method . ' $usps_shipping_weight: ' . $usps_shipping_weight . ' $minweight: ' . $minweight . ' $maxweight: ' . $maxweight . '<br>';
            }
          }  // end for $i to $PackageSize
    
          if (sizeof($methods) == 0) return false;
    Be sure that on the Modules ... Shipping ... that you set a Sort Order on FedEx such as 10 and on USPS a Sort Order of 20 so that FedEx runs before USPS for this to work ...
    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: v1.5.5]
    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
    May 2010
    Location
    Texas
    Posts
    491
    Plugin Contributions
    0

    Default Re: Conditional shipping option?

    Ajeh,

    That seems to work...thanks.

    When both FedEx and USPS options show, the USPS option is by default selected. Is there a way I can make FedEx the default, or better yet, neither checked?


    Also, the message for USPS is:
    United States Postal Service (First-Class Package International Service™)

    How can I change this to:
    United States Postal Service (First-Class 7-20 days)

    Can a hyperlink be inserted into that text?

  6. #6
    Join Date
    May 2010
    Location
    Texas
    Posts
    491
    Plugin Contributions
    0

    Default Re: Conditional shipping option?

    I spoke to soon.
    For the US, we offer only USPS priority. When I checked a US location, the shopping cart no longer listed a value for USPS priority....it was just missing with no rate estimate at all.

    This is most likely my fault for lack of full disclosure

    USA locations: USPS priority only
    International locations: FedEx<$40, then FedEx only. FedEx>=$40, USPS FC and FedEx

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

    Default Re: Conditional shipping option?

    You could use the CUSTOM setting:
    USPS Domestic Transit Time Calculation Mode
    Select from the following the USPS options.
    note: NEW and OLD will add additional time to quotes. CUSTOM allows your custom shipping days.

    CUSTOM
    NEW
    OLD
    and show the days by turning on the:
    Display transit time
    Then, in the function parseIntlTransitTimeResults($Package, $service) you will see where the days can be customized ...
    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: v1.5.5]
    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: Conditional shipping option?

    Quote Originally Posted by split63 View Post
    I spoke to soon.
    For the US, we offer only USPS priority. When I checked a US location, the shopping cart no longer listed a value for USPS priority....it was just missing with no rate estimate at all.

    This is most likely my fault for lack of full disclosure

    USA locations: USPS priority only
    International locations: FedEx<$40, then FedEx only. FedEx>=$40, USPS FC and FedEx
    The name to allow can be changed in the:
    /includes/modules/shipping/usps.php
    Code:
    if (preg_match('#Priority Mail International#i', $type_rebuilt) && $_SESSION['usps_first_class'] > 40) {
    while the session variable is reading usps_first_class it is just a marker so its name is not important, but for clarity you might change it in both files to:
    $_SESSION['usps_priority']

    that is up to 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: v1.5.5]
    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
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Conditional shipping option?

    Are you wanting USPS to show when the Ship to is to a US address? Or just on those Ship to for International addresses?
    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: v1.5.5]
    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!

  10. #10
    Join Date
    May 2010
    Location
    Texas
    Posts
    491
    Plugin Contributions
    0

    Default Re: Conditional shipping option?

    Quote Originally Posted by Ajeh View Post
    Are you wanting USPS to show when the Ship to is to a US address? Or just on those Ship to for International addresses?
    USA locations: USPS priority only
    International locations: FedEx<$40, then FedEx only. FedEx>=$40, USPS FC and FedEx

 

 
Page 1 of 7 123 ... LastLast

Similar Threads

  1. v139h conditional shipping modules
    By bigduffeye in forum Addon Shipping Modules
    Replies: 11
    Last Post: 12 Feb 2013, 05:49 PM
  2. v139h Free shipping option, disable one other shipping option
    By stylenote in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 21 Jul 2012, 09:56 PM
  3. conditional based attributes to calc shipping?
    By shewhorn in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 16 Feb 2010, 03:18 AM
  4. Shipping option only shows as free shipping - i want all options
    By RomanSon3625 in forum Addon Shipping Modules
    Replies: 8
    Last Post: 14 Nov 2007, 04:13 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