View Single Post
  #9  
Old May 10th, 2013, 11:07 AM
urbaniteuk urbaniteuk is offline
 
Join Date: Apr 2013
Posts: 120
Default

Quote:
<select name="price">
<option value="-100">Less than $100</option>
<option value="100-500">Between $100 and $500</option>
<option value="500-">Over $500</option>
</select>
I input the code above, which created the drop down. However, the search function didn't work, so I then tried this!

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

<li><a href="[server.url type='fullpage' query='price']">[x] Remove price filter</a></li>'

<?php } else { ?>

<select name="price">
<option value="-50">Less than 50</option>
<option value="50-100">50 ~ 100</option>
<option value="100-250">100 ~ 250</option>
<option value="250-500">250 ~ 500</option>
<option value="500-1000">500 ~ 1,000</option>
<option value="1000-">More than 1,000</option>

</select>

<?php } ?>

</ul>
Obviously, I've lost the plot! lol What have I done wrong?


Also,

I implement this as advised:

Quote:
function dfr_get_brands_list($category) {
global $wpdb;
$cat_query = "";
if ($category) {
$in = array();
$in[] = $category->id;
if (!empty($category->children)) {
foreach ($category->children as $child => $id) {
$in[] = $id;
}
}
$category_ids = implode(",", $in);
$cat_query = "WHERE p2c.cat_id IN (".$category_ids.") ";
}
$brands = $wpdb->get_results("
SELECT brand, p2c.cat_id
FROM ".$wpdb->prefix."dfr_shop_products AS p
INNER JOIN ".$wpdb->prefix."dfr_shop_p2c AS p2c ON p.id = p2c.id
$cat_query
GROUP BY brand
");
$list = array();
foreach ($brands as $brands) {
$brand = trim($brands->brand);
if ($brand != "") {
$list[] = $brand;
}
}
return $list;
}
And this in your view in the Factory:
HTML Code:

<ul>
<?php
$brands = dfr_get_brands_list($category);
foreach ($brands as $brand) : ?>
<li><a href="[server.url type='fullpage' query='brand=$brand']"><?php echo $brand; ?></a></li>
<?php endforeach; ?>
</ul>

Eric
It now filters the related brands to a category, but it now displays as a list — not a drop down menu.

Please advise