I am still trying to get my head round Ucommerce, and must admit I am finding it quite difficult and am falling at just about every hurdle! (maybe because I am also quite new to umbraco and xslt?!)
I have set up my shop (using the demo shop) and added some test products, one of my products is a ticket and when an order has been placed I need to send the ticket ordered to the customer by email.
I am assuming I need to do this using a pipeline, and put it in the order status table to run on order complete? but I am having trouble understanding how I do that?
Do you have the pipeline file setup in umbraco > UCommerce > Pipelines > [Name of Pipeline].config
I have a setup that does the same thing but, sends an email when the Order has been processed. So, in the uCommerce_OrderStatus table I have an entry with name Processed and Pipeline value of : OrderStatus-Processed.config
I must admit I'd so far got nowhere.. I was about to try decompiling ucommerce if I could to see if I could see how it was done in their code! Seemed the only way to go as I really want to use this and i'm so confused and documentation appears to be really lacking!
Anyway..
So to be clear;
I have created a class that looks something like this:
Is this correct? (I will do my emailing stuff in the foreach loop) I can get all details of the order here.. but can I also get the user details? if so how?
Then I need to create myself a new config file like the checkout config and basket one. I will call it something like OrderProcessed.config and use your example above? Will the "PurchaseOrder" be passed in if I follow your example? If so which bit signifies this, and how do I pass in other stuff if needed?
Then in the orderstatus table do I put "OrderProcessed.config" in the pipeline column, or do I put the class name or something else? I suppose my question is; is the xml referred to as the pipeline or is the actual code?
This is where you would put the assembly and namespace of the class that you are created in your example.
In order to get the email address you have a couple of options.
You can get it from the customer by using:
order.Customer.EmailAddress
Or from the billing address using:
order.GetBillingAddress().EmailAddress
Or from the shipping address using:
order.GetShippingAddress()().EmailAddress
In my code I am using the billing address version, because I want to notify the person that is paying for it that their order has been processed.
In the order status table you put the name of the config file without the .config.
I make it a habit to make sure that the config file name (without the .config) matches the id attribute in the file:
<component id="OrderStatus-Processed"
So in the example I provided my file name is OrderStatus-Processed.config, component id is OrderStatus-Processed and the entry in the order status table is OrderStatus-Processed.
The xml file is what is referred to as the "Pipeline" then each pipeline has "tasks" which are the individual classes that you create (like your example). So if you look at one of the default pipelines like Basket.config, you'll see that it has a number of task that it runs through.
Everything looks correct, the order status table should be the name without the ".config"
Also it doesn't look like you have your Pipeline instance setup properly.
Here is a rough cut of my VB :
Namespace WSC.Pipelines.OrderStatus
Public Class OrderStatusPipeline
Inherits Pipeline(Of PurchaseOrder)
Public Sub New(ByVal tasks As IPipelineTask(Of PurchaseOrder)())
MyBase.New(tasks)
End Sub
End Class
Public Class OrderProcessed
Implements IPipelineTask(Of PurchaseOrder)
Public Function Execute(ByVal subject As UCommerce.Entities.PurchaseOrder) As UCommerce.Pipelines.PipelineExecutionResult Implements UCommerce.Pipelines.IPipelineTask(Of UCommerce.Entities.PurchaseOrder).Execute
Utilities.SendEmail("from email", subject.Customer.EmailAddress, "Your order has been shipped", "/inc/email_templates/program_order_shipped.html", Nothing)
End Function
End Class
End Namespace
Notice that in my .config file there are both OrderStatusPipeline and OrderProcessed
I really appreciate your helping me and I have translated your code to c#.. I have atually completely copied it to see if I can get it working. The only difference is that my dll is called test. But I think I must be missing something.
This will allow you to look at the umbraco logs, or you could open the database and look at the "umbracoLog" table. All errors in an umbraco website are logged to this table, so you should be able to see what might be causing the problem.
One thing that I forgot to mention, I have found that the Pipeline is not executed for the "New order" status. I think this is a bug and might have been fixed in a later version but doesn't work in the version that I have
Sean.. that could be the reason it's not working? I assume new order is the same as "order complete".. hmmm
Lasse, I've tried setting it all up in Visual Studio and sticking a breakpoint on my pipeline but it never reaches it.
I don't see any errors happening, I have checked the log table. I am not manually changing the status to complete, it's when it does it it's self after the order is placed. Should this make a difference?
I created a quick pipeline component to test the scenario:
Here's the code I used for the task:
namespace MyUCommerceApp.Pipelines
{
public class MyPipelineTask : IPipelineTask<PurchaseOrder>
{
public PipelineExecutionResult Execute(PurchaseOrder subject)
{
subject["MyOrderProperty"] = DateTime.Now.ToString();
return PipelineExecutionResult.Success;
}
}
}
I cheated a little bit and resued the basket pipeline stub already present in uCommerce for my pipeline config which I called OrderStatus.config and placed it in the pipelines folder:
Finally I updated the order status that I'm updating the order to in the database to trigger the pipeline. I wanted to trigger it when going from New Order to Completed Order so I updated the Completed Order status with the pipeline name OrderStatus.
With that complete I now get the date and time set on the order for when the order status was updated. Screenshots might be more helpful to look at though :)
Here's the initial order:
And the order status that I'm updating it to:
And finally the order with the new order property:
Need help creating a pipeline
Hi
I am still trying to get my head round Ucommerce, and must admit I am finding it quite difficult and am falling at just about every hurdle! (maybe because I am also quite new to umbraco and xslt?!)
I have set up my shop (using the demo shop) and added some test products, one of my products is a ticket and when an order has been placed I need to send the ticket ordered to the customer by email.
I am assuming I need to do this using a pipeline, and put it in the order status table to run on order complete?
but I am having trouble understanding how I do that?
I have read this blog http://blog.lasseeskildsen.net/post/uCommerce-Pipelines-Explained.aspx (also posted a message, but felt probably better to post here!), but I don't understand! I also need reference to the orderId, and user details so the ticket I create in code is unique.
Are there any more examples around? or can someone help?
Bex
Do you have the pipeline file setup in umbraco > UCommerce > Pipelines > [Name of Pipeline].config
I have a setup that does the same thing but, sends an email when the Order has been processed. So, in the uCommerce_OrderStatus table I have an entry with name Processed and Pipeline value of : OrderStatus-Processed.config
The pipeline file has the contents of:
Where WSC.Pipelines.OrderStatys.OrderProcessed has my code to send the email.
Hope that helps.
-Sean
Hi Sean!
Thanks so much for your reply!
I must admit I'd so far got nowhere.. I was about to try decompiling ucommerce if I could to see if I could see how it was done in their code!
Seemed the only way to go as I really want to use this and i'm so confused and documentation appears to be really lacking!
Anyway..
So to be clear;
I have created a class that looks something like this:
Is this correct? (I will do my emailing stuff in the foreach loop)
I can get all details of the order here.. but can I also get the user details? if so how?
Then I need to create myself a new config file like the checkout config and basket one. I will call it something like OrderProcessed.config and use your example above? Will the "PurchaseOrder" be passed in if I follow your example? If so which bit signifies this, and how do I pass in other stuff if needed?
Then in the orderstatus table do I put "OrderProcessed.config" in the pipeline column, or do I put the class name or something else?
I suppose my question is; is the xml referred to as the pipeline or is the actual code?
Thanks in advance..
Bex
Ps.. sorry about the code bit.. no idea what happen there and it wont let me edit it!
I have set up a pipe line in the way I think it should work but nothings happening.
Can anyone let me know what I've done wrong? The code is as follows.
Xml File (OrderProcessed.config)
I am putting OrderProcessed.config in the pipeline column under the Completed order status
Bex
@Bex,
That looks correct to me (I mainly develop in VB.Net)
The type attribute in my pipeline.config file tells it what code to use:
This is where you would put the assembly and namespace of the class that you are created in your example.
In order to get the email address you have a couple of options.
You can get it from the customer by using:
Or from the billing address using:
Or from the shipping address using:
In my code I am using the billing address version, because I want to notify the person that is paying for it that their order has been processed.
In the order status table you put the name of the config file without the .config.
I make it a habit to make sure that the config file name (without the .config) matches the id attribute in the file:
So in the example I provided my file name is OrderStatus-Processed.config, component id is OrderStatus-Processed and the entry in the order status table is OrderStatus-Processed.
The xml file is what is referred to as the "Pipeline" then each pipeline has "tasks" which are the individual classes that you create (like your example). So if you look at one of the default pipelines like Basket.config, you'll see that it has a number of task that it runs through.
Hope that helps.
-Sean
@Bex
Everything looks correct, the order status table should be the name without the ".config"
Also it doesn't look like you have your Pipeline instance setup properly.
Here is a rough cut of my VB :
Notice that in my .config file there are both OrderStatusPipeline and OrderProcessed
-Sean
Hi Sean!
I really appreciate your helping me and I have translated your code to c#.. I have atually completely copied it to see if I can get it working.
The only difference is that my dll is called test.
But I think I must be missing something.
my config called OrderStatus-Processed.config
and contains the following
My cs file now contains..
my pipe line column in my db contains "OrderStatus-Processed"
I'm thinking this should be working? Can you see anything I'm missing? Are the references to my Dlls correct in my config?
Bex
Good grief I have no idea what's happened with my code there..
I'l try again:
Config
namespace
WSC.Pipelines.OrderStatus
{
{
:
base(tasks)
{
}
}
{
{
er.. can't get it to format right.. hope you can read it!
@Bex
All the settings look correct to me.
Next thing I would suggest is installing this project: http://our.umbraco.org/projects/developer-tools/falm-housekeeping
This will allow you to look at the umbraco logs, or you could open the database and look at the "umbracoLog" table. All errors in an umbraco website are logged to this table, so you should be able to see what might be causing the problem.
-Sean
@Bex,
One thing that I forgot to mention, I have found that the Pipeline is not executed for the "New order" status. I think this is a bug and might have been fixed in a later version but doesn't work in the version that I have
-Sean
Hi,
@Bex - do you get any errors when changing the order status? Or can you verify by setting a breakpoint in the pipeline task that it runs?
- Lasse
Sean.. that could be the reason it's not working? I assume new order is the same as "order complete".. hmmm
Lasse, I've tried setting it all up in Visual Studio and sticking a breakpoint on my pipeline but it never reaches it.
I don't see any errors happening, I have checked the log table.
I am not manually changing the status to complete, it's when it does it it's self after the order is placed. Should this make a difference?
Hi Bex,
I created a quick pipeline component to test the scenario:
Here's the code I used for the task:
I cheated a little bit and resued the basket pipeline stub already present in uCommerce for my pipeline config which I called OrderStatus.config and placed it in the pipelines folder:
Finally I updated the order status that I'm updating the order to in the database to trigger the pipeline. I wanted to trigger it when going from New Order to Completed Order so I updated the Completed Order status with the pipeline name OrderStatus.
With that complete I now get the date and time set on the order for when the order status was updated. Screenshots might be more helpful to look at though :)
Here's the initial order:
And the order status that I'm updating it to:
And finally the order with the new order property:
Hope this helps.
is working on a reply...