The Difference Between _ExcludedCatalogEntryMarkets And MarketFilter

If you look at the Episerver variant, you will see a MarketFilter property, however, if you look within the Properties collection on the object you'll also see a property associated with the variant called _ExcludedCatalogEntryMarkets.  In today's post, I'm going to talk about what they do and when you might use them.

_ExcludedCatalogEntryMarkets

I've only stumbled across the _ExcludedCatalogEntryMarkets property on a recent project.  The project in question used inRiver as a PIM with Epicommerce.  For those of you unfamiliar with In-River, don't worry too much,  InRIver output some XML which is then imported into Episerer commerce using the commerce Import API.

When content is imported, you'll want to define what markets the product should be associated with.  The way the import was written in this scenario was that instead of defining the markets it was associated with, it defined the markets it should be removed from.

What made the situation even more confusing, is that _ExcludedCatalogEntryMarkets is a hidden property, e.g. it's not a property that's defined on the variant base class, so if you look in your variant class you won't see it.  If you debug a variant though and look in the property collection, it's there.

So my understanding is that if you want to import products using the import API, then you can use this property to define the markets it shouldn't be applied to.

var varient = new Varient();
varient["_ExcludedCatalogEntryMarkets"] = new [] { "market_id" };

MarketFilter

MarketFilter is a property that is defined on the EPiserver variants base class EntryContentBase, which you can use to define what markets a variant is associated with.  If you're unsure about markets but you have a need to filter the products your customers see based on some criteria, then I suggest you read this for more information how to do that)

The market filter is the inverse of _ExcludedCatalogEntryMarkets. Where _ExcludedCatalogEntryMarkets defines what markets should be removed on an import.   Market Filter defines the allowed markets.  I'm not too sure why there are two items, but when you debug and see these two properties within the property collection it makes it a bit confusing.  

var myVarient = // Get your varient
myVarient.MarketFilter.Add("MY_CUSTOM_MARKET");
myVarient.MarketFilter.Remove("MY_CUSTOM_MARKET");

From my experience with commerce markets, the MarketFilter property is assigned from the _ExcludedCatalogEntryMarkets meta field. So if you're having issues with the MarketFilter it may be worth checking _ExcludedCatalogEntryMarkets as well.  

Market Takeaway 

 

Speaking from first-hand experience, having two properties on variants that are similar in nature can be confusing when you're trying to solve a commerce issue.  The aim of this guide is to try and help you understand the differences between the two market properties that you might see.  MarketFilter and _ExcludedCatalogEntryMarkets  do similar things, so it's worth noting the differences between them.

submit to reddit

Jon D Jones

Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge

Back to top