ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Search: Parameter not working.

January 17, 2012 3:06pm

Subscribe [2]
  • #1 / Jan 17, 2012 3:06pm

    Ryan Faubion

    81 posts

    This question may be related to a resolved thread.

    Hello all, I’m loosing my mind with this one, I’m hoping you all can assist…

    My issue is almost exactly like that above BUT my seach:(custom_field) is returning zero results. I’ve broken my search down to one select criteria: Location. Here’s the code:

    <form method="post" action="{path='search_results/'}">
    <fieldset>
        <div id="rentals" class="tabdiv">
                    
        <label><strong>LOCATION:</strong> </label>
            <select class="medium" name="search:location">
         <option value="Any Location">Any Location</option>
         <option value="Downtown">Downtown</option>
         <option value="Campus">Campus</option>
         <option value="East">East</option>
         <option value="Ellettsville">Ellettsville</option>
                <option value="North">North</option>
                <option value="South">South</option>
         <option value="West">West</option> 
            </select>
              
            <div class="search_container">
                <input type="submit" value="Go!" /></a>
            </div>
        </div>
    </fieldset>
    </form>

    Which be seen and tested here in the sidebar: http://test.hallmarkrentals.com

    Upon selecting a location, say East and pressing ‘Go’ you should get 2 results on the Search Results page. Instead I’m getting all entries related to channel rental_properties. Here’s the Search Results page code:

    {exp:channel:entries channel="rental_properties" dynamic_parameters="search:location"}
    <div class="search_result">
        {property_images}
        {image}
        {/property_images}
        {top_features}
        <div class="property_data">
         <span class="{property_availability}">{property_availability:label}</span>
         {title}
         <strong>Location:</strong> {location}
         <strong>Property Type:</strong> {property_type}
         <strong>Bedrooms: </strong> {bedrooms}
         <strong>Bathrooms:</strong> {bathrooms} 
         <strong>Monthly Rent:</strong> {rent}
        </div>
        {/top_features}
        <div class="search_linkcol">
         <a href="http://{url_title_path=%27residential/view%27}" title="{title}">Visit Property Page</a>
         <a href="http://maps.google.com/maps?q={title}," title="Map">Get Directions</a>
         <a href="http://{site_url}contact_us" title="Contact Us">Contact Us</a>
        </div>
    </div>
    {/exp:channel:entries}

    Which can be seen here: http://test.hallmarkrentals.com/search_results

    - -

    Any idea what I’m missing or doing incorrectly?

    Eventually I want filter through several results, and post the number of results returned.

    Thanks!
    Ryan

  • #2 / Jan 17, 2012 4:22pm

    glenndavisgroup

    436 posts

    Hi Ryan,

    Did you check the name of your custom channel field to make sure the short name for it is called “location”?

    Mike

  • #3 / Jan 17, 2012 4:53pm

    Ryan Faubion

    81 posts

    Hi Ryan,

    Did you check the name of your custom channel field to make sure the short name for it is called “location”?

    Mike

    Hi Mike,

    Thanks for getting back. Yeah, the custom field is ‘location’. I’m using Matrix, should that matter?

  • #4 / Jan 17, 2012 5:39pm

    glenndavisgroup

    436 posts

    Honestly I haven’t tried this method of searching before. Can you try searching a standard text custom channel field and not a matrix field to see if that works? If that works then you might be looking at a possible matrix bug since you are having the issue with a third party add-on. It would be a good idea to also post on the Pixel and Tonic support forum and ask them for help to see if they can point you in the right direction. I hope that helps.

    Mike

  • #5 / Jan 18, 2012 4:37pm

    Ryan Faubion

    81 posts

    I posted a thread in P&T’s support forum, but is there no more help that can had here in the EE support forums? No one…

  • #6 / Jan 19, 2012 2:22pm

    Dan Decker

    7338 posts

    Hello Ryan,

    Sorry to hear you are having some trouble getting the search feature to work the way you desire.

    I was able to get this working using only first-party field types and your syntax. Is {location} a Matrix field itself?

    Cheers!

  • #7 / Jan 20, 2012 3:20am

    Ryan Faubion

    81 posts

    Dan,

    Yes, {location] a Matrix Field itself. Here's a screencap, this will help you see: http://cl.ly/200P0Q2f1d1M3r2u0n3H

    The hierarchy is channel: rental_properties, custom channel field: Properties, within Properties i have several label for vary needs: Images, Top Level Features, Amenities, Utilities, Featured Property, Availability, and Related Properties.

    I am searching for location, price-range, bedrooms, and bathrooms only, and wanting them filtered.

    - - -

    That’s awesome you got it to work with the built-in tools. Does EE have a built-in dropdown selector? I’d prefer to stay with my current setup but at this point I have to go with function.

     

  • #8 / Jan 20, 2012 4:14am

    Ryan Faubion

    81 posts

    Well, I’m making small progress it seems. Between the questions above, and P&T’s questions I see that I was searching for {location} with was a column within Matrix, instead of the field name ‘tpp_features’. So now my code looks like this:

    <form method="post" action="{path='search_results/'}">
    <fieldset>
        <div id="rentals" class="tabdiv">
                    
          <label><strong>LOCATION:</strong></label>
          <select class="medium" name="search:top_features">
            <option value="Any Location">Any Location</option>
            <option value="Downtown">Downtown</option>
            <option value="Campus">Campus</option>
            <option value="East">East</option>
           <option value="Ellettsville">Ellettsville</option>
              <option value="North">North</option>
           <option value="South">South</option>
           <option value="West">West</option> 
          </select>
           <div class="search_container">
                <input type="submit" value="Go!" /></a>
            </div>
        </div>
    </fieldset>
    </form>

    and on the results page…

    {exp:channel:entries channel="rental_properties" dynamic_parameters="search:top_features"}
         <div class="search_result">
          {property_images}
          {image}
          {/property_images}
          {top_features}
          <div class="property_data">
           <span class="{property_availability}">{property_availability:label}</span>
           {title}
           <strong>Location:</strong> {location}
           <strong>Property Type:</strong> {property_type}
           <strong>Bedrooms: </strong> {bedrooms}
           <strong>Bathrooms:</strong> {bathrooms} 
           <strong>Monthly Rent:</strong> {rent}
          </div>
          {/top_features}
          <div class="search_linkcol">
           <a href="http://{url_title_path=%27residential/view%27}" title="{title}">Visit Property Page</a>
           <a href="http://maps.google.com/maps?q={title}," title="Map">Get Directions</a>
           <a href="http://{site_url}contact_us" title="Contact Us">Contact Us</a>
          </div>
         </div>
         {/exp:channel:entries}

    Good news is now I’m returning results for ‘Location’. So when I search for location ‘East’ I get two results which is accurate. WOOHOO! Now the bad news, I add the other needed fields, bathrooms, bathrooms, and rent and I get nothing. Grrrr.

    Ideas?

  • #9 / Jan 26, 2012 7:38pm

    Dan Decker

    7338 posts

    Hey Ryan,

    I’m glad to see you are finding some success!

    Now the bad news, I add the other needed fields, bathrooms, bathrooms, and rent and I get nothing.

    I’m not entirely clear what you mean here. Where are you trying to add the other fields? The search parameter can only use one field at a time. Can you clarify your issue here?

    Thanks!

  • #10 / Jan 26, 2012 8:42pm

    Ryan Faubion

    81 posts

    Hey Dan,

    Thanks for the response. I haven’t made any progress so hopefully you can assist me here. I’ll try to be more clear.

    The concept is that a visitor can make several selections based off custom fields in a channel, then click search, and have the results appear on a template.

    Example:

    Location
    -North
    -South
    -East
    -West

    Bedrooms
    -1
    -2
    -3

    Bathrooms
    -1
    -2
    -3

    SEARCH

    - -

    Then print those results on my template I’ve created. Can EE do this? And if so, can you point me in the right direction.

    Thanks!

     

  • #11 / Jan 27, 2012 9:30am

    glenndavisgroup

    436 posts

    Hi Ryan,

    Can you post your entire code as you have it right now please? Include your form code and search code.

    Thank you,

    Mike

  • #12 / Jan 28, 2012 5:35pm

    Ryan Faubion

    81 posts

    Here’s the current sidebar code, on the home page - which has been my test search (http://test.hallmarkrentals.com/):

    <form method="post" action="{path='search_results/'}">
          <fieldset>
              <div id="rentals" class="tabdiv">
                          
                <label><strong>LOCATION:</strong></label>
                <select class="medium" name="search:top_features">
                  <option value="Any Location">Any Location</option>
                  <option value="Downtown">Downtown</option>
                  <option value="Campus">Campus</option>
                  <option value="East">East</option>
                 <option value="Ellettsville">Ellettsville</option>
                    <option value="North">North</option>
                 <option value="South">South</option>
                 <option value="West">West</option> 
                </select>
                  
                  <div class="select_container right">
               <label><strong>BEDROOM:</strong></label>
               <select class="small_right" name="search:top_features">
                   <option value="Any">Any Number</option>
                   <option value="Studio">Studio</option>
                   <option value="1">1</option>
                   <option value="2">2</option>
                   <option value="2.5">2.5</option>
                   <option value="3">3</option>
                   <option value="3.5">3.5</option>
                   <option value="4">4</option>
                   <option value="5">5</option>
                   <option value="6">6</option>
                   <option value="7">7</option>
                   <option value="8">8</option>
               </select>
               </div>
               
               <div class="select_container">
               <label><strong>BATHROOMS:</strong></label>
               <select class="small_right" name="search:top_features">
                   <option value="Any">Any Number</option>
                   <option value="1">1</option>
                   <option value="1.5">1.5</option>
                   <option value="2">2</option>
                   <option value="2.5">2.5</option>
                   <option value="3">3</option>
                   <option value="3.5">3.5</option>
                   <option value="4">4</option>                  
               </select>
               </div>   
               
                               
                  <div class="search_container">
                      <input type="submit" value="Go!" /></a>
                  </div>
              </div>
              
              
          </fieldset>
          </form>
  • #13 / Jan 31, 2012 4:52pm

    Dan Decker

    7338 posts

    Hey Ryan,

    I’m afraid that’s not the way the search parameter is intended to work. You can’t pass it multiple values at this time. You can make a Feature Request for that. Also, the included search module can’t give you what you are looking for either, however, Solspace’s Super Search can offer you exactly what you are looking for. It also allows your users the ability to bookmark searches so they can come back to them later.

    Cheers!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases