I have a custom pipeline task that checks the capacity of an event every time the cart is updated. I want to return a custom error if the capacity is full, letting the user know that they can not register for that event.
The only thing that I can see is to:
Return PipelineExecutionResult.Error
However that just says that there was an error executing the pipeline, which could have happened in any number of tasks. How would you suggest I return a custom message/value so that i know what task returned the error?
I have a feature request which covers this exact scenario. Until we create the extension to the pipeline system you can use the following trick to make it work:
You can use dynamic order properties to set values on your order or order line. Using this technique you can set a custom message on the order which you can then display on the site for your customer to see.
Basically you'd do the following in your pipeline task:
purchaseOrder["Message"] = "Sorry. Capacity for the selected event is full."
The order property will be part of the XML output when you do a CommerceLibrary:GetBasket() in your XSLT. From there you can display it however you want.
Custom Error From Pipeline Task
I have a custom pipeline task that checks the capacity of an event every time the cart is updated. I want to return a custom error if the capacity is full, letting the user know that they can not register for that event.
The only thing that I can see is to:
However that just says that there was an error executing the pipeline, which could have happened in any number of tasks. How would you suggest I return a custom message/value so that i know what task returned the error?
Hi Sean,
I have a feature request which covers this exact scenario. Until we create the extension to the pipeline system you can use the following trick to make it work:
You can use dynamic order properties to set values on your order or order line. Using this technique you can set a custom message on the order which you can then display on the site for your customer to see.
Basically you'd do the following in your pipeline task:
The order property will be part of the XML output when you do a CommerceLibrary:GetBasket() in your XSLT. From there you can display it however you want.
Hope this helps.
Hello Søren,
I'm starting up a new UCommerce project and was wondering if that feature request you mentioned made it into the current release?
-Sean
Hi Sean,
Sorry. It hasn't. The outlined method is still the way to go.
Could I interest you in a full marketing suite or recurring payments instead perhaps? :)
is working on a reply...