I have a category in catalog called "On Sale" with Code - "On-Sale_2". Now I add linked product (it includes all variations too) to this category.
Then I set promotion like this with these conditions:
TargetLineItem.CatalogNode - Equals (Text) - On Sale
get % off item reward 70%
But discount is not applied for the product. When I remove conditions then discount is applied to all products.
I also tried these conditions:
TargetLineItem.CatalogEntryId - Equals (Text) - On-Sale_2
The CatalogNode value is not set automatically when you create the line item. So you might want to set it when you add an entry to card. Check if the entry is linked to the catalog node then set it.
The CatalogEntryId is the code of the entry, will be set automatically, and should not work in your case.
I need price to be shown also in the product list, not only when add to cart. To get the price I am using:
var price = StoreHelper.GetDiscountPrice(entry);
I decompiled this method and see that it goes through all CatalogNodes for Entry and concatenates codes and names and appies to promotion:
if (entry.Nodes != null && entry.Nodes.CatalogNode != null && entry.Nodes.CatalogNode.Length > 0)
foreach (CatalogNode catalogNode in entry.Nodes.CatalogNode)
string name = CatalogContext.Current.GetCatalogDto(catalogNode.CatalogId).Catalog.Name;
if ((string.IsNullOrEmpty(catalogName) || name.Equals(catalogName)) && (string.IsNullOrEmpty(catalogNodeCode) || catalogNode.ID.Equals(catalogNodeCode, StringComparison.OrdinalIgnoreCase)))
catalogName1 = !string.IsNullOrEmpty(catalogName1) ? catalogName1 + ";" + name : name;
catalogNodeCode1 = !string.IsNullOrEmpty(catalogNodeCode1) ? catalogNodeCode1 + ";" + catalogNode.ID : catalogNode.ID;
So I assumed that my Promotion settings was almost correct except that I had to change comparision Equals (Text) to Contains:
TargetLineItem.CatalogNode - Contains - On-Sale_2
But discount still is not applied.
P.S. I am creating Promotion as Catalog Entry: Build Your Own Discount
Started to look more deeply and found this in MarketingContext method EvaluatePromotions:
if (context.TargetEntriesSet.Entries.Count > 0)
bool flag3 = true;
foreach (PromotionEntry promotionEntry in (IEnumerable<PromotionEntry>) context.TargetEntriesSet.Entries)
string catalogEntryCode = promotionEntry.CatalogEntryCode;
string catalogNodeCode = promotionEntry.CatalogNodeCode;
string catalogName = promotionEntry.CatalogName;
if (!string.IsNullOrEmpty(catalogEntryCode) || !string.IsNullOrEmpty(catalogNodeCode) || !string.IsNullOrEmpty(catalogName))
PromotionDto.PromotionConditionRow promotionConditionRows = promotionItem.DataRow.GetPromotionConditionRows();
if (promotionConditionRows != null && promotionConditionRows.Length > 0)
foreach (PromotionDto.PromotionConditionRow promotionConditionRow in promotionConditionRows)
if (!string.IsNullOrEmpty(catalogEntryCode) && !promotionConditionRow.IsCatalogEntryIdNull() && !promotionConditionRow.CatalogEntryId.Equals(catalogEntryCode))
flag3 = false;
if (!string.IsNullOrEmpty(catalogNodeCode) && !promotionConditionRow.IsCatalogNodeIdNull() && !promotionConditionRow.CatalogNodeId.Equals(catalogNodeCode))
flag3 = false;
if (!string.IsNullOrEmpty(catalogName) && !promotionConditionRow.IsCatalogNameNull() && !promotionConditionRow.CatalogName.Equals(catalogName))
flag3 = false;
int num = flag3 ? 1 : 0;
Maybe I am wrong, but it looks like it totally ignores condition type (equals or contains) when evaluates promotion for CatalogName, CatalogNodeId and CatalogEntryId and expects it to excatly equal to provided code. And as I saw previously from StoreHelper it concatenates all categories (names and codes) separated by semicolon. So it is not likely that such condition ever be true:
For example, if configured CatalogNodeId = 'Accessories' and catalogNodeCode = 'Accessories;On-Sale':
It is always false.
TargetLineItem.CatalogNode - Contains (Text) - On Sale
The bug related to this was fixed in in 8.12.0, you'll need to update to that version to have it worked for you.
Thanks, I will update my solution.