Try Now
More in this section

Forums / General Discussions / Products sample questions

Products sample questions

1 posts, 0 answered
  1. Denis
    Denis avatar
    105 posts
    27 Feb 2009
    15 Jun 2012
    Link to this post

    I just created custom module based on Products sample from the SDK.

    I would like to add the following some functionality:

    In the backend “Grid View Mode” I want add one more column representing, lest say, products color. Products color field tied to the “Colors” taxonomy. In my case it is single choice. If it is possible, could you please provide code sample how to add such column.


    Also, I would like to add filtration functionality by color in the side bar. My experiments didn’t work. In the definitions file I found place where “filter by tags” option is added. I simply tried to replace "Tags" taxonomy id with the "Colors" taxonomy id:

                var clientTemplateBuilder = new System.Text.StringBuilder();
                clientTemplateBuilder.Append(@"<a href=""javascript:void(0);"" class=""sf_binderCommand_filterByTag");
                clientTemplateBuilder.Append(@""">{{Title}}</a> <span class='sfCount'>({{ItemsCount}})</span>");
                var tagFilterWidget = new DynamicCommandWidgetElement(tagFilterSection.Items)
                    Name = "TagFilter",
                    CommandName = "filterByTag",
                    PageSize = 10,
                    WidgetType = typeof(DynamicCommandWidget),
                    IsSeparator = false,
                    BindTo = BindCommandListTo.Client,
                    //I modified next line
                    BaseServiceUrl = String.Format("~/Sitefinity/Services/Taxonomies/FlatTaxon.svc/{0}/", "8B121C60-692F-45B3-8E87-05D35F696E92"),
                    ResourceClassId = typeof(Labels).Name,
                    MoreLinkText = "ShowMoreTags",
                    MoreLinkCssClass = "sfShowMore",
                    LessLinkText = "ShowLessTags",
                    LessLinkCssClass = "sfShowMore",
                    SelectedItemCssClass = "sfSel",
                    ClientItemTemplate = clientTemplateBuilder.ToString()
                tagFilterWidget.UrlParameters.Add("itemType", typeof(PortfolioItem).AssemblyQualifiedName);
                    new Guid("8B121C60-692F-45B3-8E87-05D35F696E92"),  //And this line

    After this the link on the side bar shows correct taxons from the Colors taxonomy, but when I clink on one of them, the main grid becomes empty and says "no items to display". Although I have items assigned to the Colors taxons.
    Please let me know the correct way to implement this functionality. Code samples are appreciated.


1 posts, 0 answered