custom provider for shipping

mojtaba kavand asked on July 23, 2014 09:35

Hi there ,

I`ve created my custom provider inherited from ShippingOptionInfoProvider , and also I create custom web part provides drop down for deferent shipping price.

Now I can use provider to show shipping price separately , but the issue is I cannot update cart TotalShipping and cart TotalPrice like Kentico ShippingSeletion web part …

if some one explain it to me, it would be much appreciated.

Recent Answers


Joshua Adams answered on July 23, 2014 21:00

When is your method called and what method did you override on the shippingoptioninfoprovider? I would imagine that in your webpart, you would have to talk directly to the shopping cart and set the total cost of the cart to your overridden method, but it would probably depend on which one you overrode.

0 votesVote for this answer Mark as a Correct answer

mojtaba kavand answered on July 24, 2014 01:21

I overrode CalculateShippingInternal in my provider, and invoke the method in my web part when drop down selected index changed ... and also I set the cart total sipping and total price in there according to method return, but it is not updated in all over the system , I mean still shopping cart total web part show wrong shipping and total price !

0 votesVote for this answer Mark as a Correct answer

Ivana Liptakova answered on July 24, 2014 15:56

Hi, did you set property shoppingCart.ShoppingCartShippingOptionID in your custom web part?

The shipping option configured by code above is used by method:

/// <summary>
/// Calculates shipping cost for the given shopping cart. Shipping free limit is applied. Shipping taxes are not included. Result is in site main currency. 
/// </summary>
/// <param name="cartObj">Shopping cart object</param>
protected virtual double CalculateShippingInternal(ShoppingCartInfo cartObj)

which you can override. Its result is used in method:

/// <summary>
/// Calculates total shipping for the given shopping cart. Shipping taxes are included. Result is site main currency.
/// </summary>
/// <param name="cartObj">Shopping cart object</param>
protected virtual double CalculateTotalShippingInternal(ShoppingCartInfo cartObj)

which only adds shipping tax to shipping price. The result of above methods is available in property shoppingCart.TotalShippingInMainCurrency or shoppingCart.TotalShipping (price in shopping cart currency).

If it does not help, could you please share the code of you web part and overrided method?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.