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

Vote:
 

Hi,

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?

Thanks

#175217
Feb 15, 2017 10:15
Vote:
 

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"

#175219
Feb 15, 2017 10:53
Vote:
 

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

#175321
Feb 16, 2017 10:41
Vote:
 

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.

Regards

Anders

#175323
Feb 16, 2017 10:47
Vote:
 

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 

#175324
Feb 16, 2017 10:52
Vote:
 

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: 

http://world.episerver.com/documentation/developer-guides/commerce/orders/Searching-for-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.

Regards

Anders

#175326
Feb 16, 2017 11:03
Vote:
 

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. 

#175327
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.