We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19872
    • 1,078 Posts
    Ok.

    I just tried &sortby instead of &sortbyTV, but still the items are not in any logical order.
      • 19872
      • 1,078 Posts
      Quote from: BobRay at Feb 27, 2015, 04:14 AM
      You might try adding &sortdirTV=`DESC`

      This didn't fix it and still getting the error. I'm going back now to double check my TV. Oddly now, after changing the input to Number, the TV does not appear in my resource manager. It has simply vanished?
        • 19872
        • 1,078 Posts
        Now, after changing the input back to Text, the TV is once again visible in the manager.

        The sort should be able to work with Text though. Doesn't php have a method of how it sorts numbers and alpha.

        The entries are numbers and commas (3,250,000 2,750,000 and so on.)
          • 19872
          • 1,078 Posts
          Now, after changing the input back to Text, the TV is once again visible in the manager.

          The sort should be able to work with Text though. Doesn't php have a method of how it sorts numbers and alpha.

          The entries are numbers and commas (3,250,000 2,750,000 and so on.)
            • 19872
            • 1,078 Posts
            Oh I see. The TV doesn't disappear, but "Numbers" does not allow for a comma. Not good. Need the commas. I've switched back to Text as the Input type.
              • 19872
              • 1,078 Posts
              Oh I see. The TV doesn't disappear, but "Numbers" does not allow for a comma. Not good. Need the commas. I've switched back to Text as the Input type.
                • 19872
                • 1,078 Posts
                I don't know what's up with it.

                I now have
                 [[!pdoResources?
                    &parents=`[[*id]]`
                    &tpl=`propsFeatured-docs-thumb-tpl`
                    &limit=`100`
                    &includeTVs=`propPrice,propNeighborhood,propTitle,propImage_main`
                    &processTVs=`1`
                    &TVprefix=``
                    &depth=`1`
                    &showHidden=`1`
                    &sortby=`propPrice`
                    &sortdirTV=`ASC`
                    ]]


                The items successfully list from Highest Price to Lowest Price.
                Numbers — though logical for the input – does not work in this scenario.

                ASC — ascending to me means "going up", as in lowest to highest, a through z. pdoResources appears to be dyslexic.

                Oddly — there is now no error.
                  • 19872
                  • 1,078 Posts
                  OK. This works better:

                  [[!pdoResources?
                  &parents=`[[*id]]`
                  &tpl=`propsFeatured-docs-thumb-tpl`
                  &limit=`100`
                  &includeTVs=`propPrice,propNeighborhood,propTitle,propImage_main`
                  &processTVs=`1`
                  &TVprefix=``
                  &depth=`1`
                  &showHidden=`1`
                  &sortbyTV=`propPrice`
                  &sortdirTV=`DESC`
                  ]]

                  Added TV to both
                  &sortby
                  &sortdir

                  To:
                  &sortbyTV=`propPrice`
                  &sortdirTV=`DESC`

                  Now DESC works, listing items highest price to lowest price.

                  However, the pesky errors it back
                  (ERROR @ .../core/components/pdotools/model/pdotools/pdofetch.class.php : 408) PHP warning: array_key_exists() expects parameter 2 to be array, null given

                  I'm exhausted. pdoTools needs more specific documentation maybe. I might just switch back to getResources.

                    • 19872
                    • 1,078 Posts
                    Quote from: BobRay at Feb 27, 2015, 03:53 AM
                    This looks like a bug to me, but the code is very complex and it's difficult to be sure.

                    Here's line 408 of that file:

                    if (!empty($this->config['sortbyTV']) && !array_key_exists($this->config['sortbyTV'], $tmp['sortby'])) {


                    The error is saying that $tmp['sortby'] is not an array.

                    I'm guessing here, but I would try changing it to this:

                    if (!empty($this->config['sortbyTV']) && !array_key_exists($this->config['sortbyTV'], $tmp)) {


                    I think that will eliminate the error. I'm not sure it will give you the correct results, but it looks to me like that's what was intended.




                    OK, after all that — I made this change, the sorting seems to be working great, but moreso — no error in the log.

                    Thanks Bob.
                      • 3749
                      • 24,544 Posts
                      I'm glad it worked for you. smiley
                        Did I help you? Buy me a beer
                        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