November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
SerializableCart is different so the settings in ecf.order.config do not apply. I haven't tried it but I think you would have to extend SerializableLineItem (yes, it is supposed an internal class) and read/write to Properties from your properites.
I think think it would be "safer" in the long run to just go ahead and create extension methods for ILineItem (ore maybe IExtendedProperties) and not be dependent on a specific implementation.
Thank you (again) for you help! :)
The biggest problem with the extension methods are that they are harder to test.
You can do something like this:
public static void SetProperty(Hashtable properties, string name, object value) { properties[name.ToLower()] = value; }
Then you would be able to call it on any lineitem to save the value:
SetLineItemProperty(lineItem, nameof(CartItemModel.IsDirectDeliveryProduct), model.IsDirectDeliveryProduct);
Be careful with arrays though, since they are not supported by Episerver.
Hi,
Does anyone have any hints about the steps needed to implement a custom LineItem (for serialized carts)?
I would like to have a custom LineItem class, with properties for various things (to make it simpler to use than using ...Properties[".."] as string, etc.), what needs to be changed/coded to make ICart.CreateLineItem() return an instance of my custom LineItem class, etc?
I tried inheriting from the Mediachase.Commerce.Orders.LineItem class, and registering the new class in ecf.order.config, but I get an exception about EPiServer.Commerce.Order.Internal.SerializableLineItem not being castable to my custom line item class.