November Happy Hour will be moved to Thursday December 5th.

Showing item list count in commerce

Vote:
 

Hello, Is there a way out where we could display count of items/products under a category in commerce? Currently default view shows items in property view but we would like to make sure we have total count displayed in property view. 

Here is the sample list where we would like to display count.

#278124
Apr 08, 2022 12:33
Vote:
 

Hi!

There is no official way of doing this unfortunately. The Catalog UI is in need of a refresh if you ask me.

It should be possible to achieve it with a custom ViewConfiguration and some dojo/dijit code. Here is a pointer in the right direction:

ViewConfiguration (backend):

First of all you will need to create a custom view configuration. It must have the same key as the default view. Here is an example:

[ServiceConfiguration(typeof(ViewConfiguration))]
public class CategoryViewConfiguration : ViewConfiguration<NodeContentBase>
{
    public CategoryViewConfiguration()
    {
        Key = CommerceViewConfiguration.CatalogContentListViewName;
        LanguagePath = "/commerce/contentediting/views/cataloglist";
        ControllerType = "catalog-ui/CatalogContentList"; // The default ControllerType is epi-ecf-ui/widget/CatalogContentList. You have to create your own and inherit from default.
        IconClass = "epi-iconList";
        SortOrder = 250; // Needs to be lower than 300 which is used by the default configuration.
        Category = CommerceViewConfiguration.CatalogCategory;
    }
}

Dojo/dijit widget (~/ClientResource/catalog-ui/v1/CatalogContentList.js):

define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'epi-ecf-ui/widget/CatalogContentList'
], function (declare, lang, CatalogContentList) {
    return declare(
        'catalog-ui/CatalogContentList',
        [CatalogContentList], {
            // Add new and/or override logic here
    });
});

Module.config sample to map catalog-ui to ~/ClientResources/catalog-ui/v1 path:

<?xml version="1.0" encoding="utf-8"?>
<module>
  <clientResources />
  <dojo>
    <paths>
      <add name="catalog-ui" path="catalog-ui/v1" />
    </paths>
  </dojo>
</module>
 
#280454
Edited, May 17, 2022 12:46
- May 17, 2022 12:54
Thanks Matt, I'll try out and let you know
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.