Does anyone have any idea how to create a shipping provider for Tea Commerce 2? A broad question I know, but any pointers as to where to start would be very much appreciated.
The place to start is the shipping calculator. This is the one that gives the shipping price to Tea Commerce. Inherit from TeaCommerce.Api.PriceCalculators.ShippingCalculator. Here is one method you need to override (two if you need to supported estimated shipping costs before an order is even created). Override the CalculatePrice method and return the price you need.
To register your new shipping calculator and let Tea Commerce use it you need to build your dll file and add it to your bin folder. Then go to /umbraco/plugins/tea-commerce/config/configuration.config and add you calculator and register it as TeaCommerce.Api.PriceCalculators.IShippingCalculator. Restart the app pool and Tea Commerce will now use your provider for calculating shipping prices for new orders.
If you need to make som UI stuff other than the pricing - then this is not Tea Commerce but is just a question of how you can to implement it in the UI in your webshop.
For now I have this (using a hard-coded shipping value of '99.99' just to test with):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TeaCommerce.Api;
namespace testShippingProvider
{
public class upsShippingProvider : TeaCommerce.Api.PriceCalculators.ShippingCalculator
{
protected override decimal CalculatePrice(TeaCommerce.Api.Models.ShippingMethod shippingMethod, TeaCommerce.Api.Models.Currency currency, TeaCommerce.Api.Models.Order order)
{
return 99.99M;
}
}
}
However, it's erroring: 'TeaCommerce.Api.PriceCalculators.ShippingCalculator' does not contain a constructor that takes 0 arguments. Do you know where I'm going wrong?
Create shipping provider for Tea Commerce 2
Hi,
Does anyone have any idea how to create a shipping provider for Tea Commerce 2? A broad question I know, but any pointers as to where to start would be very much appreciated.
Thanks
Hi Dan
The place to start is the shipping calculator. This is the one that gives the shipping price to Tea Commerce. Inherit from TeaCommerce.Api.PriceCalculators.ShippingCalculator. Here is one method you need to override (two if you need to supported estimated shipping costs before an order is even created). Override the CalculatePrice method and return the price you need.
To register your new shipping calculator and let Tea Commerce use it you need to build your dll file and add it to your bin folder. Then go to /umbraco/plugins/tea-commerce/config/configuration.config and add you calculator and register it as TeaCommerce.Api.PriceCalculators.IShippingCalculator. Restart the app pool and Tea Commerce will now use your provider for calculating shipping prices for new orders.
If you need to make som UI stuff other than the pricing - then this is not Tea Commerce but is just a question of how you can to implement it in the UI in your webshop.
Kind regards
Anders
Thanks Anders,
For now I have this (using a hard-coded shipping value of '99.99' just to test with):
However, it's erroring: 'TeaCommerce.Api.PriceCalculators.ShippingCalculator' does not contain a constructor that takes 0 arguments. Do you know where I'm going wrong?
Yeah - the shipping provider need these services to work. AutoFac will parse them in. So make a constructor like this:
public upsShippingProvider ( IVatGroupService vatGroupService, ICurrencyService currencyService ) : base(vatGroupService, currencyService ) {
}
That should be it.
Kind regards
Anders
is working on a reply...