Copied to clipboard

Flag this post as spam?

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


  • John C Scott 473 posts 1183 karma points
    May 20, 2015 @ 17:39
    John C Scott
    0

    custom orderline price calculator

    I'm using Umbraco 7.2.4 with Tea Commerce 3.0.2 for Umbraco 7

    The price is updated according to some complex logic stored in an archetype based on chosen options for the product.

    I'd like to use a custom orderline price calculator to calculate the price based upon the selected options.

    When I try to use the example in the documentation https://documentation.teacommerce.net/net-api/price-calculators/order-line-calculator/ for the Order Line Calculator

    I get a build error:

    Error 1 'DavidThornber.TC.CustomOrderLineCalculator.CalculatePrice(TeaCommerce.Api.Models.OrderLine, TeaCommerce.Api.Models.Currency, TeaCommerce.Api.Models.Order)': cannot change access modifiers when overriding 'public' inherited member 'TeaCommerce.Api.PriceCalculators.OrderLineCalculator.CalculatePrice(TeaCommerce.Api.Models.OrderLine, TeaCommerce.Api.Models.Currency, TeaCommerce.Api.Models.Order)' D:\Projects\etch\david-thornber\DavidThornber.TC\PriceCalculators.cs 16 30 DavidThornber.TC

    This is the code I have:
    using TeaCommerce.Api.Dependency;
    using TeaCommerce.Api.InformationExtractors;
    using TeaCommerce.Api.Models;
    using TeaCommerce.Api.PriceCalculators;
    using TeaCommerce.Api.Services;
    
    namespace DavidThornber.TC
    {
      [SuppressDependency( "TeaCommerce.Api.PriceCalculators.IOrderLineCalculator", "TeaCommerce.Api" )]
      public class CustomOrderLineCalculator : OrderLineCalculator {
    
        public CustomOrderLineCalculator( IVatGroupService vatGroupService, IProductInformationExtractor productInformationExtractor )
          : base( vatGroupService, productInformationExtractor  ) {
        }
    
        protected override Price CalculatePrice( OrderLine orderLine, Currency currency, Order order ) {
          return new Price( 100M, orderLine.VatRate, currency );
        }
    
      }
    }

     

  • John C Scott 473 posts 1183 karma points
    May 20, 2015 @ 17:53
    John C Scott
    101

    solution seems to be very simple

    i changed protected to public and it compiles fine :)

Please Sign in or register to post replies

Write your reply to:

Draft