Custom Delivery Builder not being hit

Trevor Fayas asked on October 3, 2017 02:00

Hoping someone can tell me if i'm just crazy or if there is a bug.

I'm trying to overwrite a method in the Default Delivery Builder, my custom module assembly has the AssemblyDiscoverable attribute, and below is my code, but it's not hitting. Oddly the UI Extender in the same project IS being discovered and hit, just not this.

using CMS;
using CMS.Ecommerce;
using CMS.EventLog;
using HBS_Shipping_Extensions;
using System;
using System.Collections.Generic;
using System.Linq;

[assembly: RegisterImplementation(typeof(IDeliveryBuilder), typeof(MyDeliveryBuilder))]
public class MyDeliveryBuilder : DefaultDeliveryBuilder
{
    protected override void AddItems(ShoppingCartInfo cart, Func<ShoppingCartItemInfo, bool> itemSelector = null)
        {
            // Below never hits.
            EventLogProvider.LogEvent("I", "DeliveryBuilder", "AddItemsRan");
        }
}

Anyone see anything? otherwise i'll contact support.

Correct Answer

Anton Grekhovodov answered on October 3, 2017 07:11

Hi Trevor,
I've found that you already implemented this builder (see the latest comment Replace / Overwrite DefaultDeliveryBuilder), maybe on another project. Try to compare your solutions or you can move the class to Old_App_Code to check that some conditions don't affect on execution.
Also, you can check what implementation registered for IDeliveryBuilder by using the following code:

CMS.Core.Service<IDeliveryBuilder>.Entry().GetType()
0 votesVote for this answer Unmark Correct answer

Recent Answers


Trevor Fayas answered on October 3, 2017 15:06

Thanks Anton, i did a solution wide search for "IDeliveryBuilder" but somehow it missed my other implemenatation, but after using your code it showed there was another implementation that i need to remove. Your code trick was awesome! I learned something new and definitely adding that to my list of tools, i need to remove the duplicate.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.