|
Home > Archive > Commerce Server General > July 2005 > LineItemCollection constructor
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 |
LineItemCollection constructor
|
|
|
| Our site design has the possiblilty of generating orders that contain
multiple order forms each with one or more line items. In order to make the
display logic easier, I need to generate a single LineItemCollection that
contains all LineItems in all OrderForms within the order.
How do you create a new LineItemCollection? The constructor is not
documented and the code:
LineItemCollection myItems = new LineItemCollection();
fails to compile with:
No overload for method 'LineItemCollection' takes '0' arguments.
| |
| Ravi Shankar 2005-06-29, 5:52 pm |
| Hi Jerry,
I would recommend you have a look at the Retail2002 site. It has the ability
to support multiple shipping addresses within the same order and they have a
display logic to display the different poducts in different shipping groups.
That might provide you with an idea on how to structure your display page.
Basically, the page uses nested asp.net repeaters with one binding to the
orderform collection and the nested repeater binding to the line items
collection.
"Jerry" wrote:
> Our site design has the possiblilty of generating orders that contain
> multiple order forms each with one or more line items. In order to make the
> display logic easier, I need to generate a single LineItemCollection that
> contains all LineItems in all OrderForms within the order.
>
> How do you create a new LineItemCollection? The constructor is not
> documented and the code:
>
> LineItemCollection myItems = new LineItemCollection();
>
> fails to compile with:
>
> No overload for method 'LineItemCollection' takes '0' arguments.
>
| |
|
| Yes, we looked at doing that and, if I can't create the LineItemCollection,
we may be forced to use it. However, it would be more advantageous if I could
create the LineItemCollection. Is this possible?
"Ravi Shankar" wrote:
[vbcol=seagreen]
> Hi Jerry,
>
> I would recommend you have a look at the Retail2002 site. It has the ability
> to support multiple shipping addresses within the same order and they have a
> display logic to display the different poducts in different shipping groups.
> That might provide you with an idea on how to structure your display page.
>
> Basically, the page uses nested asp.net repeaters with one binding to the
> orderform collection and the nested repeater binding to the line items
> collection.
>
>
> "Jerry" wrote:
>
| |
| Ravi Shankar 2005-07-06, 5:51 pm |
| What you could do is create an instance of OrderForm class and use the line
item collection is that. You dont need to attach the orderform to the basket.
So every time the page is called... instantiate a OrderForm class, use the
credentials of the current user to get their basket..
Dim oDisplayForm as OrderForm = new OrderForm
Dim oBasketForm as OrderForm
Dim oLineItem as LineItem
Dim oUserBasket as Basket =
CommerceContext.Current.OrderContext.GetBasket(CommerceContext.Current.UserId)
For each oBasketForm in oUserBasket.OrderForms
for each oLineItem in oBasketForm.LineItems
oDisplayForm.LineItems.Add(oLineItem)
next
next
--- then you can bind this oDisplayForm.LineItems to your repeater control..
That should solve this issue for you...
Remember that everytime you execute the basket or total pipeline you'll have
to rebuild this again.... for totals you'll have to sum up the orderform
subtotals and display..
Have fun.
"Jerry" wrote:
[vbcol=seagreen]
> Yes, we looked at doing that and, if I can't create the LineItemCollection,
> we may be forced to use it. However, it would be more advantageous if I could
> create the LineItemCollection. Is this possible?
>
> "Ravi Shankar" wrote:
>
| |
|
| Thanks. That sounds like it will work just fine.
"Ravi Shankar" wrote:
[vbcol=seagreen]
> What you could do is create an instance of OrderForm class and use the line
> item collection is that. You dont need to attach the orderform to the basket.
>
> So every time the page is called... instantiate a OrderForm class, use the
> credentials of the current user to get their basket..
>
> Dim oDisplayForm as OrderForm = new OrderForm
> Dim oBasketForm as OrderForm
> Dim oLineItem as LineItem
>
> Dim oUserBasket as Basket =
> CommerceContext.Current.OrderContext.GetBasket(CommerceContext.Current.UserId)
>
> For each oBasketForm in oUserBasket.OrderForms
> for each oLineItem in oBasketForm.LineItems
> oDisplayForm.LineItems.Add(oLineItem)
> next
> next
>
> --- then you can bind this oDisplayForm.LineItems to your repeater control..
>
> That should solve this issue for you...
>
> Remember that everytime you execute the basket or total pipeline you'll have
> to rebuild this again.... for totals you'll have to sum up the orderform
> subtotals and display..
>
> Have fun.
>
>
>
> "Jerry" wrote:
>
|
|
|
|
|