Accessing lineitems properties in LineItemValidator.IsValidCatalog



We used the ValidateLineItemsActivity to change a certain validation:

var isPromoItem = lineItem["IsPromoItem"] != null;

//check if the entry is not available
if ((!isPromoItem && !entryRow.IsActive) || requestDate < minAvailableDate || requestDate > entryRow.EndDate)
AddWarningSafe(Warnings, "LineItemRemoved-" + lineItem.LineItemId.ToString(),
String.Format("Item \"{0}\" has been removed from the cart because it is not available.",

If I'm not mistaken, I should now use the IsValidCatalog in my custom DefaultLineValidator to add my validation:

protected override bool IsValidCatalog(EntryContentBase entry, DateTime requestDate)
CatalogDto.CatalogRow catalogRow = this._catalogSystem.GetCatalogDto(entry.CatalogId).Catalog.FirstOrDefault();
if (catalogRow != null && catalogRow.IsActive && requestDate >= catalogRow.StartDate)
return requestDate <= catalogrow.enddate;>
return false;

My problem is that our custom property was on the lineitem and now I only have a EntryContentBase. Is there a way to access ou property from this function?

If not, how should I fix this?

Jul 12, 2018 21:54

You should have to override Validate(ILineItem lineItem, MarketId marketId, Action<ILineItem, ValidationIssue> onValidationError) instead :) 

Jul 13, 2018 10:14
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.