Hi,
How can do a filter in "Categories" (e.g. quick search for real estate) for category1 (property type) + category 2 (location)+ category 3 (mode: to sale, to rent)?, i.e. that the user perform a search cross.
Thanks
Thanks Drew, it was exactly that, but it does not work properly. My idea is to open a results page as filter.php with this function as in example:
<?php
$filters = array();
if (perch_get('type')) {
// if 'type' is on the URL, add a filter for bedrooms
$filters[] = array(
'filter' => 'type',
'match' => 'eq',
'value' => perch_get('type'),
);
}
if (perch_get('beds')) {
// if 'beds' is on the URL, add a filter for bedrooms
$filters[] = array(
'filter' => 'beds',
'match' => 'eq',
'value' => perch_get('beds'),
);
}
if (perch_get('location')) {
// if 'location' is on the URL, add a filter for the location
$filters[] = array(
'filter' => 'location',
'match' => 'eq',
'value' => perch_get('location'),
);
}
// Unset the filters if none are used:
if (!count($filters)) $filters=false;
// Then get the list
perch_content_custom('Properties', array(
'template' => 'property_listing.html',
'sort' => 'price',
'sort-order' => 'DESC',
'filter' => $filters,
));
?>
Hi Drew,
I've done everything like is in the tutorial:
- a form: perch_form ('property_filter.html');
- the template of the form: property_filter.html
- page filter.php with Filtering from the URL options
and is only sending the form in the dashboard Forms, what I need is that the user sees filter results.
Thanks
I'm not sure what you mean by 'cross' in this context, but see if this helps:
https://solutions.grabaperch.com/architecture/user-filtered-lists
Thanks Drew, it was exactly that, but it does not work properly. My idea is to open a results page as filter.php with this function as in example:
Ok, so what's not working?
If the form is the same page (filter.php) then the result should show it here, right? but shows nothing.
Are you posting the form to the new page?
No Drew
That might be a good place to start.
Hi Drew, I've done everything like is in the tutorial: - a form: perch_form ('property_filter.html'); - the template of the form: property_filter.html - page filter.php with Filtering from the URL options
and is only sending the form in the dashboard Forms, what I need is that the user sees filter results. Thanks
Have you included an
app
attribute on your form tag?yes: <perch:form id="filter" method="get" app="perch_forms">
Ok, so remove that.
done, but nothing happens.
What do you mean nothing happens? What do you see?
excuse me Drew if I am not very clear. What should happen is to show the search results.
And what does happen? It's very hard to help if you can't tell us what's going wrong.
Hi Drew, I send you my page with the filter search https://www.sudamericapropiedades.cl/propiedades/filter.php Thanks
That looks like the form is working fine.
Where should the results be?
on the same page (or on another page, e.g. result.php, but I not know how to do) Thanks
Can you show me the code you're using?
Ok. property_filter.html
and filter.php