How to change results per Page in SCA.

By default in SCA configuration records, it is set to 20. But sometimes we need to reduce the search results instead of a long number of lists we need to separate this by a number of pages.

That’s why we have to reduce the search results. For that, you have to use a standard SCA pagination View file and in child view, you’ve to change the value of that results per page.

Filename – ‘GlobalViews.ShowingCurrent.View’ this is the standard View file used for pagination in SuiteCommerce advanced.


'GlobalViews.ShowCurrentPage': function() {
    this.collection.models.length = 8;
    this.collection.recordsPerPage = 8;
    return new GlobalViewsShowingCurrentView(
    {
       items_per_page: this.collection.recordsPerPage
    ,  total_items: this.collection.totalRecordsFound
    ,  total_pages: Math.ceil(this.collection.totalRecordsFound / this.collection.recordsPerPage)
    });
},

Here in this example, I’ve used Collection and I’m updating the value of the pages it’ll update the search results value in the array and the array will reduce from 20 to 10 and it shows the results of the same.

That’s how you can reduce the size of a standard SCA array from configuration records. And it’ll work for your module.

Leave a comment

Your email address will not be published. Required fields are marked *