Thanks for the kind words all.
@Tim - The product search you’re referring to uses some simple PHP to pull the category IDs from the GET request sent by the form. I then check to see if these are numeric (as a simple form of security), and concatenate them together with an ampersand as the “glue”. This then gets passed to the weblog:entries tag (the PHP parsing is set to “Input” for that template.)
The one downfall of this method is that it doesn’t support pagination.
(I should also note that this could have also been achieved using the “dynamic parameters” feature for the weblog:entries tag, but I wanted the URLs used to filter by multiple categories to be bookmark-able, which you can’t do with a POST request.)
In case anyone wants to use the same:
<?php
if ( isset($_GET['product'])
&& is_numeric($_GET['product'])
&& isset($_GET['city'])
&& is_numeric($_GET['city']) ) {
$cats = array();
$city = $_GET['city'];
$product = $_GET['product'];
$cats[] = $city;
$cats[] = $product;
$showcats = implode('&', $cats);
$showcats = ' category="' . $showcats . '"';
} else {
$showcats = '';
}
?>
Then I echo this into the weblog:entries tag:
{exp:weblog:entries weblog="guide"<?php echo $showcats; ?> limit="500" orderby="title"
sort="asc" disable="category_fields|member_data|pagination|trackbacks"}