Copied to clipboard

Flag this post as spam?

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


  • DanielFruerlund 1 post 21 karma points
    Oct 13, 2022 @ 08:09
    DanielFruerlund
    0

    Removing price adjuster from project causes error in order-list and cart-list

    Hi,

    I am working on an Umbraco 10.2.0 project using Vendr 2.4.0.

    Until recently the project has used a custom "BundlePriceAdjuster" class implementing the PriceAdjusterBase to adjust prices for sub-orderlines (products in bundles). I have since removed this type from the project as it was no longer needed, but as a consequence when I go to the order list or the cart list in the commerce section of the umbraco backoffice i get the following error:

    An error occurred Value cannot be null. (Parameter 'type')

    Exception Details

    System.ArgumentNullException, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: Value cannot be null. (Parameter 'type')
    Stacktrace
    at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
       at Vendr.Infrastructure.Persistence.Factories.PriceAdjustmentFactory.BuildEntity(OrderPriceAdjustmentDto dto, Guid currencyId)
       at Vendr.Infrastructure.Persistence.Factories.OrderFactory.<>c__DisplayClass1_0.<BuildPriceAdjustmentsStateFor>b__1(OrderPriceAdjustmentDto x)
       at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
       at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
       at Vendr.Infrastructure.Persistence.Factories.OrderFactory.BuildState(OrderDto dto, List`1 priceAdjustments, List`1 amountAdjustmentDtos)
       at Vendr.Infrastructure.Persistence.Repositories.OrderRepository.<>c__DisplayClass17_0.<DoProcessDtos>b__11(OrderDto x)
       at System.Linq.Enumerable.SelectListIterator`2.ToList()
       at Vendr.Infrastructure.Persistence.Repositories.OrderRepository.DoProcessDtos(IEnumerable`1 dtos)
       at Vendr.Infrastructure.Persistence.Repositories.OrderRepository.Search(IQuerySpecification`1 query, ISortSpecification`1 sort, Int64 currentPage, Int64 itemsPerPage)
       at Vendr.Core.Services.OrderService.SearchOrders(IQuerySpecification`1 query, ISortSpecification`1 sort, Int64 currentPage, Int64 itemsPerPage)
       at Vendr.Core.Services.OrderService.SearchOrders(IQuerySpecification`1 query, Int64 currentPage, Int64 itemsPerPage)
       at Vendr.Core.Services.OrderService.SearchOrders(Func`2 query, Int64 currentPage, Int64 itemsPerPage)
       at Vendr.Umbraco.Web.Controllers.VendrCartController.SearchCarts(CartSearchDto model)
       at lambda_method1218(Closure , Object , Object[] )
       at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    

    Just removing the registration of the BundlePriceAdjuster in UmbracoBuilder doesn't cause any issue but deleting the class from the project triggers the error. I am guessing there are entries in the search results using this now deleted price adjuster and is looking for a type that is no longer in the assembly.

    For now, I have to keep the class in the project with an empty ApplyPriceAdjustments method to keep the error from occuring. Do you have any other suggestions?

    /Daniel

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 13, 2022 @ 08:20
    Matt Brailsford
    0

    Hi Daniel,

    All orders maintain a list of applied price adjustments and these are of the type of the defined price adjustment and so the error you are seeing is because Vendr can't deserialize your historic price adjustments as the type is no longer there.

    Realistically your price adjustment entity should be kept as it is needed to show these historic orders that use them, however you should be OK to remove whatever logic you had to apply the price adjustment, so this should prevent future price adjustments from being applied.

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft