Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Jan 11, 2018 @ 14:56
    Alex Skrypnyk
    1

    order.Save Error

    Hello

    We are working on TeaCommerce version 2.3.2 for Umbraco 7, added shipping calculator for recalculating order total after changing shipping settings, but I'm getting an error when try to save order:

                                try
                                {
                                    var order = TC.GetOrder(Model.StoreId, Model.Id);
                                    order.Properties.AddOrUpdate("glsReponse", resultGLS);
                                    order.Properties.AddOrUpdate("glsShippingCost", shipmentPrice.ToString());
                                    order.Save();
    
                                }
                                catch (Exception exceptionSave)
                                {
                                    LogHelper.Error<Exception>(exceptionSave.Message, exceptionSave);
                                }
    

    In line order.Save() I'm getting an exception that can't fix

    Thanks,

    Alex

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Jan 11, 2018 @ 16:39
    Alex Skrypnyk
    0

    Upgrade to version 2.3.5 didn't help

  • Brian Lyk Larsen 19 posts 274 karma points
    Jan 12, 2018 @ 07:25
    Brian Lyk Larsen
    0

    Hi Alex,

    Which exception is thrown on Order.Save()?

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Jan 16, 2018 @ 10:08
    Alex Skrypnyk
    100

    Hi Brian

    Now we have very strange issue, that "CustomShippingCalculator" is recalculating locally and on the dev, but not working on the live, no exceptions.

    [SuppressDependencyAttribute("TeaCommerce.Api.PriceCalculators.IShippingCalculator", "TeaCommerce.Api")]
    public class CustomShippingCalculator : ShippingCalculator
    {
        public CustomShippingCalculator(IVatGroupService vatGroupService, ICurrencyService currencyService)
            : base(vatGroupService, currencyService)
        {
        }
        protected override Price CalculatePrice(ShippingMethod shippingMethod, Currency currency, Order order)
        {
            LogHelper.Debug(typeof(CustomShippingCalculator), "shipping calculator fired " + shippingMethod.Alias + " glsShippingCost" + order.Properties["glsShippingCost"] + order.ShipmentInformation.TotalPrice.WithVat);
    
            if (!string.IsNullOrWhiteSpace(order.Properties["glsShippingCost"]))
            {
                var currentShippingPrice = decimal.Parse(order.Properties["glsShippingCost"]);
    
                if (order.ShipmentInformation.TotalPrice.WithVat != currentShippingPrice)
                {
                    return new Price(currentShippingPrice, order.VatRate, currency);
                }
            }
    
            return base.CalculatePrice(shippingMethod, currency, order);
        }
    }
    
  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Jan 12, 2018 @ 10:34
    Alex Skrypnyk
    0

    Hi Brian

    Thanks for the response.

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft