Closed johnj24 closed 10 years ago
Can you go into your database, in the exp_dynamo table, find the search that isn’t returning any results and post the value here from the parameters
column of that table row? I’m not sure why it would fail when you only search one of those select dropdowns.
When searching only the New category, this is the parameter: YToxOntzOjg6ImNhdGVnb3J5IjtzOjE2OiIxJkNob29zZSBZb3VyIFJWIjt9
var_dump(unserialize(base64_decode('YToxOntzOjg6ImNhdGVnb3J5IjtzOjE2OiIxJkNob29zZSBZb3VyIFJWIjt9')));
yields
array(1) {
'category' =>
string(16) "1&Choose Your RV"
}
I think you’ll have to try this to keep the option's text from getting passed as the value.
<option value="">Choose Your Style</option>
That was it! I skipped right over the missing value attribute. Thanks Rob.
Side question: When I use the query string to send users to a specific search result, is there any way to put the search keywords on the page? Example: Search Results for New Motorhome. I'm using Dynamo to retrieve the listings if that helps.
That's gonna be a bit trickier, I'm afraid. In the {exp:dynamo:form}
tag pair you'll get a {category}
variable, but the value of that is gonna be something like 1&2
. So you'd have to find a way to transform that string into something you can use to look up the category names. There's nothing built in to Dynamo to do that I'm afraid.
I'm noticing that I don't get the {category} variable to work when using the query string search. It just returns an unparsed {category} variable. But when I use the Dynamo form, it does indeed work. Is that normal behavior?
You're right. Bad advice on my part. It won't work in the query string way.
You can use Mo' Variables to enable {get:category}
, which you can then feed into gwcode_categories.
GWCode Categories doesn't take & separators in the show="" parameter, so we had to whip up some PHP to handle it. Here's what we got to work:
{exp:gwcode_categories show="<?php echo str_replace(Array('&', ';'), Array('|', ''), '{get:category}'); ?>" style="linear"} {cat_name} {/exp:gwcode_categories}
I have two dropdowns, each containing a different category group. Is there a method I'm missing that would allow searching for both groups combined, plus the ability to search for one or the other? The & separator works great for when you're searching for two categories, but it doesn't return any results if you only search one or the other.
My two groups are:
New Old
Motorhomes Fifth Wheels Toy Trailers
Here's my code: