Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Episerver 10 Searching/loading mutliple SerializableCarts



I'm trying to find a way for searching and loading all SerializableCarts for a customer but I can't figure it out. Is this possible? If not, will it be possible in the future?


Feb 15, 2017 10:15

Once you turned on the flag, the higher APIs will work all the same. So you can use IOrderRepository.Load<ICart>(customerId, cartName) to load all the carts for a customer. By default, cartName should be "Default"

Feb 15, 2017 10:53

Thank you for the response. But is there a way to search/filter SerializableCarts?

Feb 16, 2017 10:41

Hi all

To elaborate a bit on Karol's question: We are planning on having multiple carts for a customer. Of course only one cart will be "active" at a time, but it is not unheard of for customers to add items to different carts during the day, and then checkout the relevant carts at the end of business day. So we need a way of looking up all available SerializableCarts for a given customer.



Feb 16, 2017 10:47

As I commented above, IOrderRepository.Load<ICart>(customerId, cartName) should give you that. If you have the flag turned on, then it'll be SerializableCart 

Feb 16, 2017 10:52

Ah, so you can have multiple carts with the same "Name". I didn't know that.

I have discussed this with Karol, and we would like to be able to search/filter on data in the JSON "Data" column. Are you planning on implementing some kind of seach interface that would enable us to do that?

Using the legacy carts (Orders system) it was possible to search the carts/orders:

You could use the OrderContext.Current.FindCarts to search for carts. Is this something that is planned for the new SerializableCarts?

Thank you for your help.



Feb 16, 2017 11:03

Technically a customer can only have one cart with same name in one market at a time. (At least that was the way old cart system behaves. I'm yet to check the new cart system, but I would expect it to be the same). If you pass string.Empty then it will load all carts regardless of names. 

We are in the discussion of adding search functionalities to the new order abstraction (IOrderRepository and related stuffs). There are no decisions yet, so if they happen, they might not happen any time soon. 

Feb 16, 2017 11:11
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.