We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    This is an auto-generated topic for SiteAtoZ 1.0.3-beta1 by bobray.

    Brief Description:

    Initial Release
      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
      • 2740
      • 95 Posts
      I’m using SiteAtoZ to list peoples names according to their surname which is stored in a TV. So if I have a resource with a pagetitle of ’Fred Smith’ the surname TV would be ’Smith’. So Fred Smith would be listed under S not F.

      Using getResources I get a list based on the surname:

      [[!getResources? &parents=`13` &tpl=`AzItemTpl1` &showHidden=`1` &limit=`1000` &sortbyTV=`surname`]]


      However, when I convert this to the SiteAtoZ snippet:

      [[!SiteAtoZ? &parents=`13` &tpl=`AzItemTpl1` &showHidden=`1` &limit=`1000` &sortbyTV=`surname` &title=`surname` &includeTVs=`1` &processTVs=`1` and &tvPrefix=`surname` ]]


      No resources are returned. Stripping the call to:

      [[!SiteAtoZ? &parents=`13` &tpl=`AzItemTpl1` &showHidden=`1` &limit=`1000` &sortbyTV=`surname`]]


      Produces an A to Z list based on the pagetitle. I’m sure I’m missing something really simple but can’t see what.
        • 3749
        • 24,544 Posts
        You can try adding &tvPrefix=`` or change the name of the TV to tv.surname.

        If that doesn’t work, I think the problem is your &title parameter. It may have to be a resource field (not a TV). SiteAtoZ makes 26 calls to getResources, each getting the resources where the resource field starts with the specified letter. I’m not sure getResources will handle having a TV value in the where clause. The &title parameter is used to create the &where parameter for getResources. If you could make getResources retrieve a single letter’s results with something like this, it would work:

        &where=`surname:LIKE  'A'%'`


        TBH, though, I’m not sure what you want to do is possible. You might try &tvFilters, but I don’t think it will work.

        Maybe someone else will have a better idea.
          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
          • 2740
          • 95 Posts
          Thanks for the reply. Sadly &tvPrefix=`` is one of the many combinations I’ve tried. Sadly I think you are right in that the &where parameter is the conflict.
            • 3749
            • 24,544 Posts
            TVs are tricky because they are not actually in the site_content table (which holds all resources) at all.

            Is there any chance you could use one of the other string resource fields (longtitle, menutitle, description, introtext, etc.) to hold the surname? It should work then.
              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
              • 2740
              • 95 Posts
              That’s not something I’d even considered. I’ve moved the description to a TV and moved the surname to the description. This gets round the problem. Thanks.
                • 2740
                • 95 Posts
                There appears to be a strange behaviour with using SiteAtoZ and multi &tvFilters calls. The following call works fine:

                [[!mySiteAtoZ? &parents=`13` &tpl=`AzItemTpl1` &tvFilters=`product==camera` &showHidden=`1` &limit=`1000` sortby=`description` &headingSeparator=` |` &sortdir=`ASC` &includeTVs=`1` &processTVs =`1`]]


                Simply adding a second filter (&tvFilters=`product==camera||product==mobile`) causes issues. The results for first filter (camera) show up on every single letter result (e.g. Sony will appear 26 times), but the results for the second filter (mobile) show up correctly just once.

                I should point out that there is a bug in getResources at the time of posting that prevents multi &tvFilters from working even in getResources:

                http://modxcms.com/forums/index.php/topic,52572.msg342565.html#msg342565

                I’ve implented Jan’s fix and it works perfectly for getResources but not SiteAtoZ.

                I appreciate I’m trying to get SiteAtoZ to do more than it was every intended to do but thought this might be of interest to anyone else trying to use multi filters.
                  • 3749
                  • 24,544 Posts
                  I can’t explain that. SiteAtoZ simply sends all the parameters on to getResources. It’s possible that the getResources default properties then overwrite those that come in via runSnippet(), but it seems unlikely.

                  Maybe the parameters passed in via runSnippet() are handled differently than those that come in in the $scriptProperties array, but that also seems very unlikely.
                    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