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 14th, 2014, 04:43 PM
alankarsale alankarsale is offline
 
Join Date: Jul 2014
Posts: 20
Default Merchant drop down blank

I use this code to select a merchant through a drop down.:

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 a merchant</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;
}
?>

It works great. But I would like to have a "Blank" choice so a customer doesn't have to choice a merchant when searching. Is that possible?
  #2  
Old August 14th, 2014, 06:02 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

That's what this line is for:
HTML Code:
$html = '<option value="">Select a merchant</option>';
You could change it to something like:
HTML Code:
$html = '<option value="">Select all merchants</option>';
Or just leave it blank:
HTML Code:
$html = '<option value=""> </option>';
Eric
  #3  
Old August 14th, 2014, 09:42 PM
alankarsale alankarsale is offline
 
Join Date: Jul 2014
Posts: 20
Default

That worked Great! What about with the categories? Can I do the same?

Code:
    <select name="c">
      [category.list before='' after='']
        <option value="[category.id]"><?php echo str_repeat ('-', (($depth-1)*2) ); ?> &nbsp; [category.name]</option>
        [category.repeat]
      [/category.list]
    </select>
  #4  
Old August 15th, 2014, 08:16 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

Sure, just change your code to this:

HTML Code:
    <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>
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
Hide Brand and Merchant filter if has empty drop down Panthony54 Questions 1 September 11th, 2013 10:17 AM
Merchant drop down not working on internal pages DohRayMi Problems 4 March 17th, 2013 05:49 PM
Drop Down Merchant Listing? outdoorcampingshops Questions 2 February 4th, 2013 11:32 AM
Drop Down for price categories working together with category drop down meinehandtasche Questions 2 January 18th, 2012 12:13 PM
some merchant logos blank jdrom Problems 3 July 19th, 2011 08:53 AM


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.