On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • 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
    • 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: contact@antontarasov.com
        Web: antontarasov.com