Hi David,
Sorry to bug you. I've been searching to forum for sometime, but I haven't been able to find the code to do this. All I want to do is this:
Filter by Price Range:
100 - 200
201 - 300
301 - 400
401 - 500
You get the idea. It's a niche site so I don't need the filter to adjust with different types of products. I just need a simple filter.
Thanks for your help!
David,
I just wanted to add it to the leftmenu.php. I'm using one of the templates. Here's what I added to the leftmenu.php
<h3>Browse By</h3>
<ul>
<li><a href='<?php $config_baseHREF."search.php?q=".urlencode($q);?>&maxPrice=200'>Up to 200</a></li>
<li><a href='<?php $config_baseHREF."search.php?q=".urlencode($q);?>&minPrice=100&maxPrice=200'>200 to 300</a></li>
<li><a href='<?php $config_baseHREF."search.php?q=".urlencode($q);?>&minPrice=300&maxPrice=400'>300 to 400</a></li>
<li><a href='<?php $config_baseHREF."search.php?q=".urlencode($q);?>&minPrice=500&maxPrice=600'>500 to 600</a></li>
<li><a href='<?php $config_baseHREF."search.php?q=".urlencode($q);?>&maxPrice=600'>Over 600</a></li>
</ul>
IT's not working correctly. Any ideas?
Hi Lunen,
Looks like you just missed out the first line that sets $href - add the following just before you code...
<?php $href = $config_baseHREF."search.php?q=".urlencode($q); ?>
...that should be all it is...
Cheers,
David.
--
PriceTapestry.com
Hi David,
is possible create this filter without loss other filters and orders selected?
Thanks,
Marco Saiu
Hi Marco,
You can scan $_GET[] for all current filters in effect and append them to the base $href value - so from the above code where you have:
<?php $href = $config_baseHREF."search.php?q=".urlencode($q); ?>
...REPLACE with:
<?php
$href = $config_baseHREF."search.php?q=".urlencode($q);
foreach($_GET as $k => $v)
{
if (strpos($k,"Filter")!==FALSE)
{
$href .= "&".$k."=".urlencode($v);
}
}
?>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi lunen,
To do this, create 2 new files on your site as follows - simply change the price ranges as required in the first....
html/user_searchresults_before.php
<table>
<tr>
<td valign='top'>
Filter by Price Range
<?php $href = $config_baseHREF."search.php?q=".urlencode($q); ?>
<ul>
<li><a href='<?php print $href; ?>&maxPrice=100'>Up to 100</a></li>
<li><a href='<?php print $href; ?>&minPrice=100&maxPrice=200'>100 to 200</a></li>
<li><a href='<?php print $href; ?>&minPrice=200&maxPrice=300'>200 to 300</a></li>
<li><a href='<?php print $href; ?>&minPrice=300&maxPrice=400'>300 to 400</a></li>
<li><a href='<?php print $href; ?>&maxPrice=400'>Over 400</a></li>
</ul>
</td>
<td valign='top'>
html/user_searchresults_after.php
</td>
</tr>
</table>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com