Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 10 of 10

Thread: custom pagination...

  1. #1
    tytyguy is offline Senior Member
    Join Date
    Nov 2007
    Posts
    307

    Default custom pagination...

    Is anyone using their own custom pagination? I am finding it cumbersome when I have many products in a category and the page numbers fill up half the page...
    Would it be possible to make a custom one that maybe resembles googles page numbering Where only shows about 10-15 of the pages around the page you are on..

  2. #2
    Darth Rez is offline Junior Member
    Join Date
    Mar 2009
    Location
    Southern California
    Posts
    7

    Post Ajax Pagination

    Integration of Ajax Pagination (http://www.dynamicdrive.com) with AspDotNetStorefront ML 8.0.0.0. This solution is intended for Source Code licensees as it will require recompilation of the solution. The Dynamic Drive code did not integrate seamlessly so alterations to the Javascript were necessary. Refer to attachments for both original (OG) and altered versions.

    Add the <DIV> containers where the pagination control should appear within the ....xml.config file, for example within entity.gridwithprices.xml.config.
    Code:
    <TABLE>
        <TR>
            <TD valign="top"><div id="paginate-top" class="navRange"> </div></TD>
        </TR>
        <TR>
            <TD>
                <!-- YOUR GALLERY CONTENT HERE -->
            </TD>
        </TR>
        <TR>
            <TD><div id="paginate-bottom"> </div></TD>
        </TR>
    </TABLE>
    
    <xsl:value-of select="aspdnsf:AjaxPagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" />
    Add the following new function to XSLTExtentionBase.cs and recompile (I use MSBuild since I prefer a plain text editor over the very expensive Visual Studio):
    Code:
    public virtual string AjaxPagingControl(string sBaseURL, String sPageNum, String sNumPages){
        //-=-=-=- daRez: Pagination Mods
        //-=-=-=- Custom Ajax Pagination from http://www.dynamicdrive.com/dynamicindex17/ajaxpaginate/ (rezDefied)
        //-=-=-=- DEPENDENCIES: daPagination.js, daPagination.css
        
        InputValidator IV = new InputValidator("PagingControl");
        String BaseURL = IV.ValidateString("BaseURL", sBaseURL);
        int PageNum = IV.ValidateInt("PageNum", sPageNum);
        int NumPages = IV.ValidateInt("NumPage", sNumPages);
    
        string result = String.Empty;
        
        if (NumPages < 2){
            
            return "";
        }
        if (BaseURL.Length == 0){
            
            BaseURL = CommonLogic.GetThisPageName(false) + "?" + CommonLogic.ServerVariables("QUERY_STRING");
        }
        if (PageNum == 0){
            
            PageNum = CommonLogic.QueryStringUSInt("PageNum");
        }
        if (PageNum == 0){
            
            PageNum = 1;
        }
    
        String Separator = "?";
        if (BaseURL.IndexOf("?") != -1){
            Separator = "&";
        }
        
        StringBuilder tmpS = new StringBuilder(4096);
        
        tmpS.Append("<script type=\"text/javascript\">");
        tmpS.Append("var daPaginationArray = new Array(" + sNumPages + ");");
        
        for (int i = 0; i < NumPages; i++){
            
            if (BaseURL.ToLowerInvariant().IndexOf("pagenum=") == -1){
                
                tmpS.Append("daPaginationArray[" + i.ToString() + "] = \"" + BaseURL + Separator + "pagenum=" + (i+1).ToString() + "\";");
            }
            else{
                
                tmpS.Append("daPaginationArray[" + i.ToString() + "] = \"" + Regex.Replace(BaseURL, @"pagenum=\d+", "pagenum=" + (i+1).ToString(), RegexOptions.Compiled) + "\";");
            }
        }
    
        
        tmpS.Append("var daPages = {pages: daPaginationArray, selectedpage: 0};");
        tmpS.Append("var daBook = new ajaxpageclass.createBook(daPages, \"pcontent\", [\"paginate-top\",\"paginate-bottom\"]);");
        
        tmpS.Append("</script>");
        
        result = tmpS.ToString();
        return result;
    }

    It should be possible to derive a non compiled integration as well using the <C:\...\AspDotNetStorefront\Web\App_Code> folder to define a new AjaxPagingControl() function. Obviously the ....xml.config file will need to use an altered namespace when referencing the function, but this is probably a different thread in this forum.
    Attached Files Attached Files
    Last edited by Darth Rez; 04-24-2009 at 09:47 AM.

  3. #3
    DanV's Avatar
    DanV is offline Ursus arctos horribilis
    Join Date
    Apr 2006
    Posts
    1,568

    Default

    Wow nice

    Just a note on this too... If you have 50 pages in a category (assuming 20 products per page), you are talking about have over 1,000 items in a single category. It is probably worthwhile to spend time either reorganizing the items into proper subcategories, or using entity page filtering or some custom search logic to help customers find the items. No mortal shopper is going to ever make it to page 33 in a browse list...

  4. #4
    tytyguy is offline Senior Member
    Join Date
    Nov 2007
    Posts
    307

    Default

    can this be done with 7.1?

  5. #5
    Darth Rez is offline Junior Member
    Join Date
    Mar 2009
    Location
    Southern California
    Posts
    7

    Default Pagination for 7.x.x.x

    Yes, it also works with 7.1.
    I'll go further and say it works with any version that supports XML Packages and the XSLTExtensionBase class, but don't take that to the bank!

  6. #6
    VibeCommerce is offline Member
    Join Date
    Dec 2006
    Location
    Grandville, MI
    Posts
    63

    Default

    We include a very slick custom pagination control with our Search Filters and Attributes add ons. You can set parameters on it very easily.
    http://store.revolvercommerce.com/p-...e-filters.aspx

    We could probably even pull it out separately if you needed just that.

  7. #7
    jasont is offline Member
    Join Date
    Jul 2009
    Posts
    36

    Question

    I have searched all over the forums for a method to do this without the source code. Can someone point me in the right direction on how to create an app_code so that I can obtain this functionallity.

    Please view my other thread about the situation I'm having and how this would correct it.

    http://forums.aspdotnetstorefront.co...ad.php?t=18120

  8. #8
    tom.hundley is offline Junior Member
    Join Date
    Nov 2009
    Posts
    11

    Default

    Darth,
    Nice work on this. Thank you for posting it. It saved quite a bit of time for me.

    Dan,
    Agreed- Most categories probably shouldn't be that long. I needed it for Departments. I'm working on a store with 10K+ products and the departments pages are huge.

    Jason,
    Drop the cash for the source!

    Thanks again Darth.

    Regards,
    Tom Hundley

    Elegant Software Solutions, LLC
    Managing Consultant
    http://www.elegantsoftwaresolutions.com
    http://www.totalcarewebsites.com

  9. #9
    BloomerBeak is offline Member
    Join Date
    Oct 2007
    Location
    Davao City
    Posts
    76

    Default

    Darth,

    Thanks very much for posting..this is really helpful. ^_^
    ***Melay***
    Web Developer
    Philippines

  10. #10
    stagparkway is offline Junior Member
    Join Date
    Sep 2011
    Posts
    2

    Default User Definable Items Per Page

    Is there a way to allow the visitor to select number of items to display per page?