We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41294
    • 34 Posts
    I have a getPage snippet with getResources element that limits to 10 counts per page:

    [[!getPage?
           &element=`getResources` 
           &parents=`[[*id]]`
           &tpl=`store-product-list-tpl`
           &includeTVs=`1`
           &processTVs=`1`
           &includeContent=`1`       
           &limit=`10`
           &sortbyTV=`product_price` 
           &sortdirTV=`DESC`      
           &sortby=``
           &toPlaceholder=`productItems`
        ]]


    Problem is that it sorts the product list correctly at 1-6th items, it shows like this:


    • Product 1 [price: 7]
    • Product 1 [price: 6]
    • Product 1 [price: 5]
    • Product 1 [price: 4]
    • Product 1 [price: 3]
    • Product 1 [price: 2]
    • Product 1 [price: 12]
    • Product 1 [price: 11]
    • Product 1 [price: 10]
    • Product 1 [price: 9]

    As you can see above's product items listed with price values, it sorted correctly on first 6th items, then went back to high price value item and decrementing again. Is this a bug?

    Also the sorting only limits per page. I want it to sort for the entire product results not just per page results. Anyway how to do this using getPage and getResources?
      • 46848
      • 1 Posts
      It's sorting items incorrectly because the order by "string" and not by "number", add the parameter &sortbyTVType=`integer` to fix it:

      [[!getPage?
             &element=`getResources` 
             &parents=`[[*id]]`
             &tpl=`store-product-list-tpl`
             &includeTVs=`1`
             &processTVs=`1`
             &includeContent=`1`       
             &limit=`10`
             &sortbyTV=`product_price` 
             &sortbyTVType=`integer`
             &sortdirTV=`DESC`      
             &sortby=``
             &toPlaceholder=`productItems`
      ]]


      This may limit also for the entire results and not per page. If not, try to explain deeply your problem smiley.

      Greetings.