Just wanted to highlight the key difference between these 2 APIs which can both be used to display the set of ShippingMethods which are enabled in the TransactionConfig (the site resource) database.
Points to be noted:
· Both only return enabled ShippingMethods in the system.
· GetShippingMethods() returns ALL the enabled ShippingMethods in the system. Each languageId gets it’s own table.
· GetShippingMethods(String languageId) returns the ShippingMethods for display for the languageId locale. The key point here is that it always returns all the ShippingMethods configured in the system, irrespective of whether they have a value defined for this languageId or not. If for a particular ShippingMethod the requested languageId is NOT found in the list of defined languages then the values for the DEFAULT languageId of the ShippingMethod is returned.
Nothing will probably make it clearer than an example. Imagine 2 ShippingMethods defined in the following languages:
Now here is what happens when these APIs are called:
· DataSet allSMs = OrderContext.Current.GetShippingMethods();
In the case of GetShippingMethods() 2 tables will be present in the dataset, one called “en-US” containing SM1_enUS and one table called “fr-FR” containing 2 methods SM1_frFR and SM2_frFR.
· DataSet deSMs = OrderContext.Current.GetShippingMethods("de-DE");
In the case of GetShippingMethods(String) only one table called “de-DE” will be returned but it shall contain 2 entries for each of the 2 enabled methods in the system as defined in their default languages, thus entries for SM1_enUS (default for SM1) and SM2_frFR (default for SM2) will be returned.
By the way, the same behavior applies to the OrderContext.GetPaymentMethods() and OrderContext.GetPaymentMethods(String) methods as well.