联系我们

Enabling Blocks by Default in Optimizely Commerce

VP, Enterprise Platforms
Valtech

七月 22, 2017

Using Optimizely Blocks, to e.g. support re-usable components, in Optimizely Commerce content is a very common scenario.

Out of the box, that is indeed also possible. It only requires you to register a ContentReference driven property type – e.g. ContentReference, ContentArea or List – for it to be supported in the authoring interface.

After you’ve done that, you will probably realize that the “Blocks” asset panel in the right hand side pane by default is unavailable to your editors, requiring these to manually go in an add the “Blocks” gadget to their view.

How to enable the “Blocks” panel, by default, in Optimizely’s Catalog view

Enabling “Blocks”, by default, in Optimizely’s Catalog is very easy. Since it’s not documented anywhere, it’s absolutely worth writing a simply blog post about!

You’ll only need to create a single class, which through Optimizely’s component system makes the “Blocks” gadget available for both existing and new content editors.

[Component]

public class SharedBlocksNavigationComponent : ComponentDefinitionBase

{

    public SharedBlocksNavigationComponent() : base("epi-cms/component/SharedBlocks")

    {

        this.LanguagePath = "/episerver/cms/components/sharedblocks";

        this.SortOrder = 150;

        this.PlugInAreas = new string[] { "/episerver/commerce/assets/defaultgroup" };

        this.Categories = (IEnumerable<string>)new string[1]

        {

          "commerce"

        };

        this.Settings.Add(new Setting("repositoryKey", BlockRepositoryDescriptor.RepositoryKey));

    }

}

Original article was posted on Optimizely Fellow: 

http://fellow.aagaardrasmussen.dk/2017/07/22/enabling-blocks-by-default-in-episerver-commerce/

开始实现梦想

您是一个渴望突破数字革命界限的创新、有远见的人吗?Valtech正在寻找像您这样的创造性思维。
Explore our open positions

联系我们

我们很想听到您的声音! 请填写表格,离办公室最近的人将与您联系。

让我们重新创造未来