fevereiro 03, 2020
Sitecore commerce with or without SXA works well in a multisite scenario, but there are certain exceptions one must be aware of.
- Sitecore Commerce works on the fundamental assumption that every country website will have a unique catalog
- Every catalog has one currency
Let’s go a little deeper
One scenario where things can go wrong is when you have a business that has the same catalog for multiple countries (common for most businesses in Europe or North America). What this means is that you have one product catalog which serves multiple regions with multiple currencies. If such a business wants to show an offer price or sale price with a strikethrough like most eCommerce sites do, then we will encounter this situation.
Every catalog has one currency
This is very clear and evident. By default, Sitecore has only one defined field for List Price. It does not show multiple List Price fields for each currency. You can, however, add multiple currency prices by tweaking the template. But, this will mean you must make changes to the pipeline blocks that retrieve the pricing information.
Its typical for traditional Sitecore users (non-Commerce) to have multiple site configurations – one for preview/staging, another for production etc. In SXA, we have tenants to take care of these and it will promptly add the required items under the Commerce Control Panel. If you do not use SXA, the approach is to add new <site name=”” … /> nodes in your patch config.
In a nutshell, things look fine. When you start accessing your commerce website, you will randomly run into errors from the engine.
ERROR SitecoreConnectionManager: RETRY 1 out of 3 with ERROR Internal Server Error. Failed to logging. /sitecore/api/ssc/auth/login for GET /sitecore/api/ssc/item/?path=%2Fsitecore%2FCommerce%2FCommerce%20Control%20Panel%2FStorefront%20Settings%2FStorefronts%2F[websitename]&database=[database]&language=en
What causes these errors is the fact that Sitecore assumes you have a unique item under the Commerce Control Panel (/sitecore/Commerce/Commerce Control Panel/Storefront Settings/Storefronts) for each site defined.
Even though the site node says that it uses the an already defined storefront (commerceShopName attribute in the site node), the Commerce Engine still tries to fetch an item under the Commerce Control Panel > Storefront Settings > Storefronts, with the “name” attribute of the site node.
A workaround for this would be to remove the staging or preview site definition from the <sites> section and customize the Site Resolver to change the context database on the fly as needed.
Check out the next blog on how to modify the Site Resolver.