I have a functioning search that works with parameters, for example brand or price, on a site that has top and sub categories. Now, when I am within a sub-category, and enter parameters, it gives results from the top category, not just the sub. I'm looking for a way to specify, to make it only look in the current category.
var searchParam = {};
<?php if (isset($_GET['q'])): ?>
searchParam['q'] = '<?php echo $_GET['q']; ?>';
<?php endif;?>
<?php if (isset($category)): ?>
searchParam['cat'] = '<?php echo $currentcategory; ?>';
<?php endif;?>