London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

How to restrict Catalog to one site

Vote:
0

We are running CMS 12 / Commerce 14 on the most recent versions(as of about a month ago).

We have multiple site hosted on our CMS. We also have a Catalog with products that should only be available for one of the sites. The catalog pages work and load correctly on the site they are meant to be viewed on. We do not link to any of the catalog pages from any site other than the main site. Somehow some search engines got links to load the catalog pages on a secondary site. The catalog page should not be loadable on this site and should give a 404. The secondary site does not give a 404, it tries to load the page. And as a results it results in an exception because the secondary site does not have all of the data/functionality in place that the catalog page needs. This is producing a lot of exceptions and potentially hurting the stability of our sites/instance.

Example

This works fine and loads as it should: 

This should not load, it should give a 404, but it tries to load and gives an exception:

 

How do i restrict the catalog to only be available for one site and not any of the others?

Thank you,

Calvin

 

#337688
Apr 02, 2025 13:49
Vote:
0

I haven't tried it, but in theory, you can implement your own HierarchicalCatalogPartialRouter, override GetCatalogContentRecursive, and check if CatalogContent is available in the current site, if not, return null which would result in a 404 

#337698
Apr 03, 2025 7:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.