I'm implementing a tiered pricing model for organizations following Shannon's blog here: https://world.episerver.com/blogs/Shannon-Gray/Dates/2012/7/Creating-tiered-pricing-for-organizations-and-visitor-groups/
I've added the custom SalePriceType:
With the new SalePriceType in place I now need to be able to create prices in code associated with this price type. The code to save a price requires creating a PriceDetailValue with a CustomerPricing object:
// Set Price Detail value for Catalog Entry.
var priceDetailValue = new PriceDetailValue
CatalogKey = new CatalogKey(catalogEntry),
MarketId = new MarketId("US"),
CustomerPricing = new
ValidFrom = DateTime.UtcNow.AddDays(-7),
ValidUntil = DateTime.UtcNow.AddDays(7),
MinQuantity = 0m,
UnitPrice = new Money(100m, Currency.USD)
The problem is I can't figure out how to create a new CustomerPricing with the PriceTypeId of my custom PriceType as the CustomerPricing uses an enum for PriceType.
If I understand you correctly then this was introduced in both of my books ...
I'll see if I published it as a blog post ...
Pretty sure this will work
Then in your code you will need to cast to integer to check if it is your price type.