View Single Post
  #1  
Old April 26th, 2012, 09:11 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default Add a list of merchant logos to your sidebar

Here's how to add a list of logos to your sidebar like this:



1. Add the following function to your theme's functions.php file:
PHP Code:
function dfr_get_merchant_logos() {
    global 
$wpdb;
    
$merchants $wpdb->get_results("SELECT merchant, merchant_id FROM ".$wpdb->prefix."dfr_shop_products WHERE state = 1 GROUP BY merchant");
    
$html '';
    foreach (
$merchants as $k => $v) {
        if (
trim($v->merchant) != "") {
            
$logo_url dfr_view::merchant_logo_url($v->merchant_id);
            
$html .= '<a href="?merchant_id='.$v->merchant_id.'">';
            
$html .= '<img src="'.$logo_url.'" alt="'.$v->merchant.'" width="150" height="40" />';
            
$html .= '</a>';
        }
    }
    return 
$html;

2. Save your changes.

3. Go here: The Factory > Your Store > VIEWS > WIDGETS > Add a new view

4. Name the new view "Merchant Logos".

5. Add a Text module to the new "Merchant Logos" view.

6. Add the following code to the Text module:
Code:
<?php echo dfr_get_merchant_logos(); ?>
7. Save the Text module.

8. Go here: WordPress Admin Area > Tools > Datafeedr

9. Click the [Update Settings Only] button.

10. Go here: WordPress Admin Area > Appearance > Widgets

11. Add a Datafeedr widget to your sidebar and choose "Merchant Logos" from the drop down list.

If you have missing logos, you will either need to add them yourself or request that they be added in this forum: http://www.datafeedr.com/forums/forumdisplay.php?f=13

Eric