foreach(DiscountItem item in applicableDiscounts) {
//your logic here }
Try tweaking the DiscountCriteriaFilter (documentation provided on the link above) to get what you want to display. You probably want to avoid showing discounts that require a coupon code.
I don't know what the default setting is for the five member properties, but you'll probably need to set some of them to true to populate the collection.
Discounts
Frank Uray
Kay-Davis
Dean Stewart
You could consider using the runtime discount filter:
http://msdn2.microsoft.com/en-us/library/microsoft.commerceserver.runtime.marketing.aspx
Here's a code sample:
DiscountItemCollection allDiscounts = DiscountItemCollection.CreateFromCache("Discounts");
DiscountCriteriaFilter filter = new DiscountCriteriaFilter();
DiscountItemCollection applicableDiscounts = allDiscounts.ApplyProductFilter(filter, catalog, product);
foreach(DiscountItem item in applicableDiscounts)
{
//your logic here
}
Try tweaking the DiscountCriteriaFilter (documentation provided on the link above) to get what you want to display. You probably want to avoid showing discounts that require a coupon code.
Ron J51027
Using virtual catalogs. Tried diffrent combinations on filter flags. Still no with result.
See code below
void MyTest()
{
DiscountItemCollection allDiscounts = DiscountItemCollection.CreateFromCache("Discounts");
DiscountCriteriaFilter filter = new DiscountCriteriaFilter();
filter.FilterOnAward = false;
filter.FilterOnCondition = false;
filter.IncludeDiscountsWithEligibilityRequirements = false;
filter.IncludeDiscountsWithPromoCodes = false;
filter.IncludeInactiveDiscounts = false;
DiscountItemCollection applicableDiscounts = allDiscounts.ApplyProductFilter(filter, "GB-Catalog", "TG_TSHIRT(ScaniaBaseCatalog)");
foreach (DiscountItem item in applicableDiscounts)
{
Response.Write(item.ToString());
//your logic here
}
}
RafaBotero
Hi,
Can you be more specific about your problem
--Sachin Saxena
Jarret
I try Your code and see in allDiscounts all my discounts.
When I apply ApplyProductFilter or ApplyCategoryFilter it always returns zero items. Still I set productid or category id with discount.
Esp. for product id wich in my bascet gets the correct discount.
I use virtual catalogs and set the discount on the virtual catalog for the category the product belongs to.
Any idea why I not get any results at all
Regards Johan
sl0140
Johan,
What properties are you setting on the DiscountCriteriaFilter This is probably the reason you're not getting any records.
Here's the documentation on it:
http://msdn2.microsoft.com/en-us/library/microsoft.commerceserver.runtime.marketing.discountcriteriafilter.aspx
I don't know what the default setting is for the five member properties, but you'll probably need to set some of them to true to populate the collection.