EpiServer Commerce specific Attributes

We can use any attribute developed for CMS, in our commerce content type models. e.g.  ContentType attributes, Access attributes, AvailableContentTypes attributes, TemplateDescriptor attribute, Property attributes, Image URL attribute and Default backing types also.

There are only a few specific attributes for commerce only that we can use in our models

CatalogContentType attribute
To connect the content type with an existing meta class, the CatalogContentTypeAttribute can be used. we connect them by defining the name of the meta class that should be connected to the content type.

using EPiServer.Commerce.Catalog.ContentTypes;
using EPiServer.Commerce.Catalog.DataAnnotations;
namespace CodeSamples.EPiServer.Business.Commerce.Catalog.Provider
{
    [CatalogContentType(MetaClassName = “WineSKU”)]
    public class CatalogContentTypeAttributeSample : VariationContent
    {
    }

}

Encrypted attribute
To have “Use Encryption” enabled, we can use Encrypted attribute. It will encrypt the value when storing in MetaData plus.

SaveHistory attribute
To have “Save History” enabled, we can use SaveHistory attribute. This will save history of changes to the value in this property when storing in MetaData plus.

[Searchable(false)]

[CultureSpecific]
[UIHint(UIHint.CatalogContent)]
[Display(
            Name = “Catalog Node”,
            Description = “The catalog node from episerver commerce”,
            GroupName = TabNames.SITE_CONFIGURATION)]

public virtual ContentReference CatalogNode { get; set; }

To get the benefit of catalog browsing intefaces in CMS we can add a property like below in our CMS Page. few other members that can be used for UIHint are as following CatalogEntry, CatalogNode, CurrencySelector, DateTimeRangeSelector, DateTimeSelector, DecimalEditor, EmailAddress, MarketSelector, ProductVariation, SaleCodeEditor and TaxCategorySelector( defined in EPiServer.Commerce).

2 replies on “EpiServer Commerce specific Attributes”

  1. Hi Khurram
    I am using the UIHint.CatalogContent in a property, just like you describe but when I want to get the children categories in a Catalog, how do i do? any idea?

Comments are closed.