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
Prev Previous Post   Next Post Next
  #1  
Old May 1st, 2011, 08:18 PM
meperez meperez is offline
 
Join Date: Mar 2011
Posts: 43
Default Dynamic Generation of Brand Filter

www.thekitchentool.com
Store Id: 30751

Hi Eric,

I have some hard-coded brand filters on each category and I'm trying to generate those dynamically so that I don't have to worry about them getting out of sync with the products. Based on other posts I saw, I gave it an initial try... and clearly my syntax is erroneous somewhere as the Brand Filter no longer shows up. I'm trying it on the Woks category under Cookware. Can you please help?

I added the following function to my functions.php:

//Function to Get Brands of Woks Category
function dfr_get_brands() {
global $wpdb;
$merchants = $wpdb->get_results("SELECT DISTINCT p.brand FROM ".$wpdb->prefix."dfr_shop_products p, ".$wpdb->prefix."wp_dfr_shop_p2c pc, ".$wpdb->prefix."wp_dfr_shop_cats c AND pc.cat_id = c.id AND c.name = \'Woks\' ORDER BY c.name, p.brand");
$list = array();
foreach ($brands as $brands) {
$list[$brands->brand] = $brands->brand;
}
return $list;
}

Then to the filter Widget, I added:

<div>
<form method="get">
<span>
<?php echo datafeedr_tools()->form_select("brand",
array(
"" => "All Brands",
?>
<?php
$brands = dfr_get_brands();
foreach ($brands as $brandname) {
echo '\"'$brandname'\" => \"'$brandname'\",';
}
?>
));
<input type="submit" value="Go" />
</span>
</form>
</div>

My goal is to generate the following code, for example:

<div>
<form method="get">
<span>
<?php echo datafeedr_tools()->form_select("brand",
array(
"" => "All Brands",
"All-Clad" => "All-Clad",
"Anolon" => "Anolon",
"Calphalon" => "Calphalon",
"Circulon" => "Circulon",
"Cuisinart" => "Cuisinart",
"Le Creuset" => "Le Creuset",
"West Bend" => "West Bend"
)); ?>
<input type="submit" value="Go" />
</span>
</form>
</div>
 


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
Merchant and Brand filter Widgets Nugerama Tips, Tricks & Tutorials 13 March 7th, 2012 05:01 PM
Brand Filter Drop-Down with All Brands option meperez Questions 8 March 26th, 2011 12:04 AM
Brand Filter = Brands Only show when in Category macfink Questions 3 March 25th, 2011 12:55 PM
Drop down Menu from filter by Brand macfink Questions 4 March 25th, 2011 09:32 AM
Brand filter? sylviathewitch Problems 3 March 8th, 2011 08:43 AM


All times are GMT -5. The time now is 09:22 PM.


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