We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36426
    • 197 Posts
    jonahnaylor Reply #1, 6 years ago
    Hi I've set up a basic ecommerce shop with modx and used getResources to show different containers of resources for products.

    Each resource or product has a template variable with a price entered.

    I'm looking for a way to filter these in a very simple way so that getResources shows all resources within a container that are priced under £100, between £100 - £200 and then a third option for over £200.

    Could anyone help me set up those 3 options ( I realise I may need 3 getResources calls, 1 for each or something like that ) and then it could use the filtering on the tvs to display the results.

    I hope this is possible and reasonably straightforward. Thanks for any feedback or guidance on this! smiley
      Yorkshire UK based hosting provider: https://www.simulant.uk
      • 44064
      • 185 Posts
      Anton Tarasov Reply #2, 6 years ago
      Hi jonahnaylor,

      Could you please try something like that (let's say your TV name is Price):

      [[getResources?
      ...
      &tvPrefix=``
      &sortbyTV=`Price`
      &sortdirTV=`DESC`
      &limit=`1000`
      &sortbyTVType=`integer` // if Price is integer, othervise decimal will be helpful
      &tvFilters=`Price<<100`
      &includeTVs=`Price`
      ...
      ]]
      


      [[getResources?
      ...
      &tvPrefix=``
      &sortbyTV=`Price`
      &sortdirTV=`DESC`
      &limit=`1000`
      &sortbyTVType=`integer` // if Price is integer, othervise decimal will be helpful
      &tvFilters=`Price>=100,Price<=200`
      &includeTVs=`Price`
      ...
      ]]


      [[getResources?
      ...
      &tvPrefix=``
      &sortbyTV=`Price`
      &sortdirTV=`DESC`
      &limit=`1000`
      &sortbyTVType=`integer` // if Price is integer, othervise decimal will be helpful
      &tvFilters=`Price>>200`
      &includeTVs=`Price`
      ...
      ]]

        Anton Tarasov
        MODX Developer

        Email: [email protected]
        Web: antontarasov.com