how to use ShoppingCart

21 views
Skip to first unread message

ZaR

unread,
Oct 23, 2008, 6:27:14 PM10/23/08
to Open Shopping Cart
Hello ;)
With the sample solution, I was able to understand the "markup part"
with buttons, grid, templates, .. (great work!) and how to customize
the display of the cart.
But I don't understand how to really "use" it... :(
I mean... in code-behind for instance ?

Should I declare a kind of Cart object?
How to link aspx presentation with business logic? the provider?

I hope I made myself clear :S

Thanks :D

Marc Chouteau

unread,
Oct 24, 2008, 3:29:03 AM10/24/08
to open-shop...@googlegroups.com
Hi !
 

You do not need to declare an instance of the object "cart" because all its methods are static and uses the provider that can be the default or your.

The provider by default uses the ASP sessions to store items, if you want to use a different method, for example store information in database or other we must create another provider inheriting from "cartprovider"Marc
2008/10/24 ZaR <cesar.o...@gmail.com>

ZaR

unread,
Oct 24, 2008, 7:40:31 AM10/24/08
to Open Shopping Cart
thanks for the quick answer ;)
i think i want to keep the session as the provider
so, how to get the cart ?
can you provide me a short sample of code?
thx

On 24 oct, 09:29, "Marc Chouteau" <chout...@gmail.com> wrote:
> Hi !
>
> You do not need to declare an instance of the object "cart" because all its
> methods are static and uses the provider that can be the default or your.
>
> The provider by default uses the ASP sessions to store items, if you want to
> use a different method, for example store information in database or other
> we must create another provider inheriting from "cartprovider"
> Marc
> 2008/10/24 ZaR <cesar.outre...@gmail.com>

Marc Chouteau

unread,
Oct 24, 2008, 7:47:41 AM10/24/08
to open-shop...@googlegroups.com
In your business logic layer you can use this code for example to convert Cart as Order
 
Order myOrder = new Order();
 
foreach(var item in Serialcoder.ShoppingCart.Cart.List)
{
      OrderItem myOrderItem = new OrderItem();
      myOrderItem.ProductId = item.ProductId;
      ...
      myOrder.OrderItemCollection.Add(myOrderItem);

ZaR

unread,
Oct 24, 2008, 9:07:17 AM10/24/08
to Open Shopping Cart
thank you!
Reply all
Reply to author
Forward
0 new messages