Developer forum

Forum » Development » Order.Steps.Completed notification not running

Order.Steps.Completed notification not running

Martin Nielsen
Reply
Hi DW,

I've added a notification for Order.Steps.Compelted, but for some reason it's never used.
I'm using Cart v2, and i've made sute that my order i valid. I also reach the last step in my orderflow.






Replies

 
Martin Nielsen
Reply
[Dynamicweb.Extensibility.Subscribe( Dynamicweb.Notifications.eCommerce.Order.Steps.Completed )]
public class OnOrderCompleted : Dynamicweb.Extensibility.NotificationSubscriber
{
  public override void OnNotify( string notification, object[] args )
  {
    if ( args == null || args.Length != 3 )
      return;

    Dynamicweb.eCommerce.Orders.Order order = (Dynamicweb.eCommerce.Orders.Order)args[0];
    Dynamicweb.Frontend.Extranet extranet = (Dynamicweb.Frontend.Extranet)args[1];
    Dynamicweb.Frontend.PageView pw = (Dynamicweb.Frontend.PageView)args[2];
}

I've inserted break points in the above code but i't never reached.

Am i missing something obvious?

// Martin
 
Mikkel Høst
Reply
 Hey Martin.

I have had some "problems" with these NotificationSubscriber that they are some how fired 2 times so my best guess is that your args.Length is 5 or 6.

Another possible cause could be that u use object[] args insted of Notifications args

public override void OnNotify(string notification, 
NotificationArgs argsBase) 
        { }
Hope it helps
 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

Hi Martin

Your notification subscriber is not invoked because the notification you're listening for is a CartV1 notification and it does not exist for CartV2. The notification you should be listening for would probably be either OrderIsPassedToCheckoutHandler or CheckoutDoneOrderIsComplete.

You can see all the notifications here: http://developer.dynamicweb-cms.com/Admin/Public/DWSDownload.aspx?File=Files%2fFiler%2fDocumentation%2fDevelopment%2feCommerce%2f(en-US)+Shopping+Cart+v2+Extensibility.pdf

- Jeppe

Votes for this answer: 0
 
Martin Nielsen
Reply

I was listening for the wrong event. CheckoutDoneOrderIsComplete did the trick.
Some might call that an obvious mistake :-P

Thanks Jeppe.

 

You must be logged in to post in the forum