I have custom line item with name TreasuresLineItem
I have below line in ecf.order.config
The class looks like below
public class TreasuresLineItem : LineItem
{
public TreasuresLineItem() : base()
{
Initialize();
}
public TreasuresLineItem(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Initialize();
}
protected virtual void Initialize()
{
}
public bool IsGift
{
get { return GetBool(MetaFieldsConstants.LineItem.IsGift); }
set { this[MetaFieldsConstants.LineItem.IsGift] = value; }
}
public string Recipeints
{
get { return GetString(MetaFieldsConstants.LineItem.Recipients); }
set { this[MetaFieldsConstants.LineItem.Recipients] = value; }
}
}
When i try to add entry to cart and then cast it to TreasureLineItem. The system cast it successfully but accessing properties throws an null exception
/* Need entry for adding to cart */ var entry = CatalogContext.Current.GetCatalogEntry(cartLineItem.Code); var lineItem = ch.AddEntry(entry, cartLineItem.Quantity, false, new CartHelper[] { }) as TreasuresLineItem;
I have checked meta field exists in database and it is linked with TreasureLineItem, The database table for extended line item with column also exists.
Do you have any idea why it is happening like this?
Hi,
I have custom line item with name TreasuresLineItem
I have below line in ecf.order.config
The class looks like below
When i try to add entry to cart and then cast it to TreasureLineItem. The system cast it successfully but accessing properties throws an null exception
/* Need entry for adding to cart */
var entry = CatalogContext.Current.GetCatalogEntry(cartLineItem.Code);
var lineItem = ch.AddEntry(entry, cartLineItem.Quantity, false, new CartHelper[] { }) as TreasuresLineItem;
Throws exception
lineItem.IsGif accessing property throws exception
I have checked meta field exists in database and it is linked with TreasureLineItem, The database table for extended line item with column also exists.
Do you have any idea why it is happening like this?