Commerce

Index or no index, that’s the question

If you do (and you should) care about your Episerver Commerce site performance, you probably know that database access is usually the bottleneck. Allowing SQL Server works smoothly and effectively is a very important key to the great performance. We are of course, very well aware of this fact, and we have spent a considerable amount of time making sure Commerce database works as fast as we could. Better table schema, better stored procedures, better indexes, ... we have done all of that and will continue doing so when we have the chances. (And if you find anything that can be improved, you are very welcome to share your finding with us) But there are places where the database performance improvement is in your hand. (more…)

By vimvq1987, ago
Catalog

Multiple sites: Building the outgoing URLs

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). (more…)

By vimvq1987, ago
Catalog

Multiple catalogs with same url

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: [crayon-5ad4c2d90375a679246875/] (more…)

By vimvq1987, ago
Commerce

Package equivalent promotion type in Episerver Commerce

Recently we got this question on how to create package-equivalent promotion type in Episerver Commerce, from https://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2018/2/is-there-a-built-in-group-discount/ I already recommended to use package for such purpose, because of several reasons:

  • Package is a builtin feature, and is fully supported by the framework, both on UI level and API level.
  • It has been well tested and is very reliable to use.
However in a real world implementation, it might not be easy to just add package implementation. One reason would be if you rely on an external PIM to handle your catalog. Configuring it to support package can not be trivial. So why not try to implement a package equivalent promotion in the promotion engine, to see if it works. (more…)

By vimvq1987, ago
Catalog

Speed up your Catalog incremental indexing

As your products are being constantly updated, you would naturally want them to be properly (and timely) indexed - as that's crucial to have the search results that would influence your customers into buying stuffs. For example, if you just drop the prices of your products , you would want those products to appear in new price segment as soon as possible. This should be very easy with Find.Commerce - so if you are using Find (which you should) - stop reading, nothing for you here. Things, however, can be more complicated if you are using the more "traditional" SearchProvider. (more…)

By vimvq1987, ago
Commerce

Why you should upgrade to the latest version

I made no secret that I'm a die-hard advocate for upgrading to latest EPiServer CMS/Commerce version. There are several reasons for that, mostly from new shiny features that your businesses dearly need, new big performance improvements that your customers firmly demand. But there is another, not so obvious reason: support. Let me tell you a story. This morning we received a support case from support team. A customer recently upgraded from Commerce 7.5 (Eww) to 11.7 (Yay!), things went well except they had a small problem with data displaying in Catalog UI. Some of the properties were not properly displayed, but they are still showing correct in Commerce Manager. (more…)

By vimvq1987, ago
Commerce

ServiceAPI + Postman, a match in heaven

No, it's just a note-to-self. A lot of customers have been using ServiceAPI, and to great successes. We also have very good documentation here - of which largely thanks to my colleague Mark Hall. But what if you want to play around with ServiceAPI and don't want to write app/build/run it yourself? The answer is simple: There are many REST Clients can do the job for you, and Postman is usually regarded as the best/most popular one. But, the documentation are for C# client, it can be quite confusing to use Postman to work with ServiceAPI for the first time (or times). If you are experienced with Postman, great! But if you are not - like me - when you use Postman from time to time and everytime it's new, then this post can be useful to you. Today I need to do some tests with ServiceAPI, and I had to spend some time figuring out how to use Postman - so I decided it's better to have all of those noted for future reference. (more…)

By vimvq1987, ago
Catalog

Mass update catalog entries

This is something you don't do daily, but you will probably need one day, so it might come in handy. Recently we got a question on how to update the code of all entries in the catalog. This is interesting, because even thought you don't update the codes that often (if at all, as the code is the identity to identify the entries with external system, such as ERPs or PIMs), it raises a question on how to do mass update on catalog entries.

    • Update the code directly via database query. It is supposedly the fastest to do such thing. If you have been following my posts closely, you must be familiar with my note regarding how Episerver does not disclose the database schema. I list it here because it's an option, but not the good one. It easily goes wrong (and cause catastrophes), you have to deal with versions and cache, and those can be hairy to get right. Direct data manipulation should be only used as the last resort when no other option is available.
(more…)

By vimvq1987, ago
Catalog

A curious case of SQL Server function

This time, we will talk about ecfVersion_ListFiltered, again. This stored procedure was previously the subject of several blog posts regarding SQL Server performance optimizations. When I thought it is perfect (in term of performance), I learned something more. Recently we received a performance report from a customer asking about an issue after upgrading from Commerce 10.4.2 to Commerce 10.8 (the last version before Commerce 11). The job "Publish Delayed Content Versions" starts to throw timeout exceptions. This scheduled job calls to a ecfVersion_ListFiltered to load the content versions which are in status DelayedPublish, it looks like this when it reaches SQL Server: [crayon-5ad4c2d905ac1609906204/]This query is known to be slow. The reason is quite obvious - Status contains only 5 or 6 distinct values, so it's not indexed. SQL Server will have to do a Clustered Index Scan, and if ecfVersion is big enough, it's inevitably slow. (more…)

By vimvq1987, ago
Commerce

Loading carts in a load balancing environment

UPDATE 1: Apparently HttpContext.Current.Request.AnonymousID already uses the cookie internally, so there might be something that makes it stop working. I'll update when I found out. Today we received a support ticket as customers seeing corrupted carts data being lost - line items with invalid data, duplicated line items etc. "Corrupted data" is one of the alarming words that we take very seriously, so I decided to jump on it right away. The setup is a load balancing environment, and the problem only happens with anonymous users. However, it can be "fixed" by turning on the sticky sessions mode. So basically, instead of having sessions on the memory of a server (so sessions on server A can't be seen by server B, and vice versa), they need a mechanism (can be a database) to share sessions between servers. (more…)

By vimvq1987, ago