Display pagination twice

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 anni tempo fa
Hi all,
I would like to display pagination twice in category pages, once on top of the page and once at the bottom.
I tried to make some changes in the templates/categories/productsingrind.ascx file:

productsingrind.ascx

//first pager
<div class="product-pager" id="productpager" runat="server">
        <nopCommerce:Pager runat="server" ID="productsPager" FirstButtonText="<% $NopResources:Pager.First %>"
            LastButtonText="<% $NopResources:Pager.Last %>" NextButtonText="<% $NopResources:Pager.Next %>"
            PreviousButtonText="<% $NopResources:Pager.Previous %>" CurrentPageText="Pager.CurrentPage" />
    </div>
....

//second pager
<div class="product-pager" id="productpager1" runat="server">
        <nopCommerce:Pager runat="server" ID="productsPager1" FirstButtonText="<% $NopResources:Pager.First %>"
            LastButtonText="<% $NopResources:Pager.Last %>" NextButtonText="<% $NopResources:Pager.Next %>"
            PreviousButtonText="<% $NopResources:Pager.Previous %>" CurrentPageText="Pager.CurrentPage" />
    </div>




productsingrind.ascx.cs

if (productCollection.Count > 0)
{
  this.productsPager.PageSize = pageSize;
  this.productsPager.TotalRecords = totalRecords;
  this.productsPager.PageIndex = this.CurrentPageIndex;

  this.productsPager1.PageSize = pageSize;
  this.productsPager1.TotalRecords = totalRecords;
  this.productsPager1.PageIndex = this.CurrentPageIndex;

  this.dlProducts.DataSource = productCollection;
  this.dlProducts.DataBind();
}
...
if ((productCollection.Count < pageSize) && (this.CurrentPageIndex == 0))
{
  productpager.Attributes.Add("style", "display:none");
  productpager1.Attributes.Add("style", "display:none");
}
...
protected override void OnInit(EventArgs e)
{
  base.OnInit(e);

  ctrlPriceRangeFilter.ExcludedQueryStringParams = productsPager.QueryStringProperty;
  ctrlPriceRangeFilter.ExcludedQueryStringParams = productsPager1.QueryStringProperty;

  ctrlProductSpecificationFilter.ExcludedQueryStringParams = productsPager.QueryStringProperty;
  ctrlProductSpecificationFilter.ExcludedQueryStringParams = productsPager1.QueryStringProperty;
  ctrlProductSpecificationFilter.CategoryId = this.CategoryId;

  ctrlProductSpecificationFilter.ReservedQueryStringParams = "CategoryId,";
  ctrlProductSpecificationFilter.ReservedQueryStringParams += "orderby,";
  ctrlProductSpecificationFilter.ReservedQueryStringParams += ctrlPriceRangeFilter.QueryStringProperty;
  ctrlProductSpecificationFilter.ReservedQueryStringParams += ",";
  ctrlProductSpecificationFilter.ReservedQueryStringParams += productsPager.QueryStringProperty;
  ctrlProductSpecificationFilter.ReservedQueryStringParams += productsPager1.QueryStringProperty;
}
;

After aaplying the previous code, pagination is not working anymore. Did I miss something here? Could you help me fix it please?
13 anni tempo fa
Why did you add the following code?
if ((productCollection.Count < pageSize) && (this.CurrentPageIndex == 0))
{
  productpager.Attributes.Add("style", "display:none");
  productpager1.Attributes.Add("style", "display:none");
}

just remove it. I didn't try it, but it should work.
13 anni tempo fa
I removed the part of code you mentioned but it has no affect to the issue. Pagination is still broken. You can check it out in this page http://208.64.66.230/category/54-.aspx
13 anni tempo fa
It looks ok to me on the url you gave.

You need to remove this code as it is not required

...if ((productCollection.Count < pageSize) && (this.CurrentPageIndex == 0)){  productpager.Attributes.Add("style", "display:none");  productpager1.Attributes.Add("style", "display:none");}...protected override void OnInit(EventArgs e){  base.OnInit(e);  ctrlPriceRangeFilter.ExcludedQueryStringParams = productsPager.QueryStringProperty;  ctrlPriceRangeFilter.ExcludedQueryStringParams = productsPager1.QueryStringProperty;  ctrlProductSpecificationFilter.ExcludedQueryStringParams = productsPager.QueryStringProperty;  ctrlProductSpecificationFilter.ExcludedQueryStringParams = productsPager1.QueryStringProperty;  ctrlProductSpecificationFilter.CategoryId = this.CategoryId;  ctrlProductSpecificationFilter.ReservedQueryStringParams = "CategoryId,";  ctrlProductSpecificationFilter.ReservedQueryStringParams += "orderby,";  ctrlProductSpecificationFilter.ReservedQueryStringParams += ctrlPriceRangeFilter.QueryStringProperty;  ctrlProductSpecificationFilter.ReservedQueryStringParams += ",";  ctrlProductSpecificationFilter.ReservedQueryStringParams += productsPager.QueryStringProperty;  ctrlProductSpecificationFilter.ReservedQueryStringParams += productsPager1.QueryStringProperty;}
13 anni tempo fa
Whatever I do, the problem remains the same. I have already applied the changes you suggested but pagination is still not working properly. When I add pagination twice and click on page I get the following:

http://imageshack.us/photo/my-images/193/errorsxm.jpg/

Please take a look of the previous screenshot.
The pager displays normally the first time but when I click on any other page (2,3,4, Next Page, etc) I get the previous screen.
12 anni tempo fa
How to remove the Pagination from the Product list ?
12 anni tempo fa
Milan Billara wrote:
How to remove the Pagination from the Product list ?

Go to your category details page, then 'SEO' tab, then ensure that 'Allow customers to select page size' is unticked and 'Page size' is set to 1,000,000,000
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.