Subscribe: RSS
  • Hi:

    I’ve imported a site from EVO to REVO and i’m migrating Ditto to GetResources.

    Snippets works fine, but I need to sort by TV from this values: 10, 9.5, 9, 8.5, etc.

    Using DITTO: &orderBy=`numbers DESC` (this paremeters works fine)

    Using GetResources: &sortbyTV=`numbers` &sortdirTV =`DESC` (9.5, 9, 8.5, 10) Number 10 is in the end of the list.

    What should I do? (Sorry for my english)
    Cheers
    • try


      &sortbyTV=`ABS(numbers)`

      OR

      &sortbyTV=`CONVERT(INT,numbers)`

      OR

      &sortbyTV=`numbers+0`


      I haven’t tested any of the above. Hopefully get resources likes the syntax
      Please post back
      • Thanks for the help, but it still doesn’t work.

        I’ve tried even with: &sortdir=`DESC` but doesn’t work either.

        Any other sugestions?

        Thanks.
        • I’m not sure it will help, but make sure you have &includeTVs=`1` and &tvPrefix=`` (and maybe &processTVs=`1`) in the tag.
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/MODx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
          • BobRay:

            Thank for the help, but is doesn’ work. &includeTVs=`1`, &tvPrefix=`tv.` and &processTVs=`1` are included.

            Any other sugestions? It seems that GetResources "see" the number 10 as 1, or "see" numbre 9.5 as 95.

            cheers.
            • recordingclub Reply #6, 1 month ago
              I have this same problem. Has anyone come up with a solution?
              • Try adding this to the getResources tag:

                &sortbyTVType=`decimal`
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/MODx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                • recordingclub Reply #8, 1 month ago
                  Thanks for the quick reply. My issue is sorting products by cost and the numbers are between 10 - 2000. sortbyTVType by decimal or integer doesn't work and lumps a $1000 product between 90 & 298.

                  Quote from: BobRay at Dec 18, 2018, 07:55 PM
                  Try adding this to the getResources tag:

                  &sortbyTVType=`decimal`
                  • I really thought that would do it:

                    case 'decimal':
                         $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS DECIMAL) AS sortTV");
                         break;


                    Does your TV value begin with a dollar sign? That could interfere with the sorting process.
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/MODx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                    • recordingclub Reply #10, 1 month ago
                      Quote from: BobRay at Dec 19, 2018, 03:36 AM
                      I really thought that would do it:

                      case 'decimal':
                           $criteria->select("CAST(IFNULL(tvSort.value, tvDefault.default_text) AS DECIMAL) AS sortTV");
                           break;


                      Does your TV value begin with a dollar sign? That could interfere with the sorting process.

                      No, it does not start with the dollar sign. This snippet did the trick. Thank you! [ed. note: recordingclub last edited this post 1 month ago.]