Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Questions
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 18th, 2014, 10:24 AM
alankarsale alankarsale is offline
 
Join Date: Jul 2014
Posts: 20
Default Search Code not working

Hello,

My search form is not working properly. It will do products but my merchants are coming up with any products. Can you help?

Code:
<?php
function dfr_get_merchants() {
    global $wpdb;
    $merchants = $wpdb->get_results("SELECT merchant, merchant_id FROM ".$wpdb->prefix."dfr_shop_products 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.word]
  </p>
  <p class="merchant">
    <label for="word">Merchant</label>
    <select name="merchant_id">
      <?php echo dfr_get_merchants(); ?>
    </select>
  </p>
  <p class="category">
    <label for="category">Category</label> 
    <select name="c">
      <option value=""> Select all categories </option>
      [category.list before='' after='']
        <option value="[category.id]"><?php echo str_repeat ('-', (($depth-1)*2) ); ?> &nbsp; [category.name]</option>
        [category.repeat]
      [/category.list]
    </select>
  </p>
  <p class="price">
   <label for="price">Price</label> [search.selectprice options='any, Below $10(-5), $10 - $20, $20 - $30, $30 - $40, more than 40 (40+)']
  </p>
  <p class="button">[search.submit title='Find it!']</p>
</div>
[/search.form]
  #2  
Old August 18th, 2014, 10:34 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

You can't pass an empty "c" parameter to the URL. If the "c" parameter exists, it must be filled with a valid category ID.

Eric
  #3  
Old August 18th, 2014, 10:50 AM
alankarsale alankarsale is offline
 
Join Date: Jul 2014
Posts: 20
Default

Can I just erase that line to fix it?
  #4  
Old August 18th, 2014, 10:55 AM
alankarsale alankarsale is offline
 
Join Date: Jul 2014
Posts: 20
Default

I replaced the "c" with "category.id" it seemed to fix it. Is that correct?
  #5  
Old August 18th, 2014, 11:13 AM
alankarsale alankarsale is offline
 
Join Date: Jul 2014
Posts: 20
Default

Now, it gives me the merchant items, but the category search is not working. It just gives me all the merchant items and it will not filter category or price
  #6  
Old August 18th, 2014, 11:19 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

"category.id" will not work. It's not a valid parameter. Only "c" works and if it's set as a parameter, it requires a value.

Eric
  #7  
Old August 18th, 2014, 11:20 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

Also, categories are not meant to be used as filters. They are their own product organization system. Why not just expose filters on a per-category basis? That's what I would do.

Eric
  #8  
Old August 18th, 2014, 11:23 AM
alankarsale alankarsale is offline
 
Join Date: Jul 2014
Posts: 20
Default

Can you send me a link on how to do this?
  #9  
Old August 18th, 2014, 11:33 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

Sorry, that wasn't clear. I meant remove the category drop down from the Advanced Search form and just have the Category widget listed above (or below) your Advanced Search form.

Eric
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Short Code not Working rj3494 Problems 5 May 17th, 2012 09:27 PM
Search box code ccgmark Tips, Tricks & Tutorials 10 May 13th, 2011 02:15 PM
Search form not working fashion Problems 7 May 12th, 2011 02:00 PM


All times are GMT -5. The time now is 01:08 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.