Developer forum

Forum » Rapido » Extending the product list

Extending the product list

Lars Larsen
Lars Larsen
Reply

Hi

I am new to the concept of extending Rapido using blocks. Therefore I have tried to extend the product list using the example from this page. First isn't a typo when it says:

Open the Rapido/eCom/ProductList/Blocks/CustomBlocks.cshtml template

Shouldn't it be Custom__Blocks.cshtml? I have used that naming. I get a table button to select my view but still nothing is shown in my product list (the progress circle runs for ever). What can be wrong. My code is here:

@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
@using Dynamicweb.Core
@using System
@using System.Web
@using System.Collections.Generic
@using Dynamicweb.Rapido.Blocks
@using Dynamicweb.Rapido.Blocks.Extensibility
@using Dynamicweb.Rapido.Blocks.Components
@using Dynamicweb.Rapido.Blocks.Components.Articles
@using Dynamicweb.Rapido.Blocks.Components.General

@{
    BlocksPage customBlocksPage = BlocksPage.GetBlockPage("ProductList");

    Block customView = new Block
    {
        Id = "ProductCustomItemContainer",
        Name = "table",
        SortId = 50,
        Template = RenderMyProductList()
    };
    customBlocksPage.Add("Views", customView);
}

@helper RenderMyProductList()
{
    <script id="ProductCustomItemContainer" type="text/x-template">
        {{#.}}
        <div id="Product{{id}}" class="grid__col-md-12 product-list__details-item grid--direction-row grid--justify-space-between u-no-padding-x dw-mod" data-template="ProductTableItem" data-preloader="overlay">
            {{#Product}}
            {{>ProductCustomItem}}
            {{/Product}}
        </div>
        {{/.}}
    </script>

    <script id="ProductCustomItem" type="text/x-template">
        {{#.}}
        <div class="grid__cell u-padding">
            <div class="u-pull--left">
                <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}">
                    {{name}}
                </a>
            </div>
            <div class="u-pull--left u-margin-left">#{{number}}</div>
            <div class="u-pull--right">{{price}}</div>
        </div>
        {{/.}}
    </script>
}

Replies

 

You must be logged in to post in the forum