Results 1 to 8 of 8
  1. #1
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    377
    Plugin Contributions
    0

    Default Sort Shipping by Cost during checkout

    Is there any way to sort the shipping methods by cheapest cost first to highest last during checkout?

  2. #2
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Sort Shipping by Cost during checkout

    First question to ask would be what if a given shipping method has multiple costs made available? USPS, UPS, and Fedex each offer such options and there may be others. How would such a situation/condition be expected to be handled?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    377
    Plugin Contributions
    0

    Default Re: Sort Shipping by Cost during checkout

    Quote Originally Posted by mc12345678 View Post
    First question to ask would be what if a given shipping method has multiple costs made available? USPS, UPS, and Fedex each offer such options and there may be others. How would such a situation/condition be expected to be handled?
    I am not sure what you mean by your question. The cost differential is pretty high between USPS, UPS, and Fedex, however in the event that there is a any with the same lowest cost you could always consider shipping time.

  4. #4
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Sort Shipping by Cost during checkout

    Quote Originally Posted by jodean View Post
    I am not sure what you mean by your question. The cost differential is pretty high between USPS, UPS, and Fedex, however in the event that there is a any with the same lowest cost you could always consider shipping time.
    The question was to encourage consideration of what the desired outcome would be based on knowing how some shipping modules operate. Right now, it appears that if any of the three modules identified above (which were used purely as examples) were used, then you already have determined which should be first, second and third at *all* times. But, then decided to throw in yet another variable to consider. So not only is it desired to sort the options presented to the customer by price, but it sounds like proposed delivery date also should be a factor.

    I would then ask, in what sequence should the options be displayed if there is no delivery date provided?

    The reason for the questions is two fold. What result(s) would satisfy your needs and what truly are your needs?

    For example, if a shipping module offered three prices, say a super low, a medium and a high price. Another offered three prices all less than the mediume price but more than the super low price, then of the two modules which should be listed first? What if the super low price sometimes took a month for delivery and all other prices always took less than a week?

    If, however, a module is "always" known to cost more than others, there is a sort order that is available so that the modules could always be displayed in the order setup originally.

    While I haven't looked over the code section that "sorts" the modules, it may be possible to sequence them during display based on whatever criteria is developed and met.

    Other than setting the sort order in the admin, almost any other adjustment is going to require coding or using something that already takes those factors into account.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    377
    Plugin Contributions
    0

    Default Re: Sort Shipping by Cost during checkout

    I guess I have opened a can of worms. Bottom line what happens frequently is that since "UPS" and "USPS" names are similar i have customers just not paying attention. "UPS" is always more expensive and usually double the cost of "USPS". They just go on threw the checkout and usually don't notice until later that their shipping charges are so expensive. Then I give them a refund. Do you have any idea how we might be able to bring attention to the cost before they commit with the payment?

  6. #6
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Sort Shipping by Cost during checkout

    Quote Originally Posted by jodean View Post
    I guess I have opened a can of worms. Bottom line what happens frequently is that since "UPS" and "USPS" names are similar i have customers just not paying attention. "UPS" is always more expensive and usually double the cost of "USPS". They just go on threw the checkout and usually don't notice until later that their shipping charges are so expensive. Then I give them a refund. Do you have any idea how we might be able to bring attention to the cost before they commit with the payment?
    In a default install, the cheapest overall shipping option should be default selected when the customer first arrives at the checkout_shipping page. That is at least provided the "cheapest" shipping isn't identified as storepickup. This is initiated in includes/modules/pages/checkout_shipping/header_php.php, using code in includes/classes/shipping.php to determine the cheapest setting and as necessary/where activated there is a notifier in the shipping class: NOTIFY_SHIPPING_MODULE_CALCULATE_CHEAPEST that may be "hijacking" this situation and preventing the real cheapest method from being selected. There's other places something like that could be done as well, but these are the "most likely" locations.

    Some of the payment methods also support selecting the cheapest shipping method such as when using PayPal Express.

    The checkout_confirmation page should be shown and also reflect the chosen shipping rate, but the question at that point is how does that rate compare to others... Sure could do some sort of data collection at the checkout_shipping page to then be (again) presented on the confirmation page, whether it is something like: there are cheaper shipping rates available (not sure you want to send your customer back through the checkout process on purpose as they may just get up and leave), show the various rates, bold the shipping rate regardless of which they pick (again may cause concern to customer and cause them to cycle through), double check their selection when making it on the checkout_shipping page.

    Could expand the letters USPS and/or UPS and/or add an image next to each if not already present, place the sort order so that the predominantly cheaper option is listed first (recommend if doing this that all shipping modules have a value greater than 0).

    Understand the issue of not only going through the exercise of providing refunds, but also the resulting loss of fees, the aggravation of the return customer or customer that was thinking of returning, etc.

    And yes, shipping has (or is) its own "can of worms". :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    377
    Plugin Contributions
    0

    Default Re: Sort Shipping by Cost during checkout

    Printing the shipper logo beside the text might do the trick. At least probably a least cost fix.

  8. #8
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,684
    Plugin Contributions
    9

    Default Re: Sort Shipping by Cost during checkout

    mc presents some good points on this issue. how your shipping costs get displayed to the customer is very dependent on your template and i see some potential problems.

    that said, if you want to try something, you create a function in an extra_configures file, such as:

    PHP Code:
    function sortShippingQuotes($quotes)
        {
            
    $sortedArray = [];
            foreach (
    $quotes as $quote) {
                unset(
    $flatElement);
                
    $flatElement $quote;
                unset(
    $flatElement['methods']);
                foreach (
    $quote as $key => $value) {
                    if (
    $key == 'methods') {
                        foreach (
    $quote['methods'] as $key => $method) {
                            
    $flatElement['methods'][$key] = $method;
                            
    $flatElement['sort'] = $method['cost'];
                            
    $sortedArray[] = $flatElement;
                            unset(
    $flatElement['methods']);
                        }
                    }
                }
            }
            
    $sort array_column($sortedArray'sort');
            
    array_multisort($sortSORT_ASC$sortedArray);
            return 
    $sortedArray;
        } 

    then in includes/modules/pages/checkout_shipping/header_php.php

    you can do a change like so:

    PHP Code:
    // from:
    // get all available shipping quotes
      
    $quotes $shipping_modules->quote();

    //to:
    // get all available shipping quotes
      
    $quotes $shipping_modules->quote();
      
    $quotes sortShippingQuotes($quotes); 
    then you can see how your template displays the shipping options on the page.

    i would do some testing first; as there is a bit of a change to the structure of the array; but i think it could be workable.

    hope that helps.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 

Similar Threads

  1. PAYPAL Express sometimes NOT Adding Shipping cost during PayPal login
    By HeyIts007 in forum PayPal Express Checkout support
    Replies: 17
    Last Post: 17 Jul 2011, 02:23 AM
  2. Loosing Shipping Cost on Page 2 of Checkout
    By chadderuski in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 14 Apr 2011, 04:46 PM
  3. Shipping cost in checkout totals
    By NRJK in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 17 Dec 2010, 06:48 AM
  4. How to sort shipping by cost?
    By jasmel in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 21 Sep 2008, 05:49 AM
  5. Extra cost per item during checkout
    By beasleybub in forum General Questions
    Replies: 2
    Last Post: 6 Nov 2006, 08:36 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