this is the example:
public IPriceDetailValue SavePriceDetailValue(Entry catalogEntry)
{
var priceDetailService = ServiceLocator.Current.GetInstance<IPriceDetailService>();
// Set Price Detail value for Catalog Entry.
var priceDetailValue = new PriceDetailValue
{
CatalogKey = new CatalogKey(catalogEntry),
MarketId = new MarketId("US"),
CustomerPricing = CustomerPricing.AllCustomers,
ValidFrom = DateTime.UtcNow.AddDays(-7),
ValidUntil = DateTime.UtcNow.AddDays(7),
MinQuantity = 0m,
UnitPrice = new Money(100m, Currency.USD)
};
return priceDetailService.Save(priceDetailValue);
}
Hi,
I'm not sure I get your question, but you can simply create a CatalogKey by this:
var catalogKey = new CatalogKey(AppContext.Current.ApplicationId, entryCode);
Regards,
/Q
Ok, My question would be, can i create catalogkey baser on currentcontent without having to get Entry?
Hi
Since Entry is not cached by episerver commerce what should we use instead to create a
CatalogKey =
new
CatalogKey(catalogEntry), ?
Found this example but it is using Entry..
public
IPriceDetailValue SavePriceDetailValue(Entry catalogEntry)
{
var priceDetailService = ServiceLocator.Current.GetInstance();
// Set Price Detail value for Catalog Entry.
var priceDetailValue =
new
PriceDetailValue
{
CatalogKey =
new
CatalogKey(catalogEntry),
MarketId =
new
MarketId(
"US"
),
CustomerPricing = CustomerPricing.AllCustomers,
ValidFrom = DateTime.UtcNow.AddDays(-7),
ValidUntil = DateTime.UtcNow.AddDays(7),
MinQuantity = 0m,
UnitPrice =
new
Money(100m, Currency.USD)
};
return
priceDetailService.Save(priceDetailValue);
}
regards
Pawel