Best Practices
General > Best Practices > Best Practice for retreiving additional data in Custom Module View modes: 
User avatar
Member
Member
scott@stonesoftwaresolutions.com - 9/4/2007 6:02:56 PM
   
Best Practice for retreiving additional data in Custom Module
I'm building a CustomShippingOptionInfoProvider to retrieve dynamic shipping options from UPS. In order to get accurate shipping options, I need to know the weight, height, width, and depth of SKUInfo items related to the order, and the name and shipping address of the customer. None of this information is available as parameters to any of the methods in ShippingOptionInfoProvider.

What is the recommended way to retrieve this information? I would like the information to be consistent in all use cases. For example, if the customer is placing an order, the info is availabe in a CartInfo object, but if an administrator is editing an order, the info is tied to an order. Is there a consistent way to get the data in both cases?

Mostly, I want to avoid introducing any unnecessary dependencies in my code that could break when you release an update.

Thanks,
Scott

User avatar
Member
Member
kentico_vitaja - 9/10/2007 3:29:40 PM
   
RE:Best Practice for retreiving additional data in Custom Module
Hi Scott,

for your purpose you may use CalculateShipping method in ShippingOptionInfoProvider.cs file. This method receives as a parameter ShoppingCartInfo object which you might want to use. You should alter this method to fit your needs.

However, I recommend you to wait till 14th of September 2007, when new release of KenticoCMS comes, as we are currently working on fix related to this issue. In Kentico 2.3 there should be steps described above working alright.

Best regards,
Vita Janecek

User avatar
Member
Member
kentico_vitaja - 9/10/2007 4:31:55 PM
   
RE:Best Practice for retreiving additional data in Custom Module
Hi Scott,

I'm sorry for misleading information. Please go to ShoppingCartInfoProvider.cs file and update EvaluateShoppingCartContent(ShoppingCartInfo shoppingCart) method instead.

Best regards,
Vita Janecek

User avatar
Member
Member
scott - 9/10/2007 5:03:41 PM
   
RE:Best Practice for retreiving additional data in Custom Module
Vita,

I'm still a little confused. Overall, my goal is to display a dynamic list of shipping options to the user with accurate prices based on the results of a web service, instead of retrieving them from a static list in the Kentico database. The web service requires the following information from the shopping cart before it will give me shipping options:

weight of items, dimensions of items, customer shipping address.

I was under the impression that CalculateShipping is called to get the total cost of shipping on the order. The ASPX pages that display the shipping options call some variation of GetShippingOptions. I'm worried that without a GetShippingOptions method that accepts a ShoppingCartInfo parameter in the ShippingOptionProvider interface, I'm going to have to modify the codebehind to call my CustomShippingOptionProvider directly, which will bypass the logic in your system to check the config file to determine whether or not to use a custom provider.

If I need to override EvaluateShoppingCartContent in the ShoppingCartInfoProvider, can you help me to understand what this method should do? Does it just calculate totals? The source in the CustomECommerceProvider project just calls the default provider, and I can't find source for that.

Thanks,
Scott

User avatar
Member
Member
kentico_vitaja - 9/11/2007 11:18:17 AM
   
RE:Best Practice for retreiving additional data in Custom Module
Hi Scott,

it is going to be difficult to rewrite EvaluateShoppingCartContent according to your needs. What kind of license do you have? If you have license with source code it might be a lot easier to rewrite it. I recommend you to contact us via email: support@kentico.com becose I'm afraid that we are unable to help you here on forum.

Kind regards,
Vita Janecek