November Happy Hour will be moved to Thursday December 5th.

Fetching carts from Commerce

Vote:
 

Given the following interface from optimizely:

namespace EPiServer.Commerce.Order

{

  /// <summary>Filter class used to filter which orders to retrieve.</summary>

  public class OrderSearchFilter

  {

    ...

    /// <summary>

    /// Specifies that only carts/orders created by specified customer should be returned.

    /// </summary>

    public Guid CustomerId { get; set; }

    ...

  }

}

I would expect it to be possible to search for carts in the the order repository using IOrderSearchAsyncService by doing the following:

var searchFilter = new OrderSearchFilter{CustomerId = currentCustomer.OrganizationId};

var searchResults = await orderSearchAsyncService.SearchAsync<ICart>(null, searchFilter, default);

The observed result is that all carts are returned, regardless of their CustomerId being different.

Is this the intended behaviour?

#332449
Nov 05, 2024 13:05
Vote:
 

I think it was an overlook (aka a bug). I will file a bug to commerce team. thanks for bringing this into our attention 

#332450
Nov 05, 2024 13:45
Quan Mai - Nov 05, 2024 13:46
the bug is COM-18969
Christian Morup - Nov 05, 2024 13:59
Thanks a lot!
Do you have an estimated timeline for when the bug will be resolved?
Quan Mai - Nov 05, 2024 14:03
if I have time, I usually contribute the fix directly, but it is quite tight for me right now, so it's up to the team to pick it up. realistic estimation is about 2 weeks- 1month since the work starts on it (not counting the time waiting in queue). I'll see if I can do anything after this month if no progress has been made.
Christian Morup - Nov 26, 2024 14:34
Is there any way I can follow the status on this bug?
Quan Mai - Nov 26, 2024 14:39
Not yet. I made some progress on it but have not had time for a proper fix
Vote:
 

@Christian, good catch. The only solution I see until the bug is resolved is create an override of DefaultOrderSearchAsyncService or replace custom implementation of IOrderSearchAsyncService and copy the existing implementation code and adjust it to your need. Or else you can try adding a code interception. 

#332801
Nov 13, 2024 0:01
* 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.