When using facets for a multi-select field. Is it ...
# suitecommerce
m
When using facets for a multi-select field. Is it possible to filter all the items where a value is "NOT" present in the multi-select? If not using facets is there any other way that to filter items before they are returned? It is something that will be dynamic and per Customer so Personal Catalog Views won't work.
s
Facets act like ANDs. Facet values act like ORs.
There is no NOT logic
m
Are there robust ways to filter items before they are displayed that would not negatively affect paging?
s
Yes. There is a concept of 'master search options', which we added to the extensibility API (but has existed in the core code long before that). https://system.netsuite.com/help/helpcenter/en_US/APIs/SuiteCommerce/Extensibility/Frontend/Environment.html#defineSearchMasterOptions
Some things you can do with that is to pre-filter (ie pre-apply a facet and value) or pre-sort results by including extra parameters in every request that is sent by the application to the items API
m
Yeah that is how we were going to apply the facet. We were just hoping there was a "NOT" logic in facets that would make it easier to keep the item records up to date on the back-end. With it only available as the value has to be present it means we have to select all valid customers in the item field instead of just being able to add the customers we want to be disabled from ordering the item.
We already use Personalized Catalog Views to show items based on customer type and location. But now there will be additional limitations that are dynamic and will change over time.
Thanks for your answers. It was helpful to make sure I wasn't missing something.
s
OK, what are exactly are you trying to do then? Because it seems like anything you could do with item record data could just be plugged into a saved search when creating your PCVs?
So why would excluding products based on a NOT be something you'd want to do?
m
It's to implement monthly order limits. So once they have ordered a certain amount of an item they won't be able to see it anymore until they are ordering for the following month. So we need the facet will send the month and customer id like '202407588' as the facet. That means that all items that have this value selected will be available to the customer. This makes a lot of the upkeep a lot higher because we have to create the records for all agencies for the following month and select them. When a new customer is added we have to add them to all items, When a new item is selected we have to select all values.
If "NOT" was available then we would just have to add to items once a customer had hit the limit for that item.