We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22797
    • 134 Posts
    I was initially pretty excited to see the following item in the change log for the latest release of MODx:

    "Changing TVs no longer looses the sort order on templates to which they’re assigned (see http://modxcms.com/forums/index.php/topic,16090.msg146881.html#msg146881) (3622)"

    But after some experimentation on two different installations on two different computers, the issue doesn’t seem to be resolved at all. Whenever I save a template variable, the "rank" field in the "site_tmplvar_templates" table reverts to 0 for every entry related to that template variable. It wipes them all out.
      • 22797
      • 134 Posts
      It looks like the solution is pretty simple, because most of the solution is already in place, just not the final part. In the file save.tmplvars.processor.php on line 189 in the saveTemplateAccess() function, here’s what can be done:

      Old code (line 189):
      mysql_query("INSERT INTO $tbl (tmplvarid,templateid) VALUES($id,".$templates[$i].");");

      New code (line 189)
      mysql_query("INSERT INTO $tbl (tmplvarid,templateid,rank) VALUES($id,".$templates[$i].",$setRank);");

      • Thanks Paul ... moved to the topic and will make it in for 0963.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • Committed fix as SVN rev #4116. Thanks Paul!
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com