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 January 18th, 2012, 09:55 AM
meinehandtasche meinehandtasche is offline
 
Join Date: Jul 2011
Posts: 43
Default Drop Down for price categories working together with category drop down

Store ID: 32722
Website URL: http://www.meinehandtasche.de/
URL to page in question: http://www.meinehandtasche.de/store/

Hi Eric,

I am working on a price filter as drop down that works together with the drop down brand filter.
Currently I just use the following which works perfectly but it would be much nicer to have a drop down:

I pasted within / Factory > Widgets > new brand filter widget the following code in a / text / widget view module:

Quote:
Prices:
<ul>
<?php if (@$_GET['price']) { ?>

<li><a href="[server.url type='fullpage' query='-price']">[X] delete price filter</a></li>

<?php } else { ?>

<li><a href="[server.url type='fullpage' query='price=-50']">< 50</a></li>
<li><a href="[server.url type='fullpage' query='price=50-100']"> 50 - 100</a></li>
<li><a href="[server.url type='fullpage' query='price=100-150']"> 100 - 150</a></li>
<li><a href="[server.url type='fullpage' query='price=150-250']"> 150 - 250</a></li>
<li><a href="[server.url type='fullpage' query='price=250-500']"> 250 - 500</a></li>
<li><a href="[server.url type='fullpage' query='price=500-1000']"> 500 - 1.000</a></li>
<li><a href="[server.url type='fullpage' query='price=1000-']">> 1.000</a></li>

<?php } ?>
</ul>

How can I get this done as a drop down as mentioned above?

Thanks,
Oliver
  #2  
Old January 18th, 2012, 11:17 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi

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>
  
   <select name="price">
    <?php echo dfr_get_prices(); ?>
  </select>
  
  <input type="submit" value="Go" />
  
</form>
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>
    <?php
}

function 
dfr_get_brands() {
    global 
$wpdb;
    
$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>';
    }
    return 
$html;
}
Those work with each other.

Eric
  #3  
Old January 18th, 2012, 12:13 PM
meinehandtasche meinehandtasche is offline
 
Join Date: Jul 2011
Posts: 43
Default

Store ID: 32722
Website URL: http://www.meinehandtasche.de/
URL to page in question: http://www.meinehandtasche.de/store/

Hi Eric,

It works like a charme :-)
Thank you so much! You made my day! :-)

Oliver
 


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
Category drop down & sales items vonspurter Questions 8 January 17th, 2012 02:32 PM
Drop down categories in Store menu jordand1 Questions 8 September 21st, 2011 01:30 PM
Add drop down menus for store categories ccgmark Tips, Tricks & Tutorials 13 January 28th, 2011 01:34 PM


All times are GMT -5. The time now is 03:59 AM.


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