Results 1 to 7 of 7
  1. #1
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default exclude shipping module from being auto selected as cheapest

    I started to use the flat rate shipping module along side UPS, FedEx, USPS and store pickup. Is there a way to exclude the flat rate module from being auto selected as cheapest. I just want UPS FedEx and USPS to be the modules zen cart looks at for auto selection. Store pickup is ignored not sure if that is by default or I did something in the past for that to work like it does.

    So basically zen cart should ignore store pickup (as it already is) and the flat rate module and look at only UPS, FedEx and USPS and out of those three whomever is cheapest auto select it.
    Last edited by marcopolo; 3 Sep 2014 at 12:11 AM.

  2. #2
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: exclude shipping module from being auto selected as cheapest

    I think I found where to do it just do not know how to code it:

    file: includes/classes/shipping.php


    PHP Code:
          $cheapest false;
          
    $size sizeof($rates);
          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') || $size == 1) { // modified by Numinix for FEC
                
    $cheapest $rates[$i];
              }
            } else {
              if (
    $rates[$i]['module'] != 'storepickup' || $size == 1) { // modified by Numinix for FEC
                
    $cheapest $rates[$i];
              }
            }
          }
          
    $this->notify('NOTIFY_SHIPPING_MODULE_CALCULATE_CHEAPEST'$cheapest);
          return 
    $cheapest;
        }
      }


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

    Default Re: exclude shipping module from being auto selected as cheapest

    I did not test this, but you could try:

    Code:
              if (($rates[$i]['cost'] < $cheapest['cost'] and ($rates[$i]['module'] != 'storepickup' && $rates[$i]['module'] != 'flat'))) || $size == 1) { // modified by Numinix for FEC
    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!

  4. #4
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: exclude shipping module from being auto selected as cheapest

    Hello Ajeh,

    Thank you I tried it but it is still selecting flat rate?

    I had to change the code slightly to get it to run I think you just had a typo moved "))" those over. Here is what ran but still did not work.

    PHP Code:
    if (($rates[$i]['cost'] < $cheapest['cost'] and ($rates[$i]['module'] != 'storepickup' && $rates[$i]['module'] != 'flat' || $size == 1))) { // modified by Numinix for FEC 

  5. #5
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: exclude shipping module from being auto selected as cheapest

    ok got it to work with this:

    PHP Code:
          $cheapest false;
          
    $size sizeof($rates);
          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' && $rates[$i]['module'] != 'flat' || $size == 1))) { // modified by Numinix for FEC
                
    $cheapest $rates[$i];
              }
            } else {
              if (
    $rates[$i]['module'] != 'storepickup' && $rates[$i]['module'] != 'flat' || $size == 1) { // modified by Numinix for FEC
                
    $cheapest $rates[$i];
              }
            }
          }
          
    $this->notify('NOTIFY_SHIPPING_MODULE_CALCULATE_CHEAPEST'$cheapest);
          return 
    $cheapest;
        }
      }


  6. #6
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: exclude shipping module from being auto selected as cheapest

    Thanks again for your help!

  7. #7
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: exclude shipping module from being auto selected as cheapest

    PHP Code:
     $cheapest false
          
    $size sizeof($rates); 
          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' && $rates[$i]['module'] != 'flat' || $size == 1))) { // modified by Numinix for FEC 
                
    $cheapest $rates[$i]; 
              } 
            } else { 
              if (
    $rates[$i]['module'] != 'storepickup' && $rates[$i]['module'] != 'flat' || $size == 1) { // modified by Numinix for FEC 
                
    $cheapest $rates[$i]; 
              } 
            } 
          } 
          
    $this->notify('NOTIFY_SHIPPING_MODULE_CALCULATE_CHEAPEST'$cheapest); 
          return 
    $cheapest
        } 
      } 

    I need to modify the above code to exclude two services OF a particular shipping module. These are SurePost and are usually always cheaper however not everyone might want to use it since the transit days can be more.

    The shipping module name is upswebservices.php
    Here are the two service codes: $rateReply->Service->Code == 92 || $rateReply->Service->Code == 93

    Any help would be appreciated!
    Last edited by marcopolo; 27 Apr 2016 at 08:03 PM.

 

 

Similar Threads

  1. Replies: 3
    Last Post: 8 Oct 2015, 03:34 PM
  2. v154 Select table shipping method as default - freedelivery is being set maybe as cheapest
    By SarahL in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 24 Aug 2015, 03:32 PM
  3. Exclude UK from Flat Rate International Shipping module
    By limelites in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 29 Mar 2012, 04:01 PM
  4. Exclude Country/Zone From Shipping Module
    By lucky-nz in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 15 Dec 2010, 06:28 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