Imagine being paid to improve your favorite CMS!

It could be you! Umbraco HQ are hiring and are looking for both talents and senior developers. Wonderful workplace, friendly colleagues and competitive salary.

Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Chris 34 posts 134 karma points
    Jun 26, 2015 @ 13:06
    Chris
    0

    uCommerce Custom pipeline not executing

    I've created a custom OrderStatus in the uCommerce_OrderStatus table, and added a new Pipeline 'ToOrderRequiresReview' to it. In the Custom.config I've then added a reference to this Pipeline and also a custom task that would simply send an email to an administrator like this:

    <!-- Pipeline Instance that is called when an order is set to needing a review-->
    <component id="ToOrderRequiresReview"
                   service="UCommerce.Pipelines.IPipeline`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
                   type="UCommerce.Pipelines.OrderProcessing.OrderProcessingPipeline, UCommerce.Pipelines">
      <parameters>
        <tasks>
          <array>
    
            <!--Send email to the admin-->
            <value>${ToOrderRequiresReview.OrderRequiresReview}</value>
    
          </array>
        </tasks>
      </parameters>
    </component>
    
    
    <component
     id="ToOrderRequiresReview.OrderRequiresReview"
     service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
     type="Custom.Services.PipelineTasks.OrderRequiresReviewTask, Custom.Services" />
    

    Using the uCommerce interface when changing the order status this is triggering the Pipeline correctly, however I also want to trigger this Pipeline from my code. I've tried the below code where I'm setting the order status and saving the basket but my pipeline task never executes:

    var basket = TransactionLibrary.GetBasket();
                basket.PurchaseOrder.OrderStatus =
                    OrderStatus.FirstOrDefault(
                        x => x.OrderStatusId == 1000003);
    
    basket.Save();
    
     //I've tried with and without this line of code
     TransactionLibrary.ExecuteBasketPipeline();
    

    Is there something I'm missing here to force this pipeline to trigger?

  • Martin 181 posts 740 karma points
    Jun 26, 2015 @ 18:50
    Martin
    100

    Hi Chris,

    ExecuteBasketPipeline will only trigger BasketPipeline and not any custom pipelines.

    You should be able to trigger custom pipelines by using PipelineFactory

    var customPipeline = PipelineFactory.Create<PurchaseOrder>("ToOrderRequiresReview");
    customPipeline.Execute(basket.purchaseOrder);
    

    I have not tested the code but I'm confident it will work.

    Best regards Martin

  • Chris 34 posts 134 karma points
    Jun 29, 2015 @ 08:30
    Chris
    0

    Perfect, works exactly as expected

Please Sign in or register to post replies

Write your reply to:

Draft