View Single Post
Old May 10th, 2012, 09:17 PM
fsuggest fsuggest is offline
Join Date: Apr 2012
Posts: 45

Hey Eric,

Appreciate the quick reply.

Tried your suggestion but I'm not sure where my code is wrong.

Here's what I've done:

In function.php, I use:

function dfr_get_merchants_dropdown() {
    global $wpdb;
    $merchants = $wpdb->get_results("SELECT merchant, merchant_id FROM ".$wpdb->prefix."dfr_shop_products GROUP BY merchant");
    $html = '<option value="">All stores</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;
In my widget, I use:

  <p class="merchant">
    <label for="merchant">Store</label>
    <select name="merchant_id" style="width: 195px;" value=''>
      <?php echo dfr_get_merchants_dropdown(); ?>
And in the search results page, I use:

<!-- Search Fields -->
  <?php if (@$_GET['word']){ ?><li><b>Description: </b>[store.get param="word"]</li><?php } ?>
  <?php if (@$_GET['brand']){ ?><li><b>Brand: </b>[store.get param="brand"]</li><?php } ?>
  <?php if (@$_GET['category']){ ?><li><b>Category: </b>[store.get param="category"]</li><?php } ?>
  <?php if (@$_GET['merchant_id']) { ?>
    <b>Store: </b>
    $merchant = $wpdb->get_row("SELECT merchant FROM ".$wpdb->prefix."dfr_shop_products WHERE merchant_id = $_GET['merchant_id']");
    echo $merchant;
  <?php } ?>
  <?php if (@$_GET['tags']){ ?><li><b>Tags: </b>[store.get param="tags"]</li><?php } ?>
  <?php if (@$_GET['saleprice']){ ?><li><b>Price: </b>$[store.get param="saleprice"]</li><?php } ?>
<!-- /Search Fields -->
I've tried get_results as well but still get a blank page.

Can you see where I'm going wrong in my code?

Thank you.

Last edited by fsuggest : May 10th, 2012 at 09:20 PM.