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.

  • Kim Søjborg Pedersen 71 posts 275 karma points
    Jun 14, 2013 @ 11:30
    Kim Søjborg Pedersen
    0

    Problem with multiple e-mails on ToCompletedOrder pipeline

    I have extended the ToCompletedOrder pipeline with the ToCompletedOrder.SendPayedEmail component so when a order change status from new to completed the system sends a e-mail. The problem is that if the user clicks multiple times on the "Update status" button in the Change oreder status dialog the system sends multiple emails. How can I prevent this?

    See config here for details:

     

    <configuration>
      <components>
        <!-- Pipeline Instance -->
        <component id="ToCompletedOrder"
      service="UCommerce.Pipelines.IPipeline`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
      type="UCommerce.Pipelines.OrderProcessing.OrderProcessingPipeline, UCommerce.Pipelines">
          <parameters>
            <tasks>
              <array>
                <value>${ToCompletedOrder.AcquirePaymentTask}</value>
                <value>${ToCompletedOrder.SendPayedEmail}</value>
              </array>
            </tasks>
          </parameters>
        </component>
        <!-- Pipeline Tasks-->
        <component id="ToCompletedOrder.AcquirePaymentTask"
      service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
      type="UCommerce.Pipelines.OrderProcessing.AcquirePaymentTask, UCommerce.Pipelines" />
        <component id="ToCompletedOrder.SendPayedEmail"
           service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
           type="UCommerce.Pipelines.Common.SendEmailTask, UCommerce.Pipelines" >
          <parameters>
            <emailTypeName>ToCompletedOrderEmail</emailTypeName>
          </parameters>
        </component>
      </components>
    </configuration>

     

     

  • Morten Skjoldager 440 posts 1499 karma points
    Jun 17, 2013 @ 13:50
    Morten Skjoldager
    0

    Unfortunatly there's no way to override execute on the Orderprocessing pipeline. However the ToCompletedOrder pipeline is executed when the order changes status. You could create a new pipeline that would only trigger if the order is not allready acquired. Here's some pseudo code:

    public class MyPipeLine : IPipeline<PurchaseOrder>
        {
            private readonly IPipelineTask<PurchaseOrder>[] _tasks;
    
            public MyPipeLine(IPipelineTask<PurchaseOrder>[] tasks)
            {
                _tasks = tasks;
            }
    
    
            public PipelineExecutionResult Execute(PurchaseOrder subject)
            {
    //          if (subject is acquired)
                //return
    
                //foreach task run
            }
        }
  • Morten Skjoldager 440 posts 1499 karma points
    Jun 17, 2013 @ 13:55
    Morten Skjoldager
    0

    In the custom.config you would want to override the ToCompletedOrder component by id so the orderservice wold recieve your pipeline instead of the old one like this: 

    Just remember to inject the tasks like you do in your current configuration. 

    Hope that helps. Otherwise let me know :) 

    <component id="ToCompletedOrder"

      service="UCommerce.Pipelines.IPipeline`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"

      type="My.NameSpace.MyCustomPipeLine, My.Assembly">

  • Morten Skjoldager 440 posts 1499 karma points
    Jun 17, 2013 @ 13:58
    Morten Skjoldager
    0

    Another solution is to do the same thing, but with the orderService instead. You could check if the order status is allready the same as your're trying to change it to. Otherwise call base.changeOrderStatus. 

     

  • Kim Søjborg Pedersen 71 posts 275 karma points
    Jun 17, 2013 @ 14:47
    Kim Søjborg Pedersen
    0

    okay thanks is it possible the you fix the issue in the uCommerce interface? Do uCommerce have a backlog or somthing where I can report the bug?

  • Morten Skjoldager 440 posts 1499 karma points
    Jun 21, 2013 @ 14:00
    Morten Skjoldager
    0

    No it's great that you mention it here. We'll take it into consideration and put it into our pipeline. However we cannot tell when it will be fixed. 

Please Sign in or register to post replies

Write your reply to:

Draft