Creating meta fields for serialized carts

Vote:
 

Hello,

I am working on a project that currently uses non-serialized carts, I now need to Enable the serialized carts and make the necessary changes. I am folllowing the below mentioned developer guide article on serialized cart implementation:

https://world.episerver.com/documentation/developer-guides/commerce/orders/serializable-carts/ 

The current site (non-serialized) uses a lot of meta fields across a number of classes (ordergroup, orderform, linetitem, shipment, address). I dont think this should be an issue while migrating to seriazlised carts. As I see that that the classes can be extended like the example mentioned in the developer guide arctile below:

https://world.episerver.com/documentation/developer-guides/commerce/orders/Extending-order-classes/

So I can use meta fields with serialzed carts right? just that the manner of setting/accessing the metafields is different from the legacy way. 

#205489
Jul 15, 2019 5:39
Vote:
 

Hi Siddharth

You can put whatever property you want in the Properties list of your SerializableCart. It is just a Hashtable of object. So no need or way to define custom MetaFields for a SerializableCart.

However, when you convert the SerializableCart to a PurchaseOrder, the property names and types have to match the known MetaFields on the PuchaseOrder MetaClass (and related types). So best to use the same property keys as the MetaField names.

#205492
Jul 15, 2019 6:40
Siddharth Gupta - Jul 15, 2019 23:42
Thank you Stefan!
Vote:
 

If you've already been using non serialzed when converting to serialized everything should work fine as you've obviously already got all the fields set up for non-serialized/purchase orders. It just used JSON serialization, a few points to cadveat to be wary of

  1. When moving to the future be careful what types you use. Types like Money work fine in serialized carts but not so much with POs. Be careful of the types you use that they work still in the purchase order.
  2. If you have any searching code that searches by metafield using the helper methods these do not work when using serializable carts. I had to write my own SQL queries https://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2018/4/searching-through-serialized-carts-11-8-2/
#205520
Jul 15, 2019 17:51
Siddharth Gupta - Jul 15, 2019 23:42
Thank you Scott!
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.