Commerce Server General - Help with Accessing Lineitems within the OrderForm

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > July 2005 > Help with Accessing Lineitems within the OrderForm





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Help with Accessing Lineitems within the OrderForm
gwheeloc

2005-07-29, 2:48 am

Can anyone help me get to the orderform Dictionary items?

I'm at the end of my checkout process and I need to update a user's profile
based on the value of a product's property contained within the order. I
tried using:

foreach (LineItem Item in m_oBasket.OrderForms["Default"].LineItems)
{
if(Item["ProductAttribute"].ToString() == "Yes")
{

}
}
gwheeloc

2005-07-29, 2:48 am

Sorry about the split post.

foreach (LineItem Item in m_oBasket.OrderForms["Default"].LineItems)
{
if(Item["ProductAttribute"].ToString() == "Yes")
{
//update user profile
}
}

No matter which Property I try, it comes back as DBNull. If I run the
diagnostic method: DumpUtils.DumpDictionary() I am returned all the OrderForm
property values and the line items.

Is there another way to get access to these properties that is more
appropriate?

thanks,
gwheeloc
Zoe Hart [MVP]

2005-07-29, 8:07 am

Is the product attribute one that is set in your code somewhere or one that
is coming from the product catalog database. If it is set in your code the
syntax for setting it and accessing it would be the same and the syntax you
posted looks correct. If you are trying to access a product attribute set in
the product catalog data you need to a) run the Basket pipeline or any
pipeline that includes the QueryProdInfo component and b) access it as
Item["_product_ProductAttribute"]. All product catalog attributes are read
in by the QueryProdInfo component and prefixed with "_product_". They are
not persisted to the database when an order is saved, so any time you
retrieve the order from the database you need to run the pipeline in order
to access these attributes.

--
Zoe Hart
Commerce Server MVP

"gwheeloc" <gwheeloc@discussions.microsoft.com> wrote in message
news:C48B9ACF-8411-4248-88B9-12F520FAFE08@microsoft.com...
> Sorry about the split post.
>
> foreach (LineItem Item in m_oBasket.OrderForms["Default"].LineItems)
> {
> if(Item["ProductAttribute"].ToString() == "Yes")
> {
> //update user profile
> }
> }
>
> No matter which Property I try, it comes back as DBNull. If I run the
> diagnostic method: DumpUtils.DumpDictionary() I am returned all the
> OrderForm
> property values and the line items.
>
> Is there another way to get access to these properties that is more
> appropriate?
>
> thanks,
> gwheeloc



Colin Bowern

2005-07-29, 5:55 pm

Hi again,

Check out the XML Tracer as a way to see the underlying names of the items
in your product catalog during the basket pipeline run:

http://www.microsoft.com/downloads/...&displaylang=en

It's possible the key name is invalid it would certainly cause a consistent
DBNull.

Cheers,
Colin

"gwheeloc" <gwheeloc@discussions.microsoft.com> wrote in message
news:C48B9ACF-8411-4248-88B9-12F520FAFE08@microsoft.com...
> Sorry about the split post.
>
> foreach (LineItem Item in m_oBasket.OrderForms["Default"].LineItems)
> {
> if(Item["ProductAttribute"].ToString() == "Yes")
> {
> //update user profile
> }
> }
>
> No matter which Property I try, it comes back as DBNull. If I run the
> diagnostic method: DumpUtils.DumpDictionary() I am returned all the
> OrderForm
> property values and the line items.
>
> Is there another way to get access to these properties that is more
> appropriate?
>
> thanks,
> gwheeloc



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com