We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 364
    • 32 Posts
    Trying to display a lot of products, being paginated, and sorted by menuindex for each category and subcategory. (have to use menu index, so it’s super easy for client to change the display order of her products. by just changing how it looks in the modx manager doc nav tree)

    Page structure is as follows. Each category and subcategory page is just a container using the same template. As just wanting to display 20 products per page, depending on if on main shop page, display all products. category 1 display all sub category products. and so on.

    Shopping page
    ------Category 1
    -----------Subcategory 1
    -------------------Product 1
    -------------------Product 2
    ------Category 2
    -----------Subcatagory1
    -------------------Product 1
    ------Category 3
    -----------Subcatagory1
    -------------------Product 1


    Template
                
                <div id="product_container">
    [[Ditto? &id=`cat0`  &depth=`1` &display=`all` &paginate=`0` &paginateAlwaysShowLinks= `0`  &showPublishedOnly=`1` &orderBy=`menuindex ASC`  &tpl=`CatagoryTemplate` &extenders=`request` &hideFolders=`0` &seeThruUnpub=`0`   ]]
    
    			</div>
     			<div id="clearfooter"></div>
                <center>
    				<p class="dittofontmyd samplebox"> 
    <strong>[+cat2_start+]</strong> - <strong>[+cat2_stop+]</strong> of <strong>[+cat2_total+]</strong> products | page <strong>[+cat2_currentPage+]</strong> of <strong>[+cat2_totalPages+]</strong> </p> 
    
    				<div id="ditto_pages"> <p class="dittofontmyd samplebox">[+cat2_previous+] [+cat2_pages+] [+cat2_next+] </p> </div> 
    			</center>
          </div>	
    


    Chunk CatagoryTemplate
    [!Ditto?  &id=`cat1` &parents=`[+id+]` &depth=`1`  &display=`all` &paginate=`0` &paginateAlwaysShowLinks= `0`  &orderBy=`menuindex ASC` &tpl=`Catagory2_tpl` &extenders=`request` &hideFolders=`0` &seeThruUnpub=`0` !]
    


    Chunk Catagory2_tpl
    [[Ditto? &id=`cat2`  &parents=`[+id+]` &depth=`3`   &display=`20`  &paginate=`1` &paginateAlwaysShowLinks= `1`  &showPublishedOnly=`1` &orderBy=`menuindex ASC`  &tpl=`ProductTemplate` &extenders=`request` &hideFolders=`1` &seeThruUnpub=`0` ]]
    


    I only have an issue on the main Shopping page. The products do not get paginated correctly, It will display the first 20 products from the firsts category’s subcategory, then displays the next sub category’s 20 products, It displays about the 200+ products instead of the 20... the pagination part says 1 - 20 of 25 products | page 1 of 2
    < Previous 12 Next > when clicking on the next. it then displays the any products 21-40 of each sub category. http://jewelrybyharlow.com/duplicate-of-shop/

    If i got to a category page to see the products things display fine, example http://jewelrybyharlow.com/duplicate-of-shop/summer.html

    I’ve tried swapping the cached and uncached ditto calls. Tried all the combinations of what ditto call does the pagination, and changed pagination place holders accordingly ect...

    Any idea’s would be much appreciated. Or a different way to sort my menuindex without the nested calls.
    using evo 1.0.2 no phx installed.
      • 4310
      • 2,310 Posts
      I think if you have multiple Ditto calls you need to give each a unique id to stop the result sets getting lumped together.
      Maybe try adding something like this to each call :
      id=`leveln`
        • 364
        • 32 Posts
        I do us a unique ID for each ditto call..
        &id=`cat2`...  &id=`cat1`.... &id=`cat0`


        Also found if you use
        [+cat2_previous+] [+cat2_pages+] [+cat2_next+]
        Have [+ID_Placeholder+] for the pagination placeholders, you can specify which ditto calls pagination place holders get used.

          • 4310
          • 2,310 Posts
          Oops.
          Need to read more carefully sad