Shipping Methods Order-Collection of common programming errors
Shipping Methods Order
.png)
msdnHi,
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
.png)
msdn1Hi 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:
-
ShippingMethodId SQL Data Type: uniqueidentifier
-
LanguageId SQL Data Type: nvarchar(128)
-
ShippingMethodName SQL Data Type: nvarchar(255)
-
Description SQL Data Type: nvarchar(255)
-
ShippingCostCalculator SQL Data Type: nvarchar(255)
-
ConfiguredMode SQL Data Type: int
-
ActionPage SQL Data Type: nvarchar(255)
-
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