In previous recipe we talked about multiple catalogs with same “UriSegment” – which we had a working implementation for incoming URL, i.e. when a customer visit a product url, we know which catalog we should choose from. But we still need to cover the generation of outgoing URL. I.e. when we link a product (For example, from a campaign page), we need to generate an URL which take the “catalog-less” pattern into account.
We need to understand how the outgoing URL is built. The hierarchical router builds the URL by the `RouteSegment` of contents. However, we want to the urls appear to have same catalog, so the `RouteSegment` part for the catalogs must be the same, regardless of the true catalogs. Because all catalogs are on same level, their `RouteSegment` must be unique – and this is enforced from Framework level (which is understandable, otherwise, how can it know which content to choose).
Continue reading “Multiple sites: Building the outgoing URLs” →
This is an excerpt from my second book . The first chapter is available to read for free.
A business is having an Episerver Commerce instance with multiple sites and multiple catalogs set up. They want to make sure each site will use one catalog, and all of them will share the same url for catalog structure. So it’ll be “https://site-a.com/products/category/”, and “https://site-b.com/products/category/”. Site A and site B are using different catalogs.
Is this doable? Yes! It’s just a matter of magic with the routing. This time, we would need to do an implementation of
HierarchicalCatalogPartialRouter ourselves. First, let’s create a template for it:
public class MultipleSiteCatalogPartialRouter : HierarchicalCatalogPartialRouter
private readonly IContentLoader _contentLoader;
public MultipleSiteCatalogPartialRouter(Func routeStartingPoint, CatalogContentBase commerceRoot, bool enableOutgoingSeoUri, IContentLoader contentLoader)
: base(routeStartingPoint, commerceRoot, enableOutgoingSeoUri)
_contentLoader = contentLoader;
Continue reading “Multiple catalogs with same url” →
More than one year ago, I announced that I was working on a book – a first Episerver Commerce book ever. It has been a work in progress until recently – and I am still adding updates here and there. The book has received quite positive feedback (I’m happy to say that everyone is nice enough to not tell me “Your book sucks”. Thanks, everyone). Am I happy with it? Yes, of course, proud even.
But to be completely honest,
I know something was missing.
Continue reading “Announcing a new book: Episerver Commerce: A problem – solution approach” →