View Single Post
  #1  
Old July 21st, 2014, 12:35 PM
yankeestonk yankeestonk is offline
 
Join Date: Jun 2013
Posts: 605
Default exclude merchant filter?

http://saveongolf.net

I have the filter by merchant search box. I have about 15 merchants. You can either search all merchants or any one merchant. Is there a way to search "selected merchants". (more than one but not all) and/or exlcude 1 or more merchants?


My filter code if it helps:

<?php
function dfr_get_merchants() {
global $wpdb;
$merchants = $wpdb->get_results("SELECT merchant, merchant_id FROM ".$wpdb->prefix."dfr_shop_products WHERE network NOT LIKE '%Coupons%' GROUP BY merchant");
$html = '<option value="">Select all merchants</option>';
foreach ($merchants as $k => $v) {
if (trim($v->merchant) != "") {
$selected = (strip_tags($_GET['merchant_id'])==$v->merchant_id) ? ' selected="selected"' : '';
$html .= '<option value="'.$v->merchant_id.'"'.$selected.'>'.$v->merchant.'</option>';
}
}
return $html;
}
?>

[search.form]
<div class="store_search_form">
<p class="keyword">
<label for="word">Keyword</label> [search.name]
</p>
<p class="merchant">
<select name="merchant_id">
<?php echo dfr_get_merchants(); ?>
</select>
</p>
<p class="price">
<label for="price">Price</label> [search.selectprice options='any, under $50(-50), $50 - $100, $100 - $200, $200 - $350, more than 350 (350+)']
</p>
<p class="button">[search.submit title='Find it!']</p>
</div>
[/search.form]