I'm trying to use search parameter on FF Matrix. My code's like this:
{exp:weblog:entries weblog="lettings" limit="3" paginate="top" disable="categories|member_data|trackbacks" dynamic="off" search:house_beds="" search:house_address_street="" search:house_price_band="" dynamic_parameters="search:house_beds|search:house_address_street|search:house_price_band"}
The FF Matrix field is the "house_address_street" one.
I'm trying to figure out a way of pulling out the data from the matrix.
I'm using the dynamic parameters with a form to filter down entries. I know I can probably fix somethin up with php, but if there's a way to do it with just ee, I wanna find out!
Help get this topic noticed by sharing it on
Twitter,
Facebook, or email.
Twitter,
Facebook, or email.
-
FF Matrix fields are serialized before being entered into the database, so accessing them with search: tags isn't entirely reliable, but it does generally work.
I would try hardcoding your search: params before dealing with dynamic parameters, to see if you can get it working that way.
But once you do get it working, keep in mind you need to remove the hardcoded parameters if you're going to use dynamic_parameters. Right now I think you're just overwriting whatever the dynamic_parameters would have brought in. -
-
hmm, I'll look into it. Cheers Brandon! Thanks for getting back so quickly :)
-
-
Brandon, I think you're right about me overwriting the variables. It seems to work after my initial tests. Thanks again :D
-
-
Hey Brandon,
I'm trying to do something similar, but it's not working. I'm using a Matrix tag pair that looks like this:
{companies search:state="WA"}
- {name}
- {address}
- {city}
- {state}
- {zip}
- {phone}
{/companies}
That works fine, but I can't figure out how to use dynamic parameters for this search. Hard-coding search:state="WA" into the channel:entries tag doesn't work, nor does search:companies="WA"
Is it possible to pass a search parameter into this Matrix field with dynamic parameters? If so, how do I do it?
I'm running MSM, EE2.0.2
Thanks,
Sean -
-
Hi Sean,
Using dynamic parameters with Matrix is the same as using them with {exp:weblog:entries}. You'd do something like this:
{companies dynamic_parameters="search:state"}
And then send a post variable named "search:state" set to the value you want to search for. -
-
Thanks, Brandon. That works. Not sure how I missed that solution in the first place.
-
-
I just posted this over at EE forums, thought I'd try over here as my custom fields that i'm searching for are in Matrix...
[b]This question may be related to a [url=http://expressionengine.com/forums/vi... thread[/url].[/b]
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:
[code]
<form method="post" action="{path='search_results/'}">
< fieldset >
< div id="rentals" class="tabdiv" >
< label >< strong>LOCATION:
< select class="medium" name="search:location">
< option value="Any Location" >Any Location
< option value="Downtown" >Downtown
< option value="Campus" >Campus
< option value="East" >East
< option value="Ellettsville" >Ellettsville
< option value="North" >North
< option value="South" >South
< option value="West" >West
</ select>
< div class="search_container" >
<input type="submit" value="Go!" /></a>
</ div>
</ div>
</ fieldset >
</form>
[/code]
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:
[code]
{exp:channel:entries channel="rental_properties" dynamic_parameters="search:location"}
< div class="search_result" >
{property_images}
< img src="{image}" alt="{title}" width="270" height="180" />
{/property_images}
{top_features}
< div class="property_data">
< span class="{property_availability}">{property_availability:label}
< p class="address red">{title}
< p>< strong>Location: {location}
< p>< strong>Property Type: {property_type}
< p>< strong>Bedrooms: {bedrooms}
< p>< strong>Bathrooms: {bathrooms}
< p>< strong>Monthly Rent: {rent}
</ div>
{/top_features}
< div class="search_linkcol">
< p>< a href="{url_title_path='residential/view'}" title="{title}">Visit Property Page
< p>< a href="http://maps.google.com/maps?q={title}, Bloomington, In." title="Map">Get Directions
< p>< a href="{site_url}contact_us" title="Contact Us">Contact Us
</ div>
</ div>
{/exp:channel:entries}
[/code]
Which can be seen here: http://test.hallmarkrentals.com/searc...
- -
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 -
-
Hi Ryan,
Is "location" the name of your Matrix field, or the column within your Matrix field? You should be searching for your actual Matrix field name, not the column.
Go to your Matrix field’s settings, and make sure that the column you’re trying to search for is set to Searchable. If it isn't, or if it wasn't until recently, you need to go through and re-save all of your entries in that channel so that Matrix has a chance to recreate each fields' keywords, factoring in that Location is now searchable. -
-
Thanks Brandon, I was in fact search for the column name. I have changed it to the field name and have gotten improved results but it only seems to be working for 'location'. I need it to filter through location, bathrooms, bedrooms, and rent, and then spit those results out on http://test.hallmarkrentals.com/searc...
It definitely seems like I'm on the right track but can't figure out why multiple search is giving me back nothing. Here's the url: http://test.hallmarkrentals.com/
Here's the new code: Search http://pastie.org/3218010
Results page: http://pastie.org/3218015
- -
I feel like I'm sooo close! -
-
And each of those are different columns in your Matrix field?
At this point, your best bet is probably to write some PHP that queries the exp_matrix_data table directly, and passes some matching entry IDs back to {exp:channel:entries}. Channel Entries’ search:field_name tag is really not meant for anything but very basic searches. -
Loading Profile...



EMPLOYEE


