We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5340
    • 1,624 Posts
    Can you please post your code in here; all of it including the way you do the output?

    Thanks
      • 19369
      • 1,098 Posts
      If I understand correctly, I think that there is a Snippet for MODX Evolution that does the same, it’s called Quill, and it’s configurable: http://modx.com/extras/package/quill?version=4d556b85b2b083396d000667.

      I have also modified the snippet to exclude resources and child resources by id: http://www.jertix.org/assets/files/quill.rar
      Here’s a quick example of Quill Usage:

      TV Name:
      slide-link1

      Caption:
      Link

      Input Type:
      Dropdown List Menu

      Input Option Values:
      @EVAL return $modx->runSnippet("Quill",array('parent'=>'0', 'title'=>'pagetitle', 'depth'=>'2','default'=>'Insert SlideLink Here'));


      Save the Tv and add this in the template:
      <a href="[~[*slide-link1*]~]">Slide Link Here</a>

        • 35764
        • 35 Posts
        thank you, again it does work but the link shows the resource id not the page title.
        I want the page title to show and to link to that page.

        TV code (tv name ’crosssell’
        @EVAL return $modx->runSnippet("Quill",array('parent'=>'6', 'title'=>'pagetitle', 'depth'=>'2','default'=>''));
        


        template code
        <a href="[~[*crosssell*]~]">[*crosssell*]</a>


        Thanks again!

        Lisa
          • 19369
          • 1,098 Posts
          You need another snippet to output the pagetitle, Quill will only output the id. Download GetField from MODX Extras: http://modx.com/extras/package/getfield

          After installing GetField, try this:
          <a href="[~[*crosssell*]~]">[[GetField? &docid=`[*crosssell*]` &field=`pagetitle`]]</a>


          If that doesn’t work, try the uncached version:
          <a href="[~[*crosssell*]~]">[!GetField? &docid=`[*crosssell*]` &field=`pagetitle`!]</a>


          You can also use the longtitle, a custom Template Variable or any field you like, GetField is a very powerful snippet.
            • 35764
            • 35 Posts
            Thank you very much! works perfectly - was beginning to tear my hair out smiley

            Lisa
              • 35764
              • 35 Posts
              hello again,

              I thought all was ok but just noticed if I select more than one option in the drop-down the output is just blank, works fine with just one option selected.


              This is the output code.
              <a href="[~[*crosssell*]~]">[[GetField? &docid=`[*crosssell*]` &field=`pagetitle`]]


              again any help appreciated

              Lisa
                • 35764
                • 35 Posts
                sorry just to clarify, I want the user to select multiple value from a list, then output that list with links to the relevant pages.

                Hope that makes sense.

                Thanks

                Lisa
                  • 19369
                  • 1,098 Posts
                  I don’t understand your set up. Do you have multiple template variables for each dropdown menu the user selects in the page? For example:

                  <a href="[~[*link1*]~]">[[GetField? &docid=`[*link1*]` &field=`pagetitle`]]</a>
                  <a href="[~[*link2*]~]">[[GetField? &docid=`[*link2*]` &field=`pagetitle`]]</a>
                  <a href="[~[*link3*]~]">[[GetField? &docid=`[*link3*]` &field=`pagetitle`]]</a>
                  <a href="[~[*link4*]~]">[[GetField? &docid=`[*link4*]` &field=`pagetitle`]]</a>
                    • 35764
                    • 35 Posts
                    ok, perhaps using the drop-down isn’t the best way to get what I want - perhaps someone could suggest an alternative?

                    this is what I’m trying to acheive. I’m building a product catalog for a client. when the client adds a product i want the option to select cross sell items, ideally i wanted to have a list of all the product pages already on the database and then the client can choose which products he wants to cross sell.

                    When the product page is published I would like the cross-sell items to be linked with their particular page.

                    I hope I’ve made that seem clear smiley

                    thanks again for any help.

                    Lisa
                      • 19369
                      • 1,098 Posts
                      If you have a maximum number of related products you can create an arbitrary amount of dropdown template variables, as in the previous example:


                      <a href="[~[*link1*]~]">[[GetField? &docid=`[*link1*]` &field=`pagetitle`]]</a>
                      <a href="[~[*link2*]~]">[[GetField? &docid=`[*link2*]` &field=`pagetitle`]]</a>
                      <a href="[~[*link3*]~]">[[GetField? &docid=`[*link3*]` &field=`pagetitle`]]</a>
                      <a href="[~[*link4*]~]">[[GetField? &docid=`[*link4*]` &field=`pagetitle`]]</a>

                      And then, if the user doesn’t fill all template variables for the related products, you can hide the link with PHx plugin, for example (Note: PHx is not installed by default on MODx Evolution. Download it from the extras section.):

                      [+phx:if=`[*link1*]`:is=`0`:then=``:else=`<a href="[~[*link1*]~]">[[GetField? &docid=`[*link1*]` &field=`pagetitle`]]</a>`+]
                      [+phx:if=`[*link2*]`:is=`0`:then=``:else=`<a href="[~[*link1*]~]">[[GetField? &docid=`[*link2*]` &field=`pagetitle`]]</a>`+]
                      [+phx:if=`[*link3*]`:is=`0`:then=``:else=`<a href="[~[*link1*]~]">[[GetField? &docid=`[*link3*]` &field=`pagetitle`]]</a>`+]
                      [+phx:if=`[*link4*]`:is=`0`:then=``:else=`<a href="[~[*link1*]~]">[[GetField? &docid=`[*link4*]` &field=`pagetitle`]]</a>`+]
                      


                      0 should be set as default value when [*link1*] Template Variable is empty, so that PHx will not output anything in that case.

                      If that doesn’t work, I guess you could make a checkbox template variables list