LowChuanHoe

HI,

I am a newbie to commerce server 2007 and currently i am doing R&D on commerce server 2007. I have a big doubt in the pipeline and do not know how to play around with it. I read through lot of articles on pipeline but still can really understand what it is. My question now is how could i using a pipeline (develop, execute) from my application start from scratch. For example, i see lots of example from the net using a Basket object to run the pipeline. Could anyone tell me in details on how could i start my very first pipeline project and run it in order to get it works as i really stuck. Thanks.

Chuan Hoe



Re: Commerce Server 2007 Prerequisites to RunPipeLine

Paul Tew

Hi

The predefined pipelines should fulfill your needs. I've had to add additional stages (pipeline components) to our sites for specific purposes like calculating tax based on billing addresses.

The Basket pipeline makes sure that your line items have the correct price, the correct display name etc.

The Total pipeline is used to split your order into shipments (as CS supports many), determines tax totals, and updates the total fields.

Paul





Re: Commerce Server 2007 Prerequisites to RunPipeLine

LowChuanHoe

Hi Paul,

Thanks for your reply. I have few question over here.

1. How do pipeline get values from. For example, for all the components in the pipeline, how does the components accept values for processing.

2. Why do we need to use a basket to process pipeline Is it because of basket contain the information need to be processed by the pipeline.

3. After run the pipeline, we can only know whether is success or fail, what if we get fail result, how do we check where the errors come from

Hope to get clarification from you. Thanks

Chuan Hoe





Re: Commerce Server 2007 Prerequisites to RunPipeLine

SteveDDAY

Hi Chuan,

I went through the same problem about a week ago and now I fully understand pipelines by reading some great documentation written by Max Akbar. He has written 4 tutorials which illustrate how to create your first pipeline project then onto about debugging a pipeline.

Pipeline is just an interface to accessing your order_form and manipulating line items, prices etc all associated in this object.

Here is a link to Max Akbar tutorials which I suggest looking at first:

http://blogs.msdn.com/maxakbar/archive/2006/08/17/705473.aspx

You really need to spend some time doing every tutorial until you become comfortable using pipelines.

All the best.





Re: Commerce Server 2007 Prerequisites to RunPipeLine

SteveDDAY

Hi Chaun,

Here is some source code which should give you an understanding about how a pipeline executes:

int IPipelineComponent.Execute(object pdispOrder, object pdispContext, int lFlags)
{
int returnValue = 1; // OPPERRORLEV_SUCCESS
IDictionary orderForm = (IDictionary)pdispOrder;

orderForm["_cy_oadjust_subtotal"] = new decimal(88.0);
orderForm["_cy_tax_total"] = new decimal(10.95);
orderForm["_cy_shipping_total"] = new decimal(7.95);
orderForm["_cy_total_total"] = new decimal(106.90);

//Manipulate the line items in an order and update the price for each line item

ISimpleList items = (ISimpleList)orderForm["items"];
for (int i = 0; i < items.Count; i++)
{
IDictionary item = (IDictionary)itemsIdea;
string productId = item["product_id"].ToString();

item["cy_placed_price"] = new decimal(61.92);

}

return returnValue;

}





Re: Commerce Server 2007 Prerequisites to RunPipeLine

LowChuanHoe

HI Steve,

Thank you for your reply.

Basically, what is the purpose of using a pipeline. According to you, pipeline is just an interface to accept values from OrderForm object, meaning we must assign all the values to our object before executing it For example, can i create my own pipeline component and create a new pipeline.pcf and add my own component into it such as a simple calculation. Maybe i do not get the actually meaning of using a pipeline. Is pipeline specifically for processing order. What is the different of using dll with pipeline. Because it is pretty much black box and i do not get to see how it is actually processed as compare with normally debugging where i can see the flow of the programming executing. Please be patient with me as i may ask some irrelevant and simple question as i totally new to pipeline terms. Hope to get your clarification . Thanks

Chuan Hoe





Re: Commerce Server 2007 Prerequisites to RunPipeLine

Paul Tew

Hi

The CS Pipelines cover a number of different areas of functionality, depending on whether you are running the Basket or Total pipelines etc. In short, you could choose to implement the functions the different pipelines implement on your webpages. However, the CS team put much of the code in pipelines so you don't need to do it yourself. It's probably worth me explaining what the major pipelines do:

The Basket pipeline should run executed when new line items are added to the basket. By default, the Basket pipeline does the following: 1) sets the line item display name 2) checks the inventory 3) calculates the item prices based on quantity etc 3) reserves promotional codes 4) applies any basket level discounts 5) sets the basket subtotal

The Total pipeline should be run during the various stages of the checkout process. During the checkout process your code will set one or more billing addresses, set one of more delivery addresses, add one or more payment methods. The total pipeline does the following: 1) splits the order into one or more shipments 2) sets any shipment discounts 3) adjusts the shipping totals in accordance with the shipment promotional codes (e.g. free delivery) 4) sets the handling charge for each shipment 5) calculates order level tax totals 6) sets the order total

The Checkout pipeline should be executed when the customer places the order. It does the following: 1) Checks for a payment method 2) redeems any promotional codes 3) updates the inventory 4) records the commerce server events.

I'm not sure whether it has already been stated that the pipeline will only continue once any required permissions have been met. Each pipeline is made up of multiple pipeline components. Should your situation require it, you can create your own pipeline component which can then be added to any existing pipeline.

I hope that helps

Paul





Re: Commerce Server 2007 Prerequisites to RunPipeLine

SteveDDAY

Hi Chuan,

As the last post said you don't need to work about the precompiled DLL in a pipeline as it has already been developed for us.

If for example you needed to update the prices of line_items in a order you could easily write a component and then add the component to execute at a later stage in the basket pipeline.

Now if you wanted to do some simple calculation to alter your shopping cart, you would need to create a new component and then integrate this component into an existing pipeline PCF file.

When you make a call using the API to call a pipeline you are passing through the object Order_Form. This is sent through to the pipeline which you can access in the Execute stage. Spend some time understanding about commerce servers basket it should all come together in the end.





Re: Commerce Server 2007 Prerequisites to RunPipeLine

LowChuanHoe

Hi Steve and Paul,

Thanks for you guys valuable explanation. I would really need to spend some time in understanding the whole architecture of pipeline and will raise question if i do have any doubts and queries. Thanks alot Smile

Chuan Hoe





Re: Commerce Server 2007 Prerequisites to RunPipeLine

LowChuanHoe

Hi,

I have a query over here, while i am running my basket pipeline, if i get my PipelineExecutionResult with warning, how could i know what error is inside, can i retrieve from my OrderForm object. please advise. Thanks.





Re: Commerce Server 2007 Prerequisites to RunPipeLine

Joseph Johnson

LowChaunHoe,

the "_Basket_Errors" and "_Purchase_Errors" hash keys attached to your OrderForm object *should* contain the error messages associated with the warning.

Code Snippet

basket.OrderForms[0]["_Basket_Errors"]

You can read a little more about it on David Messener's blog:

http://blogs.msdn.com/davidme/archive/2006/03/06/transactional-pipeline-components-and-error-handling.aspx

If you turn on pipeline logging, the associated error message should be in the log file as well.