Sorting the approvers drop down list - xmpie-users/uStore-js GitHub Wiki

When a store has approval turned on, and the administrator permits the customer to select their approver (and there are multiple approvers defined), the customer is presented with a drop-down list of approvers to choose from.

Alt

Currently, there is no option in the uStore Admin user interface to define how the list of approvers will be sorted for the customer to select from. If there are many approvers, it can be difficult to locate the name you want.

This JavaScript is an example of how to format the list alphabetically:

<script type="text/javascript"> 
  $(document).ready(function() { 
    var pageTitle = $(document).find("title").text().substring(0,24); 
    if (pageTitle == "Checkout - Order Summary") { 
      $("#ctl00_cphMainContent_ddlApprover").html($("#ctl00_cphMainContent_ddlApprover option").sort(function (a, b) { 
        return a.text == b.text ? 0 : a.text < b.text ? -1 : 1 
      })) 
    } 
  }); 
</script>

For information on how to add JavaScript to your store: How to add JavaScript to a storefront.

⚠️ **GitHub.com Fallback** ⚠️