I only want to show products that has a price for current user using Lucene. We’ve tried the following code in PriceFilterService, but the product is not visible
var priceListSystemIds = _priceListForUser.Value;
var allPrices = new List<(int Min, int Max)>
{
{(1, int.MaxValue) }
};
var countryId = _requestModelAccessor.RequestModel.CountryModel.SystemId;
var optTagClause = new OptionalTagClause();
var limitedTag = _fieldDefinitionService.Get<ProductArea>(ProductFieldNameConstants.LimitedToProductGroup).GetTagName();
if (priceListSystemIds.Count > 0)
{
var limitedMandTag = new MandatoryTagClause();
limitedMandTag.Tags.Add(new Tag(limitedTag, true));
foreach (var item in priceListSystemIds)
{
var name = _requestModelAccessor.RequestModel.Cart.IncludeVAT
? TagNames.GetTagNameForPriceIncludingVAT(item, countryId)
: TagNames.GetTagNameForPriceExludingVAT(item, countryId);
request.ReadTags.Add(name);
foreach (var priceItem in allPrices)
{
limitedMandTag.Tags.Add(new RangeTag(name, priceItem.Min, priceItem.Max));
}
}
optTagClause.Tags.Add(limitedMandTag);
}
request.FilterTags.Add(optTagClause);
Litium version: 7.7.0