We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18397
    • 3,250 Posts
    MARKSVIRTUALDESK Reply #11, 20 years ago
    After speaking with kudo about this I added a similar feature as a config file to the new Ditto 1.1 Beta 1. Just append &config=`request` to experience similar functionality. All parameters in the URL string must be prefixed with ditto_ for the snippet to recognize them. I agree with kudo’s previous post that this type of code really need to be security audited before it is released to the masses so netnoise can you take a look?
      • 6726
      • 7,075 Posts
      Great news Mark, once its audited, I’ll sure have a use for it smiley
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 3002
        • 25 Posts
        Hi. I am trying to get the above dropdown list to work, my requirement is that there are several dropdowns in the form, all of which should be in the filter. My product articles are in article 39.

        My form:
        <p class="upper">Select the desired parameters and let us see what we have.</p>
        
        <form method="get" action="http://example.com/index.php?id=63" class="FSF_form">
        	<fieldset>
        		<strong><label>Range<br />
        		<select title="Range" id="rangefilter" name="filter">
        			<option value="">
        				Show me all
        			</option>
        
        			<option value="tvProductCategory,Outdoor Seating">
        				Outdoor Seating
        			</option>
        
        			<option value="tvProductCategory,Indoor Seating">
        				Indoor Seating
        			</option>
        
        			<option value="tvProductCategory,Bar Stools">
        				Bar Stools
        			</option>
        
        		</select></label></strong><br /><br />
        				
        		<strong><label>Finish<br />
        		<select title="Finish" id="finishfilter" name="filter">
        			<option value="tvTagsFinish,Wood">
        				Wood
        			</option>
        
        			<option value="tvTagsFinish,Wicker">
        				Wicker
        			</option>
        
        			<option value="tvTagsFinish,Metallic">
        				Metallic
        			</option>
        
        			<option value="tvTagsFinish,Plastics">
        				Plastics
        			</option>
        		</select></label></strong><br />				
        				
        			
        			<strong><label>Colour<br />
        			<select title="Colour" id="colourfilter" name="filter">
        				<option value="tvTagsColour,Yellows">
        					Yellows
        				</option>
        
        				<option value="tvTagsColour,Greens">
        					Greens
        				</option>
        
        				<option value="tvTagsColour,Blues">
        					Blues
        				</option>
        
        				<option value="tvTagsColour,Oranges">
        					Oranges
        				</option>
        			</select></label></strong><br />
        
        		<input type="hidden" value="63" name="id" />
        		
        		<input type="hidden" value="ProductCategory,TagsFinish,TagsColour" name="hiddenTVs" />
        
        		<input type="hidden" value="1" name="multiLevel" />
        		
        		<input type="hidden" value="ASC" name="sortDir" />
        		
        		<input type="submit" class="FSF_submit" value=" " />
        	</fieldset>
        </form>
        


        My DittoMachine call in the landing page:
        [!DittoMachine? &startID=`39` &debug=`0` &summarize=`12` &tagMode=`onlyAllTags` &displayArchive=`0` &tpl=`DittoTemplate` &paginate=`1` &emptyText=`No items found.`!]
        


        When I do a search, my URL looks like this:

        http://example.com/index.php?filter=tvProductCategory%2CCoffee+Tables&filter=tvTagsFinish%2CWood&filter=tvTagsColour%2CYellows%2C%3E+12+months&id=63&hiddenTVs=ProductCategory%2CTagsFinish%2CTagsColour&multiLevel=1&sortDir=ASC
        


        DittoMachine just sends back results of products containing at least one of the tags instead of products being filtered by all the tags, even though I had tagMode at onlyAllTags. I can’t find anywhere in the forums how to have several dropdowns with DittoMachine, can anyone help?

        Bobby
          • 16429
          • 254 Posts
          The reply is simply: it can’t work.
          DittoMachine can understand only 1 filter at a time, because it isn’t built to take 2 filters or more and combine them. If you want more than 1 tag to filter by you’ve to directly call the url with a single group of tags, so your url has to be like:
          http://example.com/index.php?filter=tvProductCategory%2CCoffee+Tables%7CtvTagsFinish%2CWood%7CtvTagsColour%2CYellows%2C%3E+12+months&id=63&hiddenTVs=ProductCategory%2CTagsFinish%2CTagsColour&multiLevel=1&sortDir=ASC
          

          ... with only one "&filter=" variable, not more than one.

          Ditto 1.1 (beta at this moment) can do what DittoMachine does straight out of the box, but with the same problem: you’ve to use only 1 "&filter=" variable in the request (Ditto 1.1 allows GET and POST request).

          I’ve planned to play with the Ditto 1.1 request functionality to permit this kind of things, but now I’ve other things to do undecided
            kudo
            www.kudolink.com - webdesign (surprised?)

            [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
            • 18397
            • 3,250 Posts
            Kudo,

            If you accomplish this, I would be happy to integrate it into Ditto 1.1 Final. Email me if you need any assistance.
              • 3002
              • 25 Posts
              My project depends on DittoMachine for a major function of the site, any chance you can point me to where I need to tweak code to accommodate multiple filters by any chance? I’m a designer, but I just need to get this site done, I’ll go in and try tweaking it if you can just point me in the right direction.

              Thanks.

              Bobby
                • 16429
                • 254 Posts
                Well, now or later I need to look at this thing so...
                I’ll release this thing in this week, ok? smiley
                  kudo
                  www.kudolink.com - webdesign (surprised?)

                  [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
                  • 3002
                  • 25 Posts
                  Hi. Any developments with the multiple filters? I can’t quite hack it.
                    • 16429
                    • 254 Posts
                    Yes. I’ve done multifiltering and Mark included it in the new beta release of Ditto, Ditto 1.1 beta 2.

                    To make multi filters use ditto_filter_1, ditto_filter_2 and so on in the request.

                    Enjoy it!
                      kudo
                      www.kudolink.com - webdesign (surprised?)

                      [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
                      • 3002
                      • 25 Posts
                      Thanks, kudolink! I couldn’t get it to work - I am assuming I use Ditto instead of Dittomachine in the landing page? In my search page (where the search form with multiple filters is):
                      
                      <p class="upper">Select the desired parameters and let us see what we have.</p>
                      
                      <form method="get" action="http://example.com/index.php?id=63" class="FSF_form">
                      	<fieldset>
                      		<strong><label>Range<br />
                      		<select title="Range" id="rangefilter" name="ditto_filter_1">
                      			<option value="">
                      				Show me all
                      			</option>
                      
                      			<option value="tvProductCategory,Outdoor Seating">
                      				Outdoor Seating
                      			</option>
                      
                      			<option value="tvProductCategory,Indoor Seating">
                      				Indoor Seating
                      			</option>
                      
                      			<option value="tvProductCategory,Bar Stools">
                      				Bar Stools
                      			</option>
                      
                      			<option value="tvProductCategory,Dining Table Bases">
                      				Dining Table Bases
                      			</option>
                      
                      			<option value="tvProductCategory,Table Tops">
                      				Table Tops
                      			</option>
                      
                      			<option value="tvProductCategory,Lounges/Ottoman/Cubes/Drums">
                      				Lounges/Ottoman/Cubes/Drums
                      			</option>
                      
                      			<option value="tvProductCategory,Coffee Tables">
                      				Coffee Tables
                      			</option>
                      		</select></label></strong><br /><br />
                      				
                      		<strong><label>Finish<br />
                      		<select title="Finish" id="finishfilter" name="ditto_filter_2">
                      			<option value="tvTagsFinish,Wood">
                      				Wood
                      			</option>
                      
                      			<option value="tvTagsFinish,Wicker">
                      				Wicker
                      			</option>
                      
                      			<option value="tvTagsFinish,Metallic">
                      				Metallic
                      			</option>
                      
                      			<option value="tvTagsFinish,Plastics">
                      				Plastics
                      			</option>
                      
                      			<option value="tvTagsFinish,Upholstered/Fabric/Leather/Vinyl">
                      				Upholstered/Fabric/Leather/Vinyl
                      			</option>
                      			
                      			<option value="tvTagsFinish,Powdercoat">
                      				Powdercoat
                      			</option>
                      		</select></label></strong><br />				
                      				
                      			
                      			<strong><label>Colour<br />
                      			<select title="Colour" id="colourfilter" name="ditto_filter_3">
                      				<option value="tvTagsColour,Yellows">
                      					Yellows
                      				</option>
                      
                      				<option value="tvTagsColour,Greens">
                      					Greens
                      				</option>
                      
                      				<option value="tvTagsColour,Blues">
                      					Blues
                      				</option>
                      
                      				<option value="tvTagsColour,Oranges">
                      					Oranges
                      				</option>
                      
                      				<option value="tvTagsColour,Browns">
                      					Browns
                      				</option>
                      
                      				<option value="tvTagsColour,Purples">
                      					Purples
                      				</option>
                      
                      				<option value="tvTagsColour,Reds">
                      					Reds
                      				</option>
                      				
                      
                      			</select></label></strong><br />
                      
                      
                      		<input type="hidden" value="63" name="id" />
                      		
                      		<input type="hidden" value="ProductCategory,TagsFinish,TagsColour" name="hiddenTVs" />
                      
                      		<input type="hidden" value="1" name="multiLevel" />
                      		
                      		<input type="hidden" value="ASC" name="sortDir" />
                      		
                      		<input type="submit" class="FSF_submit" value=" " />
                      	</fieldset>
                      </form>
                      


                      Then in my search landing page,
                      [!Ditto? &startID=`39` &debug=`0` &summarize=`12` &tagMode=`onlyAllTags` &displayArchive=`0` &tpl=`DittoTemplate` &paginate=`1` &emptyText=`No items found.`!]
                      


                      My URL output:
                      http://example.com/index.php?ditto_filter_1=tvProductCategory%2CCoffee+Tables&ditto_filter_2=tvTagsFinish%2CWood&ditto_filter_3=tvTagsColour%2CYellows&multiLevel=1&sortDir=ASC
                      


                      But my output returns all the products, my debug code:
                      SEARCH RESULTS  12-11-2006
                        Next >
                      « Edit content
                      
                      Ditto Version 1.1
                      Debug Info
                      Number of documents supposed to summarized : 12
                      Count in database: 134
                      Sort by : createdon
                      Sort direction: DESC
                      Start at item 0 and stop at 12 out of 134
                      Start IDs: 39
                      SQL WHERE statement:
                      Filter: None
                      Fields:
                      
                      [+tv+]
                        MainImageThumbnail
                      [+custom+]
                        title
                      [+db+]
                        id
                      
                      
                      Document Data for BORIS LOUNGE
                      [+id+] => 213
                      [+type+] => document
                      [+contentType+] => text/html
                      [+pagetitle+] => BORIS LOUNGE
                      [+longtitle+] =>
                      [+description+] =>
                      [+alias+] =>
                      [+published+] => 1
                      [+pub_date+] => 0
                      [+unpub_date+] => 0
                      [+parent+] => 39
                      [+isfolder+] => 0
                      [+introtext+] =>
                      [+content+] =>
                      [+richtext+] => 1
                      [+template+] => 5
                      [+menuindex+] => 151
                      [+searchable+] => 1
                      [+cacheable+] => 1
                      [+createdby+] => 1
                      [+createdon+] => 1162584121
                      [+editedby+] => 1
                      [+editedon+] => 1162927326
                      [+deleted+] => 0
                      [+deletedon+] => 0
                      [+deletedby+] => 0
                      [+publishedon+] => 1
                      [+publishedby+] => 1162584121
                      [+menutitle+] =>
                      [+donthit+] => 0
                      [+haskeywords+] => 0
                      [+hasmetatags+] => 0
                      [+privateweb+] => 0
                      [+privatemgr+] => 0
                      [+content_dispo+] => 0
                      [+hidemenu+] => 0
                      [+tvMainImageThumbnail+] => http://example.com/assets/images/boris_lounge_thumbnail.jpg
                      [+title+] => BORIS LOUNGE
                      tpl => FirstRow => <div class="ditto_summaryPost"> <div class=" ditto_thumbnailHolder transON" onmouseover="this.className='transOFF'" onmouseout="this.className='transON'" > <a href="[~[+id+]~]"><img src="[+tvMainImageThumbnail+]" /></a> </div> <div class="ditto_productlabel"><h3><a href="[~[+id+]~]">[+title+]</a></h3></div> </div>
                      Document Data for PLANET COFFEE TABLE ...
                      


                      Any help?

                      Bobby