Show all items in service catalog on load

Mary S
Mega Sage

We would like to show all catalog items on load for the service catalog.  Use case: Users just select something they see instead of searching for proper form which leads to misrouting. 

I have tried changing the instance option number of items on page, but 12 are displayed no matter what I enter.  I'd rather show all items instead of all popular, though.

From searching the community, lines 42-50 in the server script are what dictates what to display when there is no category.

if (GlideStringUtil.nil(data.category_id)) {
data.items = getPopularItems();
data.show_popular_item = true;
data.all_catalog_msg = (($sp.getCatalogs().value + "").split(",")).length > 1 ? gs.getMessage("All Catalogs") : "";
data.all_cat_msg = gs.getMessage("All Categories");
data.category = {title: gs.getMessage("Popular Items"),
description: ''};
return;
}

Is there a way to edit this so all items are shown?  Possibly by popularity?

Thanks in advance for any suggestions!

1 ACCEPTED SOLUTION

Mary S
Mega Sage

Line 165 in server script has an itemsLimit that was set to 6.  Raising this number allows more items to display.

 

Lines 159-169:

	function getPopularItems() {
        return new SCPopularItems().useOptimisedQuery(gs.getProperty('glide.sc.portal.popular_items.optimize', true) + '' == 'true')
            .baseQuery(options.popular_items_created + '')
            .allowedItems(getAllowedCatalogItems())
            .visibleStandalone(true)
            .visibleServicePortal(true)
            .itemsLimit(75)
            .restrictedItemTypes('sc_cat_item_guide,sc_cat_item_wizard,sc_cat_item_content,sc_cat_item_producer'.split(','))
            .itemValidator(function(item, itemDetails) {
                if (!item.canView() || !item.isVisibleServicePortal())
                    return false;

 

View solution in original post

9 REPLIES 9

Hi Mary, What is the name of the widget that you want to make this change to?  

 

SC Category Page

Line 65-66 has the limit 

data.items = [];
var itemsInPage = options.limit_item || 9;

 

also the function has the limit defined at the startof it 

function getPopularItems () {
var limit = 6;
var items = [];
var allowedItems = getAllowedCatalogItems();

Updating these lines did not change how many are shown.  It persists at 12.

I did find another post that gets closer to what we need though it would be nice to sort by popularity instead of name.

Show all items of all the categories instead of Popular items

 

Mary S
Mega Sage

Line 165 in server script has an itemsLimit that was set to 6.  Raising this number allows more items to display.

 

Lines 159-169:

	function getPopularItems() {
        return new SCPopularItems().useOptimisedQuery(gs.getProperty('glide.sc.portal.popular_items.optimize', true) + '' == 'true')
            .baseQuery(options.popular_items_created + '')
            .allowedItems(getAllowedCatalogItems())
            .visibleStandalone(true)
            .visibleServicePortal(true)
            .itemsLimit(75)
            .restrictedItemTypes('sc_cat_item_guide,sc_cat_item_wizard,sc_cat_item_content,sc_cat_item_producer'.split(','))
            .itemValidator(function(item, itemDetails) {
                if (!item.canView() || !item.isVisibleServicePortal())
                    return false;