Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2007
    Location
    Dayton, Ohio
    Posts
    672
    Plugin Contributions
    0

    Default FedEx sort order?

    Is it possible to apply a price sort order to the built in FedEx shipping module? I mean display FedEx prices from the lowest available price (show first) to highest available price (show last)? With the lowest price automatically selected?

    Most would want the lowest price, so this option would make it easier since we offer many FedEx shipping options available.

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

    Default Re: FedEx sort order?

    You could adapt the code to use something from the USPS RateV4 shipping module ...

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

    and add the code in RED:
    Code:
    // bof: adapted functions contributed by Marco B
      //Quote sorting functions
      if (!function_exists('fedex_sort_Alphanumeric')) {
        function fedex_sort_Alphanumeric ($a, $b) {
          return strcmp($a['title'],$b['title']);
        }
      }
      if (!function_exists('fedex_sort_Price')) {
        function fedex_sort_Price ($a, $b) {
          $c=(float)$a['cost'];
          $d=(float)$b['cost'];
          if ($c==$d) return 0;
          return ($c>$d?1:-1);
        }
      }
    // eof: adapted functions contributed by Marco B
    
    class fedexwebservices {
    Code:
              $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType),
                                 'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))),
                                 'cost' => $cost + (strpos($this->handling_fee, '%') ? ($cost * (float)$this->handling_fee / 100) : (float)$this->handling_fee));
    
              // bof: adapted sort by contributed by Marco B
              // Sort the options
              define('MODULE_SHIPPING_FEDEX_QUOTE_SORT', 'Price');
              //define('MODULE_SHIPPING_FEDEX_QUOTE_SORT', 'Alphanumeric');
              if (MODULE_SHIPPING_FEDEX_QUOTE_SORT != 'Unsorted') {
                usort($methods,'fedex_sort_'.MODULE_SHIPPING_FEDEX_QUOTE_SORT);
              }
              // eof: adapted sort by contributed by Marco B
    
    and that should sort the Prices from Low to High ...
    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
    Apr 2007
    Location
    Dayton, Ohio
    Posts
    672
    Plugin Contributions
    0

    Default Re: FedEx sort order?

    Works perfectly. Thank you so much!!

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

    Default Re: FedEx sort order?

    You are most welcome ... thanks for the update that this worked for 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!

 

 

Similar Threads

  1. v151 Product Sort within Category - having problems changing the default sort order
    By Don Wagner in forum Customization from the Admin
    Replies: 4
    Last Post: 21 Oct 2012, 03:03 AM
  2. Product Sort Order only sorts Alphabetically, not by the order assigned.
    By webooks in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 12 Nov 2009, 05:19 PM
  3. Sort Order - All - sort by a-z (show a - c, etc)
    By kiermasz in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 4 Jun 2008, 09:43 PM
  4. How to change sort order formation in order total page?
    By saman in forum General Questions
    Replies: 3
    Last Post: 26 Nov 2007, 12:53 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