View Single Post
Old January 18th, 2012, 11:17 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
Join Date: Feb 2008
Posts: 16,902


So if you are using the drop down brand code from here, here's how a price drop down could be integrated into the form:

In your View:
HTML Code:
<form method="get" action="[server.url type='fullpage']">
  <select name="brand">
    <?php echo dfr_get_brands(); ?>
   <select name="price">
    <?php echo dfr_get_prices(); ?>
  <input type="submit" value="Go" />
In your functions.php file:
PHP Code:
function dfr_get_prices() {
    $price = strip_tags(@$_GET['price']);
    <option value="-50" <?php if ($price=="-50"){echo ' selected="selected"';} ?>>Less than $50</option>
    <option value="50-200" <?php if ($price=="50-200"){echo ' selected="selected"';} ?>>$50 - $200</option>
    <option value="200-" <?php if ($price=="200-"){echo ' selected="selected"';} ?>>More than $200</option>

dfr_get_brands() {
$brands $wpdb->get_results("SELECT brand FROM ".$wpdb->prefix."dfr_shop_products GROUP BY brand");
$html '';
    foreach (
$brands as $brands) {
$selected = (@$_GET['brand'] == $brands->brand) ? ' selected="selected"' '';
$html .= '<option value="'.$brands->brand.'"'.$selected.'>'.($brands->brand).'</option>';
Those work with each other.