We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23119
    • 9 Posts
    Hey Wim,

    If you got this working gimme a call or e-mail.
    I’m currently searching for a similar solution and am also struggling to get this working.
      • 5699
      • 46 Posts
      computersolutions.cn Reply #182, 16 years, 8 months ago
      Played around with this, this morning, I was implementing something myself, but a premade solution is easier.
      The documentation is incorrect though.

      The readme file example refers to &formTpl=`template_name`, the actual parameter is &formTPL
      This was causing foreach errors in line 735 like a previous poster.

      Interestingly, I did not need to make any changes to Ditto, other than copy the extenders to the ditto folder. Pagination appears to be working fine, as does searching. So, this may not be needed in Ditto 2.1/ Evolution 1.02

      My example below:

      I’m using this to filter a list of Therapists, I have a folder (MODx id=22) with each Therapist.
      We’ve created documents in that folder - one per Therapist, each page has tv’s containing the various data fields.
      The page content in each page is simply a chunk for output that formats the page tv’s.

      I can post those if people are interested.


      Page Call:

      <!-- Create the search code for Ditto, and choose which form to use for the search, ditto output -->
      [!tvExplorer? 
      &dittoName=`Ditto` 
      &dittoSnippetParameters=`tpl:TherapistList|parents:22|display:10|paginate:1|sortDir:asc|sortBy:pagetitle`
      &formTPL=`TherapistSearchForm`
      !]
      
      <!-- Show the search form from the formTPL call above -->
      [+tve.searchForm+]
      
      <hr>
      <br />
      
      <!-- Show the results for the Search -->
      <div class="list"><ul>[+tve.dittoList+]</ul></div>
      
      <!-- Show the pagination code -->
      <p>Showing <strong>[+start+]</strong> - <strong>[+stop+]</strong> of <strong>[+total+]</strong> results | Page <strong>[+currentPage+]</strong> of <strong>[+totalPages+]</strong></p> <div id="ditto_pages"> [+previous+] [+pages+] [+next+] </div> </div>


      Therapist Search Form (unformatted)
      (Basic filtering by different fields - Nationality, Languages, District)

      <form name="search" action="[~[*id*]~]" method="get">
      <input type="hidden" name="id" value="[*id*]" />
      
      
      [+tve.Nationality:label->Select Nationality:tvtype->select:filter->7:blankLabel-> :+]
      <br />
      [+tve.Languages:label->Select Language Spoken:tvtype->select:filter->7:blankLabel-> :+]
      <br />
      [+tve.Location:label->Select Location:tvtype->select:filter->7:blankLabel-> :+]
      
      <br />
      <input type="submit" name="search" value="Search" />
      
      </form>


        • 26931
        • 2,314 Posts
        Hey computersolutions.cn,
        I can post those if people are interested.
        that’s great - thanks!
          • 5950
          • 44 Posts
          I’m so relieved that computersolutions.cn was able to get this work, I was beginning to give up hope.

          I’m using Ditto 2.1, Evo 1.0.2 and tvEditor 0.8.5.2, I am also running PHx 2.1.3

          The form is lovely, everything seems set up properly, but I am getting "No documents found." any time I search (a standard Ditto call works fine, so my parameters seem okay).

          Code on Resource #5 (cacheable OFF):

          [[tvExplorer? &dittoName=`Ditto` &dittoSnippetParameters=`tpl:ProductSearchTpl|parents:5|depth:3|display:all|paginate:1|sortBy:pagetitle|sortDir:asc|hideFolders:1` &formTPL=`tveProductSearch`]]
          
          <!-- Show the search form from the formTPL call above -->
          [+tve.searchForm+]


          Code in Chunk tveProductSearch:

          <strong>Search by your application needs:</strong><br />
          <form method="get" action="[~226~]">
          <input type="hidden" name="id" value="226" />
                      <table border="0" cellspacing="0" cellpadding="0">
          			  <tr>
          				<td colspan="2"> </td>
          			  </tr>
          			  <tr>
          				<td><b>Video:</b></td>
          				<td>[+tve.video-channels:filter->6:label->:tvtype->select:blankLabel->Select+]</td>
          				
          			    </td>
          				</tr>
          				<tr>
          				<td><b>Data:</b></td>
          				<td>
          				[+tve.data-channels:filter->6:label->:tvtype->select:blankLabel->Select+]</td>
          				</tr>
                          <tr>
          				<td><b>Audio:</b></td>
          				<td>
          				[+tve.audio-channels:filter->6:label->:tvtype->select:blankLabel->Select+]</td>
          				</tr>   <tr>
          				<td><b>Contact:</b></td>
          				<td>
          				[+tve.cc-channels:filter->6:label->:tvtype->select:blankLabel->Select+]</td>
          				</tr><tr>
          				<td><b>Ethernet:</b></td>
          				<td>
          				[+tve.ethernet-channels:filter->6:label->:tvtype->select:blankLabel->Select+]</td>
          				</tr>
          <tr>
          				<td> 
          				</td>
          				
          <td><input type="submit" name="search" value="Search" /></td>
          </tr>
          			  </table>
          			  </form>


          Chunk ProductSearchTpl:

          <div class="ProductList">
          <table width="760" cellpadding="4" cellspacing="0" id="ProductList"><tbody>
          <tr>
          <th valign="bottom" align="left" width="100" rowspan="2"><b>Preview</b></th>
          <th valign="bottom" align="left" width="510" rowspan="2"><b>Description</b></th>
          <th valign="bottom" align="left" colspan="5"><b>Signals of:</b></th>
          </tr>
          <tr>
          <th valign="bottom" align="left" width="50"><b>Video</b></th>
          <th valign="bottom" align="left" width="50"><b>Data</b></th>
          <th valign="bottom" align="left" width="50"><b>Audio</b></th>
          <th valign="bottom" align="left" width="50"><b>Contact</b></th>
          <th valign="bottom" align="left" width="50"><b>Ethernet</b></th>
          </tr>
          <tr>
          <td valign="middle" align="left"><img src="../products/[+category_code+]/100_[+product_filename+].jpg" height="50" width="50" alt="[+title+]" style="margin:0px; width: auto; border: 1px solid #5E6A71;" /></td>
          <td valign="middle" align="left"><b>[+longtitle+]</b><br />[+description+]<br /><a href="[+url+]">More Information</a></td>
          <td valign="middle" align="left">[+video-channels+]</td>
          <td valign="middle" align="left">[+data-channels+]</td>
          <td valign="middle" align="left">[+audio-channels+]</td>
          <td valign="middle" align="left">[+cc-channels+]</td>
          <td valign="middle" align="left">[+ethernet-channels+]</td>
          </tr>
          
          </tr></table></div>


          From Resource #226 (cacheable OFF, child of parent #5):

          [[tvExplorer? &dittoName=`Ditto` &dittoSnippetParameters=`tpl:ProductSearchTpl|parents:5|depth:3|display:all|paginate:1|sortBy:menuindex|sortDir:ASC|hideFolders:1` &formTPL=`tveProductSearch`]]
          
          [+tve.dittoList+]


          Preview the form at: http://www.comnet.net/Rework/index.php?id=5

          Thanks for any help anyone can give. I love what I know this module can do, I just can’t seem to get it there. huh
            • 5950
            • 44 Posts
            Ah ha!

            Think I got it guys. Stumbled across a theory when I noticed that ajaxSearch would invalidate my search altogether if I included any terms with less than the minimum characters.

            So I set up a test TV and set the values to the spelled-out numbers (one vs. 1) and now it works!

            Okay. So I can go back and set option values for each integer option (e.g., 1==one||), and hope that doesn’t mess with my PHx stuff that I’ve got going behind the scenes.

            But, as I’d rather, is there any way to set the minChars (going by the AjaxSearch param name) to 1, or would that make Ditto implode?

            Edit: I’d especially like to figure out a way to override the minChars if possible, as I’ve just played a bit and saw I’d have to reset all four values for each of over 125 products on the site. shocked
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I suspect this has something to do with MySQL and the minimum chars it is configured to have for a full-text search.
              # The minimum and maximum lengths of words to be indexed are defined by the ft_min_word_len and ft_max_word_len system variables. (See Section 5.1.4, “Server System Variables”.) The default minimum value is four characters; the default maximum is version dependent. If you change either value, you must rebuild your FULLTEXT indexes. For example, if you want three-character words to be searchable, you can set the ft_min_word_len variable by putting the following lines in an option file:

              [mysqld]
              ft_min_word_len=3

              Then restart the server and rebuild your FULLTEXT indexes. Note particularly the remarks regarding myisamchk in the instructions following this list.

              http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 5950
                • 44 Posts
                Thanks Susan. That’s not really something I want to do on such a large scale.. never mind I’m working on a shared server! wink

                I’ll have to man up and adjust my values one by one, looks like. Even once I’ve done that, I think this still took less time than trying to work through all this on my own.

                Thanks sottwell, computersolutions.cn and especially, of course, heliotrope!
                  • 5950
                  • 44 Posts
                  If anyone ever has to do something similar, here’s what I ended up using to convert my spelled-out numbers to digits.

                  Created a Snippet "phx:digitSwitch":

                  <?php
                  $out = "";
                  if ($output=="zero") {
                      $out = '0';
                  } elseif ($output=="one") {
                      $out = '1';
                  } elseif ($output=="two") {
                      $out = '2';
                  } elseif ($output=="three") {
                      $out = '3';
                  } else{
                      $out = '<font color=red>Check your work!</font>';
                  }
                  return $out;
                  ?>
                  


                  (And so on as high as you need to count).

                  And call it along with my TV in my chunk with:
                  [+ethernet-channels:digitSwitch+]


                  And now back to resetting my variable values!
                    • 19967
                    • 2 Posts
                    hi

                    im hoping one of you can help me,

                    I’m using Ditto 2.1, Evo 1.0.2 and tvEditor 0.8.5.

                    im getting the following error:

                    dittoName is missing. This parameter is mandatory

                    ive got ditto installed, if you have any ideas I would be very grateful

                      • 5950
                      • 44 Posts
                      Quote from: modoos at Apr 07, 2010, 04:59 PM



                      dittoName is missing. This parameter is mandatory



                      you must include the following within your tvexplorer snippet call:

                      &dittoName=`Ditto` 


                      if you’ve got it in there already, double check your syntax and that it matches the name of your Ditto snippet (case sensitive)