We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11975
    • 2,542 Posts
    Hi,

    that’s a bit short as explanation

    If you need to filter result before a request is posted, add a filter in your dittoSnippetParameter.
    For your last question,

    the result of the list should not be shown after sending the request, first it should only count how many "objects"/documents are found under the search-form. theres a button wich can be pressed to list the results.

    You’ll have to tweak the code, that’s not the regular behaviour of tvExplorer.
    When a request is posted the result are shown, there is no step between.

    :-)

      Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
      • 9250
      • 6 Posts
      Quote from: heliotrope at Mar 14, 2008, 03:32 AM

      Hi,

      that’s a bit short as explanation

      If you need to filter result before a request is posted, add a filter in your dittoSnippetParameter.
      for sure, i’ve already done that wink

      Quote from: heliotrope at Mar 14, 2008, 03:32 AM

      You’ll have to tweak the code, that’s not the regular behaviour of tvExplorer.
      When a request is posted the result are shown, there is no step between.

      okay that means i’ve to learn kung-fu now, right? laugh thanks for your help, i will return next hours and days, to get more informations about learning kung-fu wink

        • 11975
        • 2,542 Posts
        You could do what you want to achieve without hacking the code but that wouldn’t be optimal.
        After the first request,you could get the params form the url and build a link to another document in which the form is not shown.

        :-)
          Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
          • 24731 ☆ A M B ☆
          • 211 Posts
          Hello, I had some issues when I configured latest version of Ditto with the suggested changes on page 4. I kept getting these errors:

          « MODx Parse Error »
          MODx encountered the following error while attempting to parse the requested resource:
          « PHP Parse Error »
           
          PHP error debug
            Error: 	array_walk(): Unable to call ditto::applyHsc() - function does not exist	 
            Error type/ Nr.: 	Warning - 2	 
            File: 	****/cms/assets/snippets/ditto/classes/ditto.class.inc.php	 
            Line: 	1037	 
            Line 1037 source: 	$keyvalue = (is_array($value)) ? array_walk($value,"ditto::applyHsc") : htmlspecialchars($value, ENT_QUOTES); 	 


          So I commented this line:

          //               $keyvalue = (is_array($value)) ? array_walk($value,"ditto::applyHsc") : htmlspecialchars($value, ENT_QUOTES);


          and it all worked beautifully. Until I noticed that my pagination stopped working.

          Then I uncommented the line and pagination works again across the site, but the tvexplorer snippet doesn’t work. I keep getting:

          « MODx Parse Error »
          MODx encountered the following error while attempting to parse the requested resource:
          « PHP Parse Error »
           
          PHP error debug
            Error: 	array_walk(): Unable to call ditto::applyHsc() - function does not exist	 
            Error type/ Nr.: 	Warning - 2	 
            File: 	****/cms/assets/snippets/ditto/classes/ditto.class.inc.php	 
            Line: 	1037	 
            Line 1037 source: 	$keyvalue = (is_array($value)) ? array_walk($value,"ditto::applyHsc") : htmlspecialchars($value, ENT_QUOTES); 	 


          Any ideas?

             function applyHsc($var){
                $var = htmlspecialchars($var, ENT_QUOTES);
          
             }
          	
          	function buildURL($args,$id=false,$dittoIdentifier=false) {
          		global $modx, $dittoID;
          			$dittoID = ($dittoIdentifier !== false) ? $dittoIdentifier : $dittoID;
          			$query = array();
          			foreach ($_GET as $param=>$value) {
          				if ($param != 'id' && $param != 'q') {
          //					$query[htmlspecialchars($param, ENT_QUOTES)] = htmlspecialchars($value, ENT_QUOTES);
                         $keyparam =htmlspecialchars($param, ENT_QUOTES);
                         $keyvalue = (is_array($value)) ? array_walk($value,"ditto::applyHsc") : htmlspecialchars($value, ENT_QUOTES);
                         $query[$keyparam] = $keyvalue;
          				}
          			}
          			if (!is_array($args)) {
          				$args = explode("&",$args);
          				foreach ($args as $arg) {
          					$arg = explode("=",$arg);
          					$query[$dittoID.$arg[0]] = urlencode(trim($arg[1]));
          				}
          			} else {
          				foreach ($args as $name=>$value) {
          					$query[$dittoID.$name] = urlencode(trim($value));
          				}
          			}
          			$queryString = "";
          			foreach ($query as $param=>$value) {
          				$queryString .= '&'.$param.'='.(is_array($value) ? implode(",",$value) : $value);
          			}
          			$cID = ($id !== false) ? $id : $modx->documentObject['id'];
          			//$url = $modx->makeURL(trim($cID), '', $queryString);
                   $url = (isset($modx->documentObject['id'])) ? $modx->makeURL(trim($cID), '', $queryString) : 'index.php?id='.$GLOBALS['modID'].$queryString;
          			return ($modx->config['xhtml_urls']) ? $url : str_replace("&","&",$url);
          	}


          Maybe the applyHsc function goes somewhere else?

          I appreciate the help.

          Jose R. Lopez
            • 11975
            • 2,542 Posts
            Hi,

            you need to apply the same patch in the debug/modxdebugclass ..
            the buildUrl function exists in two files.

            :-)
              Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
              • 24731 ☆ A M B ☆
              • 211 Posts
              Quote from: heliotrope at Mar 26, 2008, 03:15 AM

              Hi,

              you need to apply the same patch in the debug/modxdebugclass ..
              the buildUrl function exists in two files.

              :-)

              Hey hellotrope, thanks for your prompt reply. I tried patching the debug fie as suggested without luck, I still get the same results.

              I was able to get it working by removing the function from the line, like this:

              $keyvalue = (is_array($value)) ? $value : htmlspecialchars($value, ENT_QUOTES);

              Only on the ditto class file, and it works, I am not sure exactly what the function is for, but for some reason it says the function does not exists.

              Is it safe using it like this? I have no other way of making it work so far.

              Thanks.

              Jose R. Lopez
                • 4966
                • 143 Posts
                I was searching for a search box when I stumbled upon your solution. Question, when I look at this site

                http://www.deco-in.com/recherche-avancee

                Is it possible for a user to select Styles, Colors, Material, Pieces, and Cadeaux and then Search? I need for a user to select a state, type of appraisal, and type of item.

                thanks,

                btw, nice website.
                  • 33372
                  • 1,611 Posts
                  Sure. You can create a form that allows people to select any number of TV values and then search.
                    "Things are not what they appear to be; nor are they otherwise." - Buddha

                    "Well, gee, Buddha - that wasn't very helpful..." - ZAP

                    Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                    • 8960
                    • 150 Posts
                    Quote from: charlie-imac at Mar 28, 2008, 12:26 PM

                    Is it possible for a user to select Styles, Colors, Material, Pieces, and Cadeaux and then Search? I need for a user to select a state, type of appraisal, and type of item.

                    I’m looking for the same thing, too. I know it *can* be done... the example website show this. What I’d like to know is how to actually do it?

                    I’ve installed tvExplorer in the Manager and it pulls up my TVs, but what I need help figuring out (and I think that’s what it being asked by others here), is what do I need to construct to get this to work on the front end, so this same type of search (as seen in the example website in French) is ready-to-go for the visitor?

                    Thanks (in advance)!
                      • 11975
                      • 2,542 Posts
                      Hi,

                      you’ll find a detailed explanation about deco-in search form in this french thread :
                      http://modxcms.com/forums/index.php/topic,15272.msg99155.html#msg99155

                      There are sample calls in this thread as well.

                      The minimum requirement to create a front-end form are:

                      A tvexplorer call with 3 variables
                      1/ &formTPL => name of the chunk contaning form html and tvexplorer tags.
                      2/ &dittoName=> the ditto snippet name to use
                      3/ &dittoSnippetParameters => a parameters list for ditto snippet written as follw

                      &dittoSnippetParameters=`param:value|param:value`

                      &dittoSnippetParameters=`display:10|tpl:mychunk|paginate:1`


                      About &formTPL
                      This where you write specific tags to insert tv in your form
                      Here is a sample tag:
                      [+tve.MyTvName:label->Select a value:tvtype->select:filter->7+]

                      This tag will output

                      <label>Select a value</label>
                      <select name="MyTvName">
                      <option value="tv option value1">tv option value1
                      ...
                      </select>

                      Hope that helps

                      :-)
                        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l