Shipping Methods Order-Collection of common programming errors

Shipping Methods Order


  • msdn

    Hi,

    I am trying to change the order of the way Shipping Methods are shown in the listbox during checkout.  The default appears to be alphabetical.  I would like to change this to created date (this is how the Customer and Order Manager tool shows it).

    I have found out how to disable the sort by commenting out a line of code in ShippingMethodHelper.cs, but then they just come in what appears to be a random order during check out..

    Please Advise.

    Chris…

  • 1 Answers


  • msdn1

    Hi Chris

    In the Runtime API (OrderContext), The OrderContext.GetShippingMethods() method does not supply the created date

    http://msdn.microsoft.com/en-us/library/aa528998.aspx

    These are the fields you have in the returned DataSet/DataTable:

    1. ShippingMethodId SQL Data Type: uniqueidentifier

    2. LanguageId SQL Data Type: nvarchar(128)

    3. ShippingMethodName SQL Data Type: nvarchar(255)

    4. Description SQL Data Type: nvarchar(255)

    5. ShippingCostCalculator SQL Data Type: nvarchar(255)

    6. ConfiguredMode SQL Data Type: int

    7. ActionPage SQL Data Type: nvarchar(255)

    8. ActionFriendlyName SQL Data Type: nvarchar(255)

In the Management API, you could get the date created field.

Using the ShippingMethodManager.ShippingMethods which would give you a collection of ShippingMethod object.

http://msdn.microsoft.com/en-us/library/microsoft.commerceserver.orders.shippingmethodmanager.shippingmethods.aspx

You could use that and apply your desired sorting in code. However, this API has more overhead, so could be a performance problem if this is executed a lot. May want to apply some custom caching code if that is the case.

Hope this helps

J-P