Campaign price in overriden CalculateFromCarrier

We are ovveriding the CalculateFromCarrier to count on some custom things. But we encountered a problem. If the product has a campaign price on itself, I cannot see this here.
How do I find the campaign price?

When testing im using “set a campai:hot_face:gn price on product”. And it’s displayed on the product. But when I’m in my function I cant see the campaign price.
Why cant I? And how do I access this so I can count the right way? Cause now our totalprice for the orderrow can be a negative number. Cause the discount I do in the custom function gets more than the campaign price (not more than the original).

  public new void CalculateOrderRowTotal(OrderRowCarrier orderRow)
        {
            var num = orderRow.CampaignID != Guid.Empty ? orderRow.UnitCampaignPrice : orderRow.UnitListPrice;
            decimal originDiscount = num * orderRow.Quantity * orderRow.DiscountPercentage * new Decimal(1, 0, 0, false, (byte)2);

            decimal discount = 0;
            if (!string.IsNullOrEmpty(orderRow.Comments) && !orderRow.IsAutoGenerated)
            { 
                var variants = new OrderCarrierCommentUtilities().GetArticleNumbers(orderRow.Comments);
                if (variants != null && variants.Any())
                {
                    var discountSubscriptionFee = 0;
                    var months = 0;
                    foreach (var id in variants)
                    {
                        var variant = IoC.Resolve<VariantService>().Get(id);
                        discount += variant.Fields.GetValue<int>("SubscriptionDiscount");

                        var fieldDiscountSubscriptionFeeValue = variant.Fields.GetValue<int>("DiscountSubscriptionFee");
                        if (fieldDiscountSubscriptionFeeValue > 0)
                        {
                            discountSubscriptionFee = fieldDiscountSubscriptionFeeValue;
                        }
                        var fieldMontsValue = variant.Fields.GetValue<int>("SubscriptionMonths");
                        if (fieldMontsValue > 0)
                        {
                            months = fieldMontsValue;
                        }
                    }

                    discount += months > 0 ? discountSubscriptionFee * months : discountSubscriptionFee;

                    if (string.IsNullOrEmpty(orderRow.DiscountDescription) && orderRow.DiscountDescription != ChangedConstant && discount > 0)
                    {
                        var vat20Percentage = Decimal.Parse(CurrentState.Current.WebSite.As<OrderB2CWebSiteStrings>().SubscriptionDisountFeeVat) / 100;

                        decimal newDiscount = originDiscount + (discount - discount * vat20Percentage);
                        if (newDiscount >= orderRow.TotalPrice)
                        {
                            newDiscount = orderRow.TotalPrice - 1;
                        }

                        orderRow.DiscountDescription = ChangedConstant;
                        orderRow.DiscountAmount = newDiscount;
                    }
                }
                else
                {
                    orderRow.DiscountAmount = originDiscount;
                }
            }

            orderRow.TotalPrice = num * orderRow.Quantity - orderRow.DiscountAmount;
        }

Litium version: 6.2.3-patch-1811190921

Depend on how the call stack is the ‘new’ keyword can make the execution to take a base implementation instead of the expected one. Are you sure the correct method is used?

Yes, I know this is used. Were using it and have been using this for a while. But the big question is why can’t I see the campaign price at this point?

Is it all product campaigns or only BuyXPayY campaign type?

I think the reason is that you using the default IOrderCalculator that will call the IOrderTotalCalculator before ICampaignCalculator, that means that the campaign prices is added to each the order row after the total calculations have been made.

Ok. But how can I make sure when calculation that the price discount im setting is too much.
Cause now the discount is calcluated on the original price and not the campaign price, so the discount price is too much so it gets to a negative sum

The campaigns are calculating the prices on the UnitListPrice, some campaings can calculate on UnitCampaignPrice if the order row have an assigned CampaignID and the campaign is marked to work on existing campaign prices.

The actual calculation as you doing here should probably be a campaign with a special campaign action that will fetch the discount amount from the variant instead of fixed from the campaign. Then you are able to combine this campaign with other campaigns or the merchant can select to not combine the campaign with a specific campaign if they want.

We can’t use campaigns for this. That’s why we have the calculation here. But I need to see if there is a campaign on the products so the calculations gets right. So if I cant see it here how do I do? There must be some way to get right price.

As @Patric has mentioned, the issue is with new operator.
instead of following:

public new void CalculateOrderRowTotal(OrderRowCarrier orderRow)

you need to do

public void CalculateOrderRowTotal(OrderRowCarrier orderRow)

and to do that, extend the interface

    [Plugin("Default")]
    public class CustomOrderTotalCalculator : IOrderTotalCalculator

Still something else is happening after my code. So after I set the discount and total price it’s get a new price after this gets set…
Nvm seems like I had to remove my vat from totalprice calculation