 |
|
 |
|
|
 |
CS2007 Pipelines Question |
 |
 |
|
|
11-13-06 01:42 PM
I'm new to Commerce Server in general and have never worked with
pipelines..so forgive the newbie questions here..
I have products being added to a basket using the default LineItem class and
OrderForm class and currently, the orderforms are working properly. I've
come to a place where I want to calculate the current SubTotal in the
OrderForm, and after doing some reading, it looks like the basket pipeline i
s
the way to go. I'm having a couple of difficulties with getting them to wor
k
however.
1.) Every time I try to run the pipeline..it tells me to configure
MessageManager. Seems easy enough, although, after examinging the web.confi
g
and reading the templated information..it appears that CS2007 assumes I'm
globalizing the site. I'm not..and have no resource files or satellite
assemblies of any kind. Nor can I find a CommerceMessageManager.dll file
anywhere on my system that has cs2007 installed on it, as posted in some
other files . I'm lost for how to get this configured.
2.) Let's say that all of my products have an IsActive boolean flag, and
this will control whether the user sees the item in the products list while
browsing the categories. Since the basket pipeline removes all items that
are out of stock or no longer available.. is there a way to modify the
pipeline so that it can check my custom properties of the Product and remove
the item from the basket if it's been inactivated since the user last viewed
their basket? Is there a link to how to achieve something like this?
Thanks for any help that can be rendered,
Dave
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: CS2007 Pipelines Question |
 |
 |
|
|
11-13-06 01:42 PM
Hi Dave,
First off, I would recommend that you take a look at the CS2007 docs on the
web. They recently released an update to the web which reorganizes and adds
information about the pipeline processing that may answer some of your
questions.
As for sub-total calculation you are correct in the use of the basket
pipeline. Pipelines encapsulate sequential workflow for business process.
An example of this are the steps required to calculate a sub-total (e.g. get
catalog information, ensure products in the cart are all valid, check
inventory, remove invalid items, calculate line item extended price,
calculate total), a total, and pre-order steps (e.g. payment authorization,
final inventory allocation). Pipelines split this work up into stages.
Each stage is a gate to ensure that the previous steps succeeded to a
certain level before going onto the next. In each stage you have a
component which performs a particular task.
Pipelines today run as a COM-based system. As a .NET developer you'll
notice some oddities between the interop if you haven't worked with the
interop scenarios before (e.g. decimals should be wrapped in CurrencyWrapper
when representing currency values).
Getting to your question the pipeline execution system encloses an instance
of the MessageManager in the context dictionary. This object is a wrapped
COM object which houses the string values that a particular pipeline
component may need (for example, an out-of-stock message used by the
CheckInventory component). Upon execution of a pipeline in the web context
the orders components will attempt to create and send along a MessageManager
with the resources specified in the application configuration file:
<messageManager>
<cultures default="en-US"
baseName="Storefront.WebControls.StringResources"
assembly="Storefront.WebControls">
<culture id="en-US" />
</cultures>
<resources>
<resource id="pur_badplacedprice" />
<resource id="pur_badshipping" />
<resource id="pur_badhandling" />
<resource id="pur_badtax" />
<resource id="pur_badverify" />
<resource id="pur_item_unavailable" />
<resource id="pur_quantity_restriction_exceeded" />
<resource id="pur_out_of_stock" />
<resource id="pur_out_of_stock_hard" />
<resource id="pur_out_of_stock_soft" />
<resource id="pur_reservation_expired" />
<resource id="pur_payment_method_required" />
<resource id="pur_payment_method_declined" />
</resources>
</messageManager>
In the above the pipeline components will be looking for a resource named
Storefront.WebControls.StringResources inside an assembly named
Storefront.WebControls. The project named Storefront.WebControls has a
StringResources.resx file located in the root folder of the project.
Location is important - placing the file in a sub-folder will potentially
change the namespace of the file. If you are unsure you can use a tool like
Reflector <http://www.aisto.com/roeder/dotnet/> to validate the resource
name inside the assembly. Because we've specified a culture (you can have
many), the resource manager will specifically be looking for
StringResources.en-US.resx. One thing to be aware of is that the
MessageManager doesn't gracefully fail in the same manner that the .NET
Resource Management system does when it comes to languages and entries that
do not exist.
As for removing products that are flagged as not being active there
certainly is a way to remove them. In this case you will need to write your
own custom pipeline component. Check out the MinMaxShipping sample as a
starting point. I have a half-written blog post on writing pipeline
components as well that I'm endeavoring to finish off tomorrow and post. It
should also answer your questions further...
Hope that helps!
Colin
"Dave Marini" <DaveMarini@discussions.microsoft.com> wrote in message
news:51F63661-78D2-4BBF-8C4A-93DA10357B90@microsoft.com...
> I'm new to Commerce Server in general and have never worked with
> pipelines..so forgive the newbie questions here..
>
> I have products being added to a basket using the default LineItem class
> and
> OrderForm class and currently, the orderforms are working properly. I've
> come to a place where I want to calculate the current SubTotal in the
> OrderForm, and after doing some reading, it looks like the basket pipeline
> is
> the way to go. I'm having a couple of difficulties with getting them to
> work
> however.
>
> 1.) Every time I try to run the pipeline..it tells me to configure
> MessageManager. Seems easy enough, although, after examinging the
> web.config
> and reading the templated information..it appears that CS2007 assumes I'm
> globalizing the site. I'm not..and have no resource files or satellite
> assemblies of any kind. Nor can I find a CommerceMessageManager.dll file
> anywhere on my system that has cs2007 installed on it, as posted in some
> other files . I'm lost for how to get this configured.
>
> 2.) Let's say that all of my products have an IsActive boolean flag, and
> this will control whether the user sees the item in the products list
> while
> browsing the categories. Since the basket pipeline removes all items that
> are out of stock or no longer available.. is there a way to modify the
> pipeline so that it can check my custom properties of the Product and
> remove
> the item from the basket if it's been inactivated since the user last
> viewed
> their basket? Is there a link to how to achieve something like this?
>
> Thanks for any help that can be rendered,
>
> Dave
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: CS2007 Pipelines Question |
 |
 |
|
|
11-13-06 01:42 PM
Colin,
Thanks for your response. I did eventually get the messageManager to work
by using the RCXml2Resx tool on the RC.xml file that comes with cs2007. I
then used VS2005 to generate the Satellite Assy's and get everything to
compile correctly. Your right about the directory structure making the
generated namespace tedious, but ildasm was helpful in that regard.
I looked at alot of the M$ documentation on pipelines but I couldn't find a
full example of how the system can detect potential problems in the basket
and allow for user feedback. For example, I have the basket pipeline workin
g
now, but let's say the user has a product in their basket that's been left
around for say...2 months.. they come back and a product is no longer
offered. The pipeline will say that a product was removed from their basket
as it was no longer ordered. As a customer..I would want to know WHAT
product as it's been 2 months and I might not remember what I put in my
basket. Does the pipeline enable this type of check? From the examples I've
seen of running a pipeline, I'm not even sure how to check the basket errors
because there isn't an example of a pipeline with feedback..i'm sure I can
figure it out, but it would be nice as for me, this piece probably the
hardest to get the hang of in the Commerce Server System.
Also, while I can definitely see the need for pipelines and their value from
the cs2002 standpoint, it seems to me that a .net function using the
TransactionScope class can accomplish the same types of results without
having to go through the trouble of making a COM interfacable component. Is
there a Compelling reason to use them over writing a custom function to
remove invalid items from the cart?
Thanks again for the insight. It was quite helpful.
Dave
"Colin Bowern" wrote:
> Hi Dave,
>
> First off, I would recommend that you take a look at the CS2007 docs on th
e
> web. They recently released an update to the web which reorganizes and ad
ds
> information about the pipeline processing that may answer some of your
> questions.
>
> As for sub-total calculation you are correct in the use of the basket
> pipeline. Pipelines encapsulate sequential workflow for business process.
> An example of this are the steps required to calculate a sub-total (e.g. g
et
> catalog information, ensure products in the cart are all valid, check
> inventory, remove invalid items, calculate line item extended price,
> calculate total), a total, and pre-order steps (e.g. payment authorization
,
> final inventory allocation). Pipelines split this work up into stages.
> Each stage is a gate to ensure that the previous steps succeeded to a
> certain level before going onto the next. In each stage you have a
> component which performs a particular task.
>
> Pipelines today run as a COM-based system. As a .NET developer you'll
> notice some oddities between the interop if you haven't worked with the
> interop scenarios before (e.g. decimals should be wrapped in CurrencyWrapp
er
> when representing currency values).
>
> Getting to your question the pipeline execution system encloses an instanc
e
> of the MessageManager in the context dictionary. This object is a wrapped
> COM object which houses the string values that a particular pipeline
> component may need (for example, an out-of-stock message used by the
> CheckInventory component). Upon execution of a pipeline in the web contex
t
> the orders components will attempt to create and send along a MessageManag
er
> with the resources specified in the application configuration file:
>
> <messageManager>
> <cultures default="en-US"
> baseName="Storefront.WebControls.StringResources"
> assembly="Storefront.WebControls">
> <culture id="en-US" />
> </cultures>
> <resources>
> <resource id="pur_badplacedprice" />
> <resource id="pur_badshipping" />
> <resource id="pur_badhandling" />
> <resource id="pur_badtax" />
> <resource id="pur_badverify" />
> <resource id="pur_item_unavailable" />
> <resource id="pur_quantity_restriction_exceeded" />
> <resource id="pur_out_of_stock" />
> <resource id="pur_out_of_stock_hard" />
> <resource id="pur_out_of_stock_soft" />
> <resource id="pur_reservation_expired" />
> <resource id="pur_payment_method_required" />
> <resource id="pur_payment_method_declined" />
> </resources>
> </messageManager>
>
> In the above the pipeline components will be looking for a resource named
> Storefront.WebControls.StringResources inside an assembly named
> Storefront.WebControls. The project named Storefront.WebControls has a
> StringResources.resx file located in the root folder of the project.
> Location is important - placing the file in a sub-folder will potentially
> change the namespace of the file. If you are unsure you can use a tool li
ke
> Reflector <http://www.aisto.com/roeder/dotnet/> to validate the resource
> name inside the assembly. Because we've specified a culture (you can have
> many), the resource manager will specifically be looking for
> StringResources.en-US.resx. One thing to be aware of is that the
> MessageManager doesn't gracefully fail in the same manner that the .NET
> Resource Management system does when it comes to languages and entries tha
t
> do not exist.
>
> As for removing products that are flagged as not being active there
> certainly is a way to remove them. In this case you will need to write yo
ur
> own custom pipeline component. Check out the MinMaxShipping sample as a
> starting point. I have a half-written blog post on writing pipeline
> components as well that I'm endeavoring to finish off tomorrow and post.
It
> should also answer your questions further...
>
> Hope that helps!
> Colin
>
> "Dave Marini" <DaveMarini@discussions.microsoft.com> wrote in message
> news:51F63661-78D2-4BBF-8C4A-93DA10357B90@microsoft.com...
>
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: CS2007 Pipelines Question |
 |
 |
|
|
11-13-06 01:42 PM
Hi Dave,
You are right that the out-of-the-box components don't provide any
indication of what product was removed. I ended up replacing the
RequiredProdInfo component with my own which would remove the item and
provide a more descriptive error message. I am working to post a sample
version of RequiredProdInfo and a tax component on my blog shortly
(http://colin.rockstarguys.com).
As for how to get that feedback the magic property is the _Basket_Errors and
_Purchase_Errors collections on the order form. Inside a pipeline component
you would access them as:
IDictionary orderForm = (IDictionary)pDispOrder;
ISimpleList basketErrors = (ISimpleList)orderForm["_Basket_Errors"];
basketErrors.Add("my error message");
Back in your web application your order form would expose the collection:
Basket basket = orderContext.GetBasket(userId);
ISimpleList basketErrors =
(ISimpleList)basket.OrderForms[0]["_Basket_Errors"];
As for the COM legacy bits - it's mainly useful to stay inline and leverage
the out-of-the-box components to keep things all in the same place. You
could also write your own function, but I've foudn the idea of isolating the
operations into tasks appealing from a long term maintenance perspective.
The COM Interop issues are just a minor pain once you get used to them. I
think the team made a decision to stay put with the COM stuff with this
release pending the .NET Framework 3.0 release. Windows Workflow Foundation
is a likely contender to replace the COM bits in the next release of
Commerce Server.
Cheers,
Colin
"Dave Marini" <DaveMarini@discussions.microsoft.com> wrote in message
news:D93E866F-CF34-4C51-A1F4-FCAB309C7B22@microsoft.com...[vbcol=seagreen]
> Colin,
>
> Thanks for your response. I did eventually get the messageManager to work
> by using the RCXml2Resx tool on the RC.xml file that comes with cs2007. I
> then used VS2005 to generate the Satellite Assy's and get everything to
> compile correctly. Your right about the directory structure making the
> generated namespace tedious, but ildasm was helpful in that regard.
>
> I looked at alot of the M$ documentation on pipelines but I couldn't find
> a
> full example of how the system can detect potential problems in the basket
> and allow for user feedback. For example, I have the basket pipeline
> working
> now, but let's say the user has a product in their basket that's been left
> around for say...2 months.. they come back and a product is no longer
> offered. The pipeline will say that a product was removed from their
> basket
> as it was no longer ordered. As a customer..I would want to know WHAT
> product as it's been 2 months and I might not remember what I put in my
> basket. Does the pipeline enable this type of check? From the examples
> I've
> seen of running a pipeline, I'm not even sure how to check the basket
> errors
> because there isn't an example of a pipeline with feedback..i'm sure I can
> figure it out, but it would be nice as for me, this piece probably the
> hardest to get the hang of in the Commerce Server System.
>
> Also, while I can definitely see the need for pipelines and their value
> from
> the cs2002 standpoint, it seems to me that a .net function using the
> TransactionScope class can accomplish the same types of results without
> having to go through the trouble of making a COM interfacable component.
> Is
> there a Compelling reason to use them over writing a custom function to
> remove invalid items from the cart?
>
> Thanks again for the insight. It was quite helpful.
>
> Dave
>
> "Colin Bowern" wrote:
>
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
|
Sponsored Links |
 |
 |
|
|
 |
All times are GMT. The time now is 06:00 AM. |
 |
|
|
 |
|
 |
|
|
 |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
|
|
|
|
Medical and Health forum | Computer Games Reviews | Graphics design forum
|
 |
|
 |
|