Hmm, good question. I don't think we have one OOTB, but I think it should be possible.
The advanced filter view is pluggable and so long as we have a filter option on our order query specification (which we have a Redeems method to check if it discount / gift card code is redeemed by an order), you can implement your own.
I don't think I got round to documenting those, but if you create a class that extends OrderAdvancedFilterBase with an AdvancedFilterAttribute to define it's meta data (like so)
[AdvancedFilter("discountCode", "Discount Code", "A discount code to search on", Group = "Order")]
public class OrderDiscountCodeAdvancedFilter : OrderAdvancedFilterBase
{
public override bool CanApply(string value)
{
return !string.IsNullOrWhiteSpace(value);
}
public override IQuerySpecification<OrderReadOnly> Apply(IQuerySpecification<OrderReadOnly> query, IOrderQuerySpecificationFactory @where, string value)
{
return query.And(where.Redeems(value));
}
}
in your IUmbracoBuilder or IVendrBuilder you can call
Backoffice advanced filter - Discount
Hi!
I was curious if it's possible to use the backoffice advanced filter to find orders with discount codes?
//Johannes
Hi Johannes,
Hmm, good question. I don't think we have one OOTB, but I think it should be possible.
The advanced filter view is pluggable and so long as we have a filter option on our order query specification (which we have a
Redeems
method to check if it discount / gift card code is redeemed by an order), you can implement your own.I don't think I got round to documenting those, but if you create a class that extends
OrderAdvancedFilterBase
with anAdvancedFilterAttribute
to define it's meta data (like so)in your
IUmbracoBuilder
orIVendrBuilder
you can callI think this should do it.
Thank you so much Matt! That works wonder!
is working on a reply...