Views: 2036
Number of votes: 6
Average rating:

Extending Commerce - Content Area Functionality

By default, content areas in Episerver commerce items such as products and variants don't display the option for creating a new block, and only allows for blocks to be dragged in, as seen below.

Image content-area.PNG

However, an extremely simple solution to change this default behaviour is to inherit from IResourceable on your product/variant which will require the interface member ContentAssetsID to be declared which can simply be scaffolded to false, and this will be all the code required to display the content area as expected! 

    public abstract class SiteProductContent : ProductContent, IResourceable
        public Guid ContentAssetsID { get; set; }
Mar 06, 2018

Marcus B
( By Marcus B, 3/6/2018 10:17:24 PM)


Johan Book
( By Johan Book, 3/6/2018 11:58:55 PM)


( By GOSSO, 3/7/2018 11:16:55 AM)

thx for sharing! nice!

David Harlow
( By David Harlow, 5/3/2018 12:23:03 PM)

Update: We've decided to remove this functionality from our solution and allow editors to only add shared blocks to content areas on commerce pages, this is due to weird behaviour being viewed such as content completely dissapearing from the content area when not published, hopefully Episerver will fix this in the future. Feel free to vote for this in the following feature request:

Please login to comment.