{"id":4899,"date":"2014-03-30T16:35:03","date_gmt":"2014-03-30T16:35:03","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/shipping-methods-order-collection-of-common-programming-errors\/"},"modified":"2014-03-30T16:35:03","modified_gmt":"2014-03-30T16:35:03","slug":"shipping-methods-order-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/shipping-methods-order-collection-of-common-programming-errors\/","title":{"rendered":"Shipping Methods Order-Collection of common programming errors"},"content":{"rendered":"<h2>Shipping Methods Order<\/h2>\n<ul>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn<\/p>\n<p>Hi,<\/p>\n<p>I am trying to change the order of the way Shipping Methods are shown in the listbox during checkout.\u00a0 The default appears to be alphabetical.\u00a0 I would like to change this to created date (this is how the Customer and Order Manager tool shows it).<\/p>\n<p>I have found out\u00a0how 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..<\/p>\n<p>Please Advise.<\/p>\n<p>Chris&#8230;<\/p>\n<\/li>\n<li>\n<h3>1 Answers<\/h3>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn1<\/p>\n<p>Hi Chris<\/p>\n<p>In the Runtime API (OrderContext), The <strong>OrderContext.GetShippingMethods()<\/strong> method does not supply the created date<\/p>\n<p>http:\/\/msdn.microsoft.com\/en-us\/library\/aa528998.aspx<\/p>\n<p>These are the fields you have in the returned DataSet\/DataTable:<\/p>\n<ol>\n<li>\n<p>ShippingMethodId SQL Data Type: uniqueidentifier<\/p>\n<\/li>\n<li>\n<p>LanguageId SQL Data Type: nvarchar(128)<\/p>\n<\/li>\n<li>\n<p>ShippingMethodName SQL Data Type: nvarchar(255)<\/p>\n<\/li>\n<li>\n<p>Description SQL Data Type: nvarchar(255)<\/p>\n<\/li>\n<li>\n<p>ShippingCostCalculator SQL Data Type: nvarchar(255)<\/p>\n<\/li>\n<li>\n<p>ConfiguredMode SQL Data Type: int<\/p>\n<\/li>\n<li>\n<p>ActionPage SQL Data Type: nvarchar(255)<\/p>\n<\/li>\n<li>\n<p>ActionFriendlyName SQL Data Type: nvarchar(255)<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>In the Management API, you could get the date created field.<\/p>\n<p>Using the <strong>ShippingMethodManager.ShippingMethods<\/strong> which would give you a collection of ShippingMethod object.<\/p>\n<p>http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.commerceserver.orders.shippingmethodmanager.shippingmethods.aspx<\/p>\n<p>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\u00a0if that is the case.<\/p>\n<p>Hope this helps<\/p>\n<p>J-P<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shipping Methods Order msdn Hi, I am trying to change the order of the way Shipping Methods are shown in the listbox during checkout.\u00a0 The default appears to be alphabetical.\u00a0 I would like to change this to created date (this is how the Customer and Order Manager tool shows it). I have found out\u00a0how to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4899","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4899","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4899"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4899\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}