Developer forum

Forum » Templates » Load more products in Products page

Load more products in Products page

Tomas Gomez
Reply

Hi,

In the Products page, we detected that the button "Load more products" doesn't work as expected.

For instance,when the settings of the Product Catalogue App are 9 products per page the page is loaded with 9 products. After clicking the button "Load more products" there should displayed another 9 products (that is a total of 18 products) but a total of 39 of products are displayed.

Why is this behaviour? Is it a bug? How can we correct it?

Regards,
Tomas

 


Replies

 
Tomas Gomez
Reply

More info on this issue:

The template Swift_ProductListGridView.cshtml has a variable pageSizeSetting = 30. This setting is causing the issue.

Why is this setting? Should this variable be initialized with the "Products per page" of the Product Catalogue App?

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply
This post has been marked as an answer

Hi Tomas,

 

I happen to know that has been fixed in Bug #8083, which will be released in the next version.

 

Best Regards,

Nuno Aguiar

Votes for this answer: 1
 
Tomas Gomez
Reply

Hi Nuno,

Thanks for the confirmation :-)

Could you provide a piece of code with the patch?

Regards,
Tomas

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply
This post has been marked as an answer

Hi Tomas,

 

Sure:

int pageSizeSetting = 30;
int pageSizeSetting = Converter.ToInt32(Dynamicweb.Context.Current.Request.QueryString.Get("OriginalPageSize")) > 0 ? Converter.ToInt32(Dynamicweb.Context.Current.Request.QueryString.Get("OriginalPageSize")) : productList.PageSize;

And then further in the form you need to add the following hidden field (i.e. place it above the PageSize hidden field).

<input type="hidden" name="OriginalPageSize" value="@pageSizeSetting">

 

There are 4 files where this is applied to:

  • Swift_ProductListCompactView.cshtml
  • Swift_ProductListGridView.cshtml
  • Swift_ProductListItemRepeater.cshtml
  • Swift_ProductListListView.cshtml

 

Best Regards,

Nuno Aguiar

Votes for this answer: 1
 
Tomas Gomez
Reply

Thanks a lot Nuno :-)

 

You must be logged in to post in the forum