We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    Ever since I have started using TVs I have been wondering how the TVs were "ordered" when you edit a document. It seemed to me it was set in the order you created them. If you have enough TVs, you’ll notice that’s not exatcly the case. When you have lots of TVs, editing a document can become a bit confusing, things are scrambled...

    I have dived into manager/actions/dynamic/mutate_content.dynamic.action.php and looked at the code to see how things were really going on.
    I think I found the code between Line 956 to 1021, at line 977

    $sql.= "WHERE tvtpl.templateid = ".$template." AND (1='".$_SESSION['mgrRole']."' OR ISNULL(tva.documentgroup)".((!$docgrp)? "":" OR tva.documentgroup IN ($docgrp)").") ORDER BY tv.rank;";


    Correct me if I am wrong, but it would seem TVs are ordered by rank... now I never noticed the rank field, but it’s there alright in the modx_site_tmplvars table.
    Now the funny thing is, it has a default value of 0 and, more surprising, it’s not auto-incremented... how can it help sort TVs then ?
    Well it does not.

    Check your TVs and you’ll see that they all have a "0" value...
    Am I wrong in my assumption (remember I don’t read php code fluently tongue -> I could be dead wrong here) ?

    If not, would editing my TVs and assign rank according to the order I want to set work ? (I’d rather ask before breaking anything...)
    Also, wouldn’t it be more logical to set the rank field to auto-increment at install ? It seems like this field was planned to be used but never really used : any particular reason ?

    Thanks !



      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 6726
      • 7,075 Posts
      I started editing rank values, and it seems my theory was indeed right !
      You can sort TVs in the manager, which is great news...

      I noticed that editedon and editedby fields where null... also fields which will be used later (like, for revisionning ?)
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 6726
        • 7,075 Posts
        I just added a Feature Request to FlySpray :
        http://modxcms.com/bugs/task/444
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l'outil id
          • 34017
          • 898 Posts
          David,

          How did you edit the ranking for your different TV’s?

          Thanks,
          Chuck
            Chuck the Trukk
            ProWebscape.com :: Nashville-WebDesign.com
            - - - - - - - -
            What are TV's? Here's some info below.
            http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
            http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
            • 6726
            • 7,075 Posts
            Via phpMyAdmin, I went in the modx_site_tmplvars table, edited the rank field as described above.

            Not necessary anymore : Heliotrope has offered a quick and dirty hack, rewriting the Ajax Menu Editor’s code. Check this thread :
            http://modxcms.com/forums/index.php/topic,5389.0.html

            ;D

            The code needs cleaning, but it’s working great you can re-order your TVs with the drag and drop interface laugh
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l'outil id