Sort Shipping Options by Price

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iblp
    Mivite Lite

    • Jan 2016
    • 3

    #1

    Sort Shipping Options by Price

    When a user gets to the step in the checkout process to choose a shipping option, it would seem most intuitive if this list was sorted by price. Most other eCommerce software packages will sort the shipping options in this way by default. This would be especially helpful in stores that display the shipping options as radio buttons instead of a select list.

    This was formerly possible using the old "Sort Shipping Plus Free Shipping" module (http://apps.miva.com/sort-shipping-p...ng-option.html). However, most of the functionality from this module is now built into Miva 9 and using this old module conflicts with Miva's new built-in shipping rules. The last component from this module that is not built into Miva core is the ability to automatically sort shipping options by price when they are displayed to the user. It would make a lot of sense to build this feature into the Miva core software in a future release.
  • conner0987
    Mini Mivite

    • Aug 2014
    • 17

    #2
    you could do something like this https://jsfiddle.net/7qrc3497/6/

    Comment

    • oliverands
      Mivite








      • Jun 2010
      • 428

      #3
      I do this using a Toolkit function. Here's the relevant code:

      Code:
                               <select name="ShippingMethod" id="ShippingMethod">
                                  <mvt:if expr="ISNULL l.settings:shippingmethods">
                                      <mvt:if expr="ISNULL l.settings:fallbackshippingmethod">
                                          <option value="">Unable to Calculate Shipping Costs</option>
                                      <mvt:else>
                                          <option value="">&mvt:fallbackshippingmethod:name; (&mvt:fallbackshippingmethod:formatted_price;)</option>                                
                                      </mvt:if>
                                  <mvt:else>
                                  <option value="">&lt;Select One&gt;</option>
                                      <mvt:item name="toolkit" param="asortmulti|l.all_settings:shippingmethods|:price|1" />
                                      <mvt:foreach array="shippingmethods" iterator="method">
                                          <mvt:if expr="NOT ISNULL l.settings:method:price">
                                      <option value="&mvte:method:module;:&mvte:method:code;">&mvt:method:name; (&mvt:method:formatted_price;)</option>
                                          <mvt:else>
                                      <option value="&mvte:method:module;:&mvte:method:code;">&mvt:method:name;</option>
                                          </mvt:if>
                                      </mvt:foreach>
                                  </mvt:if>
                              </select>
      Todd Gibson
      Oliver + S | Sewing Patterns for Kids and the Whole Family

      Comment

      Working...
      X