Son Do
Jan 6, 2017
  4359
(1 votes)

Introducing SerializableCart mode

Since 10.2.0, Episerver Commerce introduced big changes that support cart features: SerializableCart.

Why?

In Commerce 9, we improved catalog performance -- about 10 times faster as I remember :).
The purpose of SerializableCart is also performance improvement. SerializableCart mode is ready for bigger sites with more concurrent customers.

How?

To improve performance, SerializableCart mode stores all cart data in one place with data was serialized as json. All order information (addresses, lineitems, and so forth) is converted to a json string when saving and then deserialized when loading. It reduces a lot of time.

In theory, SerializableCart loads 2 times faster and saves 14 times faster than the legacy cart. An impressive number, isn't it? :)

Using SerializableCart

  1. Enable SerializableCart mode.
  2. Convert IShippingGateway to IShippingPlugin using abstraction classes. 
  3. Convert IPaymentGateway to IPaymentPlugin using abstraction classes. (Refer to post to figure out how to migrate)
  4. Navigate to CMS/Admin. In Scheduled Jobs, run Legacy cart migration for migrating legacy Cart to SerializableCart.
  5. Finally, process the new cart mode like my previous post.

Note that this SerializableCart feature is in beta and does not support creating carts in Commerce Manager. But all purchase order operations in Commerce Manager still work.
The latest Quicksilver on Github is using SerializableCart mode.

The final version will be released soon, in some next release :)

We hope that this change helps you!

/Son Do

Jan 06, 2017

Comments

Johan Book
Johan Book Jan 6, 2017 03:54 PM

This is good news! It would be good if there was support for adding custom columns to SerializableCart table, for efficient filtering. We tend to use custom fields a lot with MetaDataPlus. I guess a WHERE Data LIKE '%"CustomColumn": "@Value%"' would not a good idea ;-)

Andreas J
Andreas J Jan 6, 2017 09:36 PM

Is really the latest version of Quicksilver on Github updated with the serialized carts feature? The latest commit adds the feature SerializedCarts to ecf.app.config but it's not enabled.

I guess this feature is nice - at least in a performance perspective. Wouldn't it be more awesome if you could specify how to persist/read the cart? If you really cared about performance, you could store the serialized cart in Redis which surely would increase performance a lot.

This is not a suggestion to the writer of this blog, it's a suggestion to the Episerver team of course.

Magnus Rahl
Magnus Rahl Jan 7, 2017 10:54 AM

Thanks for your feedback guys!

Part of the motivation for introducing the order abstractions is to allow different implementations, not only for carts but also purchase orders and other order entities. However, rewriting the standard implementation isn't exactly trivial considering the need to be (somewhat) backwards compatible both with existing solutions and other parts of our own code, most notably Commerce Manager.

To rewrite the order system completely we would likely want to write out CM and replace it with a new GUI for order management, which is a big task. For that reason we decided to do a smaller scope story focused on the carts because this was where we were hurting the most (support for the new carts in CM is coming soon). Within this smaller scope we did not want to pull in a new dependency like Redis. While it is very simple to set up and use Redis in Azure, on-prem (and dev/test environments) is not trivial.

Considering the performance gain we could get with the current tech, we decided it wasn't worth the added complexity at this stage. That said, it is definitely a possibility that we will add a Redis backed implementation in the future. And with the abstractions it is already a possibility to roll your own, mind you will not have full support in Commerce Manager. But if the project does not require Commerce Manager you can even replace purchase order storage, IIRC this has already been done in some implementations.

Making custom columns queryable is an interesting challenge in this context. Adding that capability to the abstractions puts a lot more work on the implementer. We could maintain some kind of queryable index on the side but again that could mean pulling in another dependency (e.g. Find). We'll discuss it.

Quicksilver uses the order abstractions throughout so you just need to flip the flag to use the serialized carts feature.

Jan 7, 2017 05:26 PM

It is on my to do list to have a Redis cart implementation.  Should not be hard now thanks to work with this story.

  • IOrderGroupBuilder. Used to create sub-components for IOrderGroup. A builder is registered to create sub-components for a collection of type order group (see ForType property). A builder also has a SortOrder. If there are multiple registered builders for a type, the one with the highest sort order value is chosen.
  • IOrderGroupFactory. Responsible for creating instances of order group components by using IOrderGroupBuilder. The default implementation automatically registers all builders for all types of IOrderGroup.

If I were to use Redis in production I would make sure to have an impersonation feature so my customer service reps could still manipulate carts on behalf of customer since this functionality would not work in commerce manager.  Purchase orders could still be managed in commerce manger since there would no changes to the implementation.  

In the long run would be nice to have an ui interface to manager orders from any implementation like our pricing and inventory systems.  I think is something that will get done, just not in the short term. 

Arve Systad
Arve Systad Feb 16, 2017 08:41 AM

See my question over at http://world.episerver.com/documentation/developer-guides/commerce/orders/serializable-carts/ - this should be answered in the documentation. Looks like awesome work so far, hoping I'm right in my theory there! :-)

Todd Jasper
Todd Jasper Apr 25, 2017 05:13 PM

Couple questions:

  1. Is the same purchase order record that's created now when submitting an order created from this serialized cart?
  2. When migrating existing carts to serialized carts, are the legacy order groups deleted?

Bien Nguyen
Bien Nguyen Sep 26, 2017 10:35 AM

Hi Todd,

Sory for very late reply.

  1. Yes, it's the same purchase order record when placing a serializable cart.
  2. Yes, legacy carts will be removed after the migration

Regards,

Please login to comment.
Latest blogs
Optimizely PIM - Variant Management Overhaul & Rollout

Optimizely Product Information Management has completely overhauled variant management with improved usability and support for variant swatches. In...

Arthur Vander Voort | Feb 1, 2023

How Optimizely Web Experimentation enables fast validation of design and UX changes

Ever wondered how to increase conversion rates and quickly validate design/UX alternatives to find the most impactful changes? I wrote a practical...

Jacob Pretorius | Jan 31, 2023

What’s next after Google Optimize’s sunsetting?

Google has announced that it is sunsetting the Google Optimize and Optimize 360 services, forcing customers to explore new platforms and invest in...

Ynze | Jan 31, 2023 | Syndicated blog

What’s next after Google Optimize’s sunsetting?

Google has announced that it is sunsetting the Google Optimize and Optimize 360 services, forcing customers to explore new platforms and invest in...

Ynze | Jan 31, 2023 | Syndicated blog

Migrating from Providers to CMS 12 ASP.NET Identity with cookie tweaks

Notes on migrating a multi-site from Membership and Role Providers to ASP.NET Identity and changing cookie options dynamically.

Johan Kronberg | Jan 30, 2023 | Syndicated blog

Integrating generative AI in Optimizely CMS: A quick test with OpenAI

Some of the new AI services have received a lot of attention recently. Can you integrate them in Optimizely CMS? Of course, you can!

Tomas Hensrud Gulla | Jan 30, 2023 | Syndicated blog