Show all items of all the categories instead of Popular items

Nishant16
Tera Expert

 How can i show all the items belonging to all catalogs and the categories available for a user in this Sc category widget instead of just showing the Popular items, How can i achieve this?

find_real_file.png

13 REPLIES 13

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

You can simply change the page and remove this popular item widget and add the other widget which shows the items per catagories.


Thanks,
Ashutosh

Hi Ashutosh, 

this is the Sc category widget that shows the items basis on the category selected, by default when no category selected it shows the popular items, how to show all items instead of the popular items in the same widget?

Shivani M S
Kilo Guru

Hi Nishant,

You can clone  SC Category Page widget and modify getPopularItems() function in server side script

something like this and replace this widget in sc_category page

function getPopularItems() {
var items = [];
var allowedItems = getAllowedCatalogItems();
var count = new GlideRecord('sc_cat_item');
count.orderBy('name');
count.addQuery('sys_id', "IN", allowedItems);
count.addEncodedQuery('active=true');
count.query();
while (count.next()) {
var catalogItemJS = new sn_sc.CatItem(count.getValue('sys_id'));
if (!catalogItemJS.canView() || !catalogItemJS.isVisibleServicePortal())
continue;
var item = {};
var catItemDetails = catalogItemJS.getItemSummary();
item.name = catItemDetails.name;
item.short_description = catItemDetails.short_description;
item.sys_id = catItemDetails.sys_id;
item.page = 'sc_cat_item';
items.push(item);
}

return items;
}

Also to you can rename Popular items title in server side as your wish.

 

Please mark correct if it is useful.

Thanks,

Shivani M S

Hi Shivani,

How can i restrict the items based on catalog to which they belong, also in this list the standard changes category items are also displayed, how can i restrict these here?