Developer forum

Forum » Development » Save n' Load shoppingbasket

Save n' Load shoppingbasket


Reply
Hi,

When a user makes it past step 2 in a ecommerce orderflow the order-details are automatic writte to the db. Is it somehow possible to load the orderdetails and let the user complete the order later.

So - are the any easy work-arround to load the order-details from an already exsisting and not-completed order?

/Morten

Replies

 
Reply
Hi Morten

This functionality is already build-in in Dynamicweb. If the user is logged in, the users ID is saved to the order, and when that user logs in the next time, the cart is loaded again from the db.

Also, the cart is saved as a cookie on the client machine, so even if your user is not logged in, the cart can be loaded. Be sure to check your settings for the cookie expire time in the management center.

 - Lasse
 
Reply
Thank Lasse,
But what if we want to load the cart without login and on a different pc (without the cookie).

In this case we want the user to save the cart, and print or email the order id, and then bring the order details to a local store and disguss the content with a professional sales person.

Its a very complex orderflow with a lot of calculations and choises, and in most cases the customer cannot complete the orderflow without a chat with a professional sales person.

Suggestions?


/Morten
 
Reply
Hi Morten

You need to make a custom class that can load an Order given the OrderID. The simplest way of doing this is to make a NotificationSubscriber that listens the the PageLoaded event. From the subscriber you can load the OrderID (from the url or where you post it - remember to add some security, so that you just can't load an Order if you guess an OrderID).

When you have the OrderID you obtain the Order by calling
Order myOrder = new Order(OrderID);

and you replace the current eCom cart with the order by calling:
eCommerce.Common.Context.Cart2 = myOrder (sorry for the naming);

 - Lasse

 
Reply
Sweet - just what I needed... Thanks!
 
Reply
Hi Lasse,

I'd run in to some trouble regaring Cart/Cart2...

"eCommerce.Common.Context" does not contain a definition for "Cart2"
And
"eCommerce.Common.Context.Cart" it is read-only...

So I tried with:

Dynamicweb.eCommerce.Common.Context.set_Cart2(myOrder, myOrder);

And it works - the cart is loaded to the current page.
But I guess this is the wrong way of doing it, compared to your suggestion?

Will it give me any trouble using the above method?

/Morten
 
Reply
Hi Morten

Taht should be fine ;)

 - Lasse

 

You must be logged in to post in the forum