Page 4 of 7 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 64
  1. #31
    Join Date
    May 2010
    Location
    Texas
    Posts
    508
    Plugin Contributions
    0

    Default Re: Conditional shipping option?

    Quote Originally Posted by Ajeh View Post
    You could try customizing the class:
    /includes/classes/shipping.php

    Code:
          for ($i=0; $i<$size; $i++) {
            if (is_array($cheapest)) {
              // never quote storepickup as lowest - needs to be configured in shipping module
              if ($rates[$i]['cost'] < $cheapest['cost'] and $rates[$i]['module'] != 'storepickup' and $rates[$i]['module'] != 'usps') {
                $cheapest = $rates[$i];
              }
            } else {
              if ($rates[$i]['module'] != 'storepickup' and $rates[$i]['module'] != 'usps') {
                $cheapest = $rates[$i];
              }
            }
          }
    I made that change, but nothing happened.
    Just to be clear. There are two cases:
    1. Domestic shipping - Always and only USPS priority
    2. International shipping, Always Fedex, and sometimes also USPS FC if FedEx>$40

    It is case #2 that we are discussing. When the FedEx is >$40, USPS FC appears, but USPS FC is always by default selected. I want FedEx to always be default selected.

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

    Default Re: Conditional shipping option?

    Check your code for:
    /includes/classes/shipping.php

    Code:
          $cheapest = false;
          $size = sizeof($rates);
          for ($i=0; $i<$size; $i++) {
    echo 'Shipping cheapest: ' . $rates[$i]['module'] . ' cost: ' . $cheapest['cost'] . '<br>';
            if (is_array($cheapest)) {
              // never quote storepickup as lowest - needs to be configured in shipping module
              if ($rates[$i]['cost'] < $cheapest['cost'] and $rates[$i]['module'] != 'storepickup' and $rates[$i]['module'] != 'usps') {
                $cheapest = $rates[$i];
              }
            } else {
              if ($rates[$i]['module'] != 'storepickup' and $rates[$i]['module'] != 'usps') {
                $cheapest = $rates[$i];
              }
            }
          }
          $this->notify('NOTIFY_SHIPPING_MODULE_CALCULATE_CHEAPEST', $cheapest);
          return $cheapest;
    and make sure it matches and add the line in RED ...

    Next, logout, then login and try the checkout ...

    What do you see from the echo? And, now does the cheapest stop showing as USPS?
    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. #33
    Join Date
    May 2010
    Location
    Texas
    Posts
    508
    Plugin Contributions
    0

    Default Re: Conditional shipping option?

    I don't quite understand why, but in order for the changes to take effect I did have to log out then back in.
    Once I tried your test above and saw that it did work, I then retried your code changes to make it default to FedEx. It worked.

    But it had a side effect that for the US domestic shipping case, where only USPS priority is offered, USPS was not selected. Hence when Continue was selected, an error is displayed that no shipping was selected even though there was only one choice.

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

    Default Re: Conditional shipping option?

    Change the echo to this:
    Code:
    echo 'Shipping cheapest: ' . $rates[$i]['module'] . ' cost: ' . $cheapest['cost'] . ' $size: ' . $size . '<br>';
    Logout and login and try that again and post what the echo reads when you just have the 1 choice and cannot continue ...
    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. #35
    Join Date
    May 2010
    Location
    Texas
    Posts
    508
    Plugin Contributions
    0

    Default Re: Conditional shipping option?

    Made the change and this printed.

    Shipping cheapest: usps cost: $size: 1

    This is with the original code, that is without this:
    Code:
    and $rates[$i]['module'] != 'usps'

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

    Default Re: Conditional shipping option?

    What happens if you try this:
    Code:
          for ($i=0; $i<$size; $i++) {
    echo 'Shipping cheapest: ' . $rates[$i]['module'] . ' cost: ' . $cheapest['cost'] . ' $size: ' . $size . '<br>';
            if (is_array($cheapest)) {
              // never quote storepickup as lowest - needs to be configured in shipping module
              if ($rates[$i]['cost'] < $cheapest['cost'] and $rates[$i]['module'] != 'storepickup' and ($rates[$i]['module'] != 'usps' && $size > 1)) {
                $cheapest = $rates[$i];
              }
            } else {
              if ($rates[$i]['module'] != 'storepickup' and ($rates[$i]['module'] != 'usps' && $size > 1)) {
                $cheapest = $rates[$i];
              }
            }
          }
    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!

  7. #37
    Join Date
    May 2010
    Location
    Texas
    Posts
    508
    Plugin Contributions
    0

    Default Re: Conditional shipping option?

    Added the change above, tried it several times, logging in, then out, then back in again. Each time USPS Priority was not checked for the Domestic US case

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

    Default Re: Conditional shipping option?

    You have FedEx installed and USPS ... which options are selected on each one?

    What is the weight of the order that you are 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!

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

    Default Re: Conditional shipping option?

    I have to go to bed ... if you just have the 1 USPS option selected, then try this:
    Code:
          for ($i=0; $i<$size; $i++) {
    //echo 'Shipping cheapest: ' . $rates[$i]['module'] . ' cost: ' . $cheapest['cost'] . ' $size: ' . $size . '<br>';
            if (is_array($cheapest)) {
              // never quote storepickup as lowest - needs to be configured in shipping module
              if (($rates[$i]['cost'] < $cheapest['cost'] and $rates[$i]['module'] != 'storepickup' and $rates[$i]['module'] != 'usps') or $size == 1) {
                $cheapest = $rates[$i];
              }
            } else {
              if (($rates[$i]['cost'] < $cheapest['cost'] and $rates[$i]['module'] != 'storepickup' and $rates[$i]['module'] != 'usps') or $size == 1) {
                $cheapest = $rates[$i];
              }
            }
          }
    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!

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

    Default Re: Conditional shipping option?

    1. Domestic shipping - Always and only USPS priority
    2. International shipping, Always Fedex, and sometimes also USPS FC if FedEx>$40

    So for USPS, only 1 domestic option is checked; Priority. And for USPS international, only USPS FC.
    FedEx is also only used for International.


    Weight < 1 lbs


    It seems to be working with that last change. I need to do more testing to be sure
    Last edited by split63; 19 Nov 2013 at 04:16 PM.

 

 
Page 4 of 7 FirstFirst ... 23456 ... 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

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