View Single Post
  #24  
Old March 17th, 2012, 10:01 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Quote:
Originally Posted by lesljr View Post
how do i use the code to set a dynamic filter without the drop drop down. I want it to look like the filter by price with the url.
Here's the PHP:
PHP Code:
function dfr_get_brands() {
    global 
$wpdb;
    
$brands $wpdb->get_results("SELECT brand FROM ".$wpdb->prefix."dfr_shop_products GROUP BY brand");
    
$list = array(); 
    foreach (
$brands as $brands) {
        
$list[] = $brands->brand
    }
    return 
$list

And in your views:
HTML Code:
<ul> 
<?php 
$brands = dfr_get_brands(); 
foreach ($brands as $brand) {
    if ($brand != "") {
    $brand = urlencode($brand); 
    ?> 
    <li><a href="[server.url type='fullpage' query='brand=$brand']"><?php echo urldecode($brand); ?></a></li>
  <?php } ?>
<?php } ?> 
</ul>