AI OnAI Off
Not sure why do you have to call .ExcludeField(x => x.GetPrices());, but that does not seem to be necessary. It might be the culprit.
You can just remove the call to base method and just Exclude the PriceReference property in your method
Hi Quan,
I'm trying everything - that's why:
These are the prices I get in Find:
"Prices$$nested": [ { "CustomerPricing": { "PriceCode$$string": "", "$type": "Mediachase.Commerce.Pricing.CustomerPricing, Mediachase.Commerce", "PriceTypeId": 0 }, "___types": [ "EPiServer.Commerce.SpecializedProperties.Price", "System.Object", "System.ICloneable" ], "ValidFrom$$date": "2017-01-01T00:00:00Z", "$type": "EPiServer.Commerce.SpecializedProperties.Price, EPiServer.Business.Commerce", "UnitPrice": { "Amount$$number": "8.800000000", "$type": "Mediachase.Commerce.Money, Mediachase.Commerce", "Currency": { "CurrencyCode$$string": "NOK" } }, "MarketId": { "$type": "Mediachase.Commerce.MarketId, Mediachase.Commerce", "Value$$string": "10002" }, "MinQuantity$$number": 1, "ValidUntil$$date": "2199-01-01T00:00:00Z" },
I have tried this:
protected override void ApplyPricingConventions(TypeConventionBuilder<IPricing> conventionBuilder)
{
base.ApplyPricingConventions(conventionBuilder);
conventionBuilder
.ExcludeField(x => x.PriceReference);
}
And this:
protected override void ApplyPricingConventions(TypeConventionBuilder<IPricing> conventionBuilder) { base.ApplyPricingConventions(conventionBuilder); conventionBuilder .ExcludeField(x => x.DefaultPrice()) .ExcludeField(x => x.Prices()) .ExcludeField(x => x.PriceReference); }
And this:
protected override void ApplyPricingConventions(TypeConventionBuilder conventionBuilder)
{
base.ApplyPricingConventions(conventionBuilder);
conventionBuilder
.ExcludeField(x => x.DefaultPrice())
.ExcludeField(x => x.Prices())
.ExcludeField(x => x.GetPrices());
}
And this:
protected override void ApplyPricingConventions(TypeConventionBuilder<IPricing> conventionBuilder) { base.ApplyPricingConventions(conventionBuilder); conventionBuilder .ExcludeField(x => x.PriceReference) .ExcludeField(x => x.DefaultPrice()) .ExcludeField(x => x.Prices()) .ExcludeField(x => x.GetPrices()) .ExcludeField(x => x.GetCustomerPrices()); }
How about this?
protected override void ApplyPricingConventions(TypeConventionBuilder<IPricing> conventionBuilder)
{
conventionBuilder
.ExcludeField(x => x.PriceReference);
}
Hi,
We have a quite large Commerce Catalog, and are indexing the products in Find. But since we don't want all data to be indexed (and to save us some time when indexing), we created conventions for removing prices. We followed this recipe:
https://world.episerver.com/documentation/developer-guides/commerce/search/find-integration/overriding-default-conventions/
Our implementation:
and added the following conventions in the implementation:
But we still get the prices in the Find index.
In addition to remove the prices, we added this convention to remove inventories. Which works just fine.
We are running on version: 11.2.4