I was wondering if it would be possible to have multiple carts (open orders) for a customer/member.
What I have in my situation:
We have a customer/business which can have multiple members to login. All of the members have to be able to save carts, open carts en finish carts from eachother.
What I was trying to do was using the customer reference, and set the customer/business key as customerreference.
Which works fine to a degree, but I cannot create a new cart/open order without getting the old one.
Is there a way to search the orders for a reference that start with something for example? Or is there a way to create a new order without getting the old one? Do you have an idea which I can try to implement or work on :)
Also - which is a different question, but connected to this situation - is there a way to add custom fields to an order? I basically want to add the member key of the person logged in to the order, so I can see which person created this cart/order. Or maybe there is something like this already which i missed.
For your first question, I think your best bet would be to introduce a page that lists all open orders for a company (which you can use similar code to what you have, looking up open orders for a customer/company). From there, your visitor could then review the orders and then have a button to load that cart into their session using the ISessionManager.SetCurrentOrder(storeId, orderId). From that point on, the selected order is now in their current session and they can continue the order.
Another option on that page could then be a "Create new Order" button which when clicked calls two methods on the session manager
ISessionManager.ClearCurrentOrder()
ISessionManager.GetOrCreateCurrentOrder()
(we could probably do with a method that just forces the creation of a new order in session, but the above should do the same for now).
Assuming you assign this to your company in the same way, this cart should then be available to other company members that can see that new carts page.
I'm not sure how far people got, but I know a couple of people were working on a wishlists package which isn't too different to what you want to achieve in a way. Maybe it's worth reviewing their code to see if there is anything worth borrowing https://github.com/vendrcontrib/vendr-wishlists
I am still busy working on this part, but I'm at the point of the checkout and I am running into some issues :)
I am using your checkout package, but when i finish the order, the logged in memberkey is stored in the customer reference field. And I want to save the company id as reference. I am not sure how to do this.
What I tried on the reviewpage, which sets the correct customerreference at this point, but when the order is finished the member key is still used as customerreference.
At 2 points in the check out flow, Vendr will automatically attempt to assign the order to the current logged in member. This is at the point of order creation and at the point of payment form generation.
You could override this behaviour in a couple of ways.
Implement an alternative IMembershipHelper which is responsible for getting the current member ID to assign to the order. You could replace this with something that gets the company ID instead.
Hook into the OrderSavingNotification and enforce the use of the company ID every time before the order is saved, thus overriding any automatically assigned values.
Multiple carts for a member
Hi!
I was wondering if it would be possible to have multiple carts (open orders) for a customer/member.
What I have in my situation: We have a customer/business which can have multiple members to login. All of the members have to be able to save carts, open carts en finish carts from eachother.
What I was trying to do was using the customer reference, and set the customer/business key as customerreference.
What I have so far, when a member logs in:
Which works fine to a degree, but I cannot create a new cart/open order without getting the old one.
Is there a way to search the orders for a reference that start with something for example? Or is there a way to create a new order without getting the old one? Do you have an idea which I can try to implement or work on :)
Also - which is a different question, but connected to this situation - is there a way to add custom fields to an order? I basically want to add the member key of the person logged in to the order, so I can see which person created this cart/order. Or maybe there is something like this already which i missed.
Thanks!
Kind regards Puck
Hi Puck,
I'll answer your second question first, and it's yes, you can store extra information on an order using the properties feature https://vendr.net/docs/core/2.1.0/umbraco-v9/key-concepts/properties/
For your first question, I think your best bet would be to introduce a page that lists all open orders for a company (which you can use similar code to what you have, looking up open orders for a customer/company). From there, your visitor could then review the orders and then have a button to load that cart into their session using the
ISessionManager.SetCurrentOrder(storeId, orderId)
. From that point on, the selected order is now in their current session and they can continue the order.Another option on that page could then be a "Create new Order" button which when clicked calls two methods on the session manager
ISessionManager.ClearCurrentOrder()
ISessionManager.GetOrCreateCurrentOrder()
(we could probably do with a method that just forces the creation of a new order in session, but the above should do the same for now).
Assuming you assign this to your company in the same way, this cart should then be available to other company members that can see that new carts page.
I'm not sure how far people got, but I know a couple of people were working on a wishlists package which isn't too different to what you want to achieve in a way. Maybe it's worth reviewing their code to see if there is anything worth borrowing https://github.com/vendrcontrib/vendr-wishlists
Hope this helps
Matt
Hi Matt,
Awesome! I will look into the suggestions you gave me.
Will let you know if I got it working :)
Thanks Puck
Just an update, but I got the basics working! Still need to test it thoroughly and finetune it, but I am glad with the first results :)
I can create a new cart (nieuwe winkelwagen in the picture) and can take over the carts in the list.
Thanks for the help you gave me already.
Fantastic! That was really pretty quick.
Nicely done 👏
Matt
Hi Matt,
I am still busy working on this part, but I'm at the point of the checkout and I am running into some issues :)
I am using your checkout package, but when i finish the order, the logged in memberkey is stored in the customer reference field. And I want to save the company id as reference. I am not sure how to do this.
What I tried on the reviewpage, which sets the correct customerreference at this point, but when the order is finished the member key is still used as customerreference.
Thanks!
Puck
Hi Puck,
At 2 points in the check out flow, Vendr will automatically attempt to assign the order to the current logged in member. This is at the point of order creation and at the point of payment form generation.
You could override this behaviour in a couple of ways.
Implement an alternative
IMembershipHelper
which is responsible for getting the current member ID to assign to the order. You could replace this with something that gets the company ID instead.Hook into the
OrderSavingNotification
and enforce the use of the company ID every time before the order is saved, thus overriding any automatically assigned values.Hope this helps
Matt
Hi Matt,
Awesome! Got it working :D Thanks again!
is working on a reply...