Forum
Multi-step filtered using categories?
Hi Drew/Rachel,
I am trying to create a multi-step filter with categories.
I have a region 'Shipping Route' on the page 'shipping-search-results.php' with a template as follows:
<table class="table-responsive">
<tr>
<td>Origin</td>
<td><perch:categories id="origin" label="Origin" set="origin" required="true" /></td>
</tr>
<tr>
<td>Origin code</td>
<td><perch:content id="origin-code" label="Origin code" required="true" /></td>
</tr>
<tr>
<td>Destination</td>
<td><perch:categories id="destination" label="Destination" set="destination" required="true" /></td>
</tr>
<tr>
<td>Destination code</td>
<td><perch:content id="destination-code" label="Destination code" required="true" /></td>
</tr>
<tr>
<td>Vessel</td>
<td><perch:content id="vessel" label="Vessel" required="true" /></td>
</tr>
<tr>
<td>Closing</td>
<td><perch:content id="closing" label="Closing" required="true" /></td>
</tr>
<tr>
<td>Sailing</td>
<td><perch:content id="sailing"label="Sailing" required="true" /></td>
</tr>
<tr>
<td>Transit time</td>
<td><perch:content id="transit-time" label="Transit time" required="true" /></td>
</tr>
</table>
<perch:categories id="service" label="Service" set="service" order="1" suppress="true" />
I need to create a multi-step filter to narrow town the results by clicking choices.
These are the filter steps that I need to have - Service > Origin > Destination > Result
This is my origin.html template called in 'shipping-search-origin.php':
<div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
<perch:categories id="origin" label="Origin" set="origin" required="true">
<a href="/category/<perch:category id="catPath" />" class="service-panel"><h2><perch:category id="catTitle" /></h2></a>
</perch:categories>
</div>
There will be a similar template for destination on 'shipping-search-destination.php'
I have categories set up for Service, Origin and Destination and I have watched the video and read the documentation, but I'm just really struggling with tying everything up....
Is this something I can do with Perch? If so would you be able to point me in the right direction?
Many thanks in advance,
Andy
The approach would be fundamentally the same as this: https://solutions.grabaperch.com/architecture/user-filtered-lists
Thanks for the lightning response Drew! I will take a look at this link now.
Hi Drew,
Is there a way of implementing this approach with out the form aspect?
i.e. domain.com/shipping-search-results.php?
I need to apply a multi choice filter so that there can never be 'no results'. i.e. a user can't choose a origin that isn't available under that service.
This is what now have on my results page:
<?php
// Create an empty array ready to add our filters to $filters = array();
?>
But adding filters to the url does nothing? i.e. domain.com/shipping-search-results.php?service=airfreight&etc
How will the user filter their choices?
Hi Drew,
By using buttons displayed on the pages.
I nearly have it working (I think!)... just not sure how to include the service filter on the destination page:
What are the buttons? HTML links? In which case they'll behave in the same way as the form example. If they're form buttons, they still behave in the same way as the form example.