November Happy Hour will be moved to Thursday December 5th.

What should we use instead of Entry

Vote:
 

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
#145099
Feb 24, 2016 18:05
Vote:
 

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);
}

#145100
Feb 24, 2016 18:13
Vote:
 

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

#145103
Feb 24, 2016 23:09
Vote:
 

Ok, My question would be, can i create catalogkey baser on currentcontent without having to get Entry?

#145107
Feb 25, 2016 8:20
Vote:
 

If you have an EntryContentBase (ProductContent, VariationContent or their derivatives), you can do something like this:

var catalogKey = new CatalogKey(content.ApplicationId, content.Code);

/Q

#145112
Feb 25, 2016 10:50
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.