Skip to content

Instantly share code, notes, and snippets.

@bentayloruk
Created March 28, 2012 13:50
Show Gist options
  • Save bentayloruk/2226337 to your computer and use it in GitHub Desktop.
Save bentayloruk/2226337 to your computer and use it in GitHub Desktop.
public class ProductDisplayWithPromoInfo
{
public ProductDisplayDto CreateProductDisplayDto(Product product)
{
//Get the PromoShoutOutService
var shoutOutService = PromotionContext.Current().CreatePromoShoutOutService();
//Get the explicitly configured shouts outs for the product (the ones with ShoutOut in the CS discount comment field)
var productPromoShoutOuts = shoutOutService.GetPromoShoutOutsForProduct(product, ShoutOutSelection.ExplicitlyConfiguredForShoutOut);
foreach (var skuInPromotionShoutOut in productPromoShoutOuts)
{
//Let's look at the data we could use in the category, search or product page listings...
// skuInPromotionShoutOut.ShoutOut.Text // Nice message for customer like "3 for 2 on XBox Games!"
// skuInPromotionShoutOut.Sku.ProductId
// skuInPromotionShoutOut.Sku.CatalogName
// skuInPromotionShoutOut.SkuIsAwardOfPromotion
// skuInPromotionShoutOut.SkuIsConditionOfPromotion
}
return ProductDto.CreateFrom(product, productPromoShoutOuts);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment