View Single Post
Old June 17th, 2011, 10:43 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
Join Date: Feb 2008
Posts: 16,902


To display a list of merchant logos AND have a page to display a list of products from those merchants, here's how that is done.

First, you must make sure that the logo exists in your logo directory. If it's not there, you need to add it. We have not added a logo for every single merchant in the Factory.

Also, I am displaying the merchant logos in the sidebar using a Widget. You can choose to display them wherever you'd like.

1. Add this function to your theme's functions.php file:
PHP Code:
function dfr_get_merchants() {
$merchants $wpdb->get_results("SELECT merchant_id, merchant FROM ".$wpdb->prefix."dfr_shop_products GROUP BY merchant_id");
$list = array();
    foreach (
$merchants as $merchants) {
$list[$merchants->merchant_id] = $merchants->merchant;

2. Add a new Widget with the following settings:

3. Add a Text module to the widget and add the following code to the Text module (be sure to replace YOURDOMAIN with your actual domain name):
PHP Code:
foreach (
$merchants as $mid => $name) {
  <a href="[server.url query='view=merchants']?merchant=<?php echo $name?>">
    <img src="http://YOURDOMAIN/wp-content/uploads/store/merchants/<?php echo $mid?>.jpg" alt="<?php echo $name?>" />
4. Now add a new Custom view with the following settings:

5. Add a Product list module to this new custom view.

6. Add code to the Product list modue to display the products:

That's it. Now after I add the widget to my sidebar, I have a list of merchant logos that link to a page which displays only products from those merchants. (Note that I do have 1 merchant logo missing that needs to be added.)