SearchOrders conditional filters #608
Closed
redmorello
announced in
Q&A [Archived]
Replies: 1 comment 2 replies
-
It should be possible within your function that you pass to the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Matt,
With the SearchOrders specifications, is it possible to make some of them conditional. For example, on our orders listing page, we have a dropdown for the order Status. By default its set to "All" so we would use this search:
commerceOrders = _orderService.SearchOrders((where) => where
.FromStore(store.Id)
.And(where.IsFinalized())
.And(where.HasProperty(BlatchfordConstants.Commerce.Properties.Customer.CsiAccountId, csiAccount.CsiAccountId)),
(orderBy) => orderBy
.ByCreateDate(sortOrder),
pageNumber, pageSize);
But if the user selects "Cancelled", we would want to add an additional .And like this:
commerceOrders = _orderService.SearchOrders((where) => where
.FromStore(store.Id)
.And(where.IsFinalized())
.And(where.HasProperty(BlatchfordConstants.Commerce.Properties.Customer.CsiAccountId, csiAccount.CsiAccountId))
.And(where.HasOrderStatus(Guid.Parse(filterType))), // this line needs adding
(orderBy) => orderBy
.ByCreateDate(sortOrder),
pageNumber, pageSize);
we might need to add other optional search parameters i.e search by order line Sku etc
Beta Was this translation helpful? Give feedback.
All reactions