in

dashCommerce

An ASP.NET Open Source e-Commerce Application

Category with > 12 Pages doesn't fit in paging bar

Last post 11-19-2008 9:04 AM by bibber. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 06-05-2008 1:08 PM

    Category with > 12 Pages doesn't fit in paging bar

    When a category contains many products the paging bars (top/bottom) on the catalog page cannot contain the number of pages.

    I have 150+ products in a single category (subcategories acutally but the products also display in the parent category) with site settings at 6 products per page (to keep the site compact without much vertical scrolling). Next to the "Showing X - Y of Z Results" the paging bar is too long to fit and therefore shifts down to partially below the blue bar graphic.

     How can change the paging to fit in the space alloted?

    Thanks. 

  • 06-06-2008 9:33 AM In reply to

    • bibber
    • Top 25 Contributor
    • Joined on 03-12-2008
    • Ottawa
    • Posts 34

    Re: Category with > 12 Pages doesn't fit in paging bar

    Hey there,

    I thought I'd jump on this one. I too encountered the same issue with > 9000 products in the same category. I modified the paging.aspx.cs codebehind to display correctly. It's still not 100% perfect but my client seems happy to accept this for now... here's what I did...

    I modified the page_load handler as such:

    /*  ORIGINAL!!!
    lblShowingTotals.Text = string.Format(LocalizationUtility.GetText("lblShowingTotals"), startNumber, endNumber, PagedDataSource.DataSourceCount);

    pageLinks.InnerHtml = "";

    for (int i = 0; i < PagedDataSource.PageCount; i++) {

    if (PagedDataSource.CurrentPageIndex == i) {

    pageLinks.InnerHtml += (i + 1) + "&nbsp;&nbsp;";

    }

    else {

    pageLinks.InnerHtml += string.Format(PAGING_BUTTON_TEMPLATE, isSearchPage ? ResolveUrl(GetSearchPagedUrl(searchTerms, i)) : ResolveUrl(GetCatalogPagedUrl(categoryId, i)), i + 1);

    }

    }

    */

    int MaxForNow = 0;
    bool MaxReached = false;
    int MaxTotalPages = 0;if (PagedDataSource.PageCount > 20)

    {

    MaxForNow = 19;

    MaxReached =
    true;

    MaxTotalPages = ((PagedDataSource.PageCount / PagedDataSource.PageSize) / MaxForNow);

    }

    else

    {

    MaxForNow = PagedDataSource.PageCount;

    }

    if (MaxReached)

    {

    for (int i = PagedDataSource.CurrentPageIndex; i < (PagedDataSource.CurrentPageIndex + MaxForNow); i++)

    {

    if (i < ((PagedDataSource.CurrentPageIndex + MaxForNow) - 2))

    {

    if (PagedDataSource.CurrentPageIndex == i)

    {

    pageLinks.InnerHtml += (i + 1) +
    "&nbsp;&nbsp;";

    }

    else

    {

    pageLinks.InnerHtml +=
    string.Format(PAGING_BUTTON_TEMPLATE, isSearchPage ? ResolveUrl(GetSearchPagedUrl(searchTerms, i)) : ResolveUrl(GetCatalogPagedUrl(categoryId, i)), i + 1);

    }

    }

    }

    }

    else

    {

    for (int i = 0; i < PagedDataSource.PageCount; i++)

    {

    if (PagedDataSource.CurrentPageIndex == i)

    {

    pageLinks.InnerHtml += (i + 1) +
    "&nbsp;";

    }

    else

    {

    pageLinks.InnerHtml +=
    string.Format(PAGING_BUTTON_TEMPLATE, isSearchPage ? ResolveUrl(GetSearchPagedUrl(searchTerms, i)) : ResolveUrl(GetCatalogPagedUrl(categoryId, i)), i + 1);

    }

    }

    }

     

    Hope this helps... I'm STILL working on it, but this should give you a tarting point.

    da bibber

  • 09-25-2008 2:54 PM In reply to

    • PCTech
    • Top 150 Contributor
    • Joined on 02-12-2008
    • Posts 6

    Re: Category with > 12 Pages doesn't fit in paging bar

    Hey Da Bidder,

     Nice work on the Mod to handle paging for categories with thousands of items. I applied to my version and for the most part am happy with the performance. Kudos to you!

     I am however seeing some strange behavior when I place my cursor in the search textbox up top (with no text in the box) and I strike the "Enter" key. For some reason, the code in your mod doesn't seem to run correctly. It displays the paging listing three times... I'm wondering if you had the same issue, and if you had overcome it yet?

     Thanks in advance,

    Jose

  • 09-26-2008 6:25 AM In reply to

    • bibber
    • Top 25 Contributor
    • Joined on 03-12-2008
    • Ottawa
    • Posts 34

    Re: Category with > 12 Pages doesn't fit in paging bar

    PCTech...


    hmmm... I was able to reproduce this... let me look deeper and I'll get you an answer soon...

    da bibber

  • 11-19-2008 1:51 AM In reply to

    Re: Category with > 12 Pages doesn't fit in paging bar

    this code is fit to my requirement....nice working.....thank..you 

     This is very important thing that i am coming out of problem.please visit my site http://83.103.78.89/

    Thank you very much Cake

    hiren mel
    Filed under:
  • 11-19-2008 9:04 AM In reply to

    • bibber
    • Top 25 Contributor
    • Joined on 03-12-2008
    • Ottawa
    • Posts 34

    Re: Category with > 12 Pages doesn't fit in paging bar

    Folks,

    It's fixed.... what you need to do is wrap the above code with an if statement. That does the trick...

    if (PagedDataSource.Count > 0)
    {
    code
    }

    Hope this helps...
    da bibber

Page 1 of 1 (6 items)