Datafeedr Support Forums

Datafeedr Support Forums (http://www.datafeedr.com/forums/index.php)
-   Tips, Tricks & Tutorials (http://www.datafeedr.com/forums/forumdisplay.php?f=66)
-   -   Add a list of merchant logos to your sidebar (http://www.datafeedr.com/forums/showthread.php?t=6828)

Eric April 26th, 2012 09:11 AM

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

1800HART April 27th, 2012 01:42 AM

this is extremely cool and I will come with a massive list of merchant_id logo numbers! But, how can the logos be centered in the sidebar?

/// added /////

Oh nevermind! should've looked at the code
$html .= '<img src="'.$logo_url.'" alt="'.$v->merchant.'" width="150" height="40" />'

\\\ added again \\\

Eric ... when the logos appear in the sidebar, whether front page or product detail page ... how can you fix the link to the merchant? With the above code, if you click any of the logos it goes to [current.url]/?merchant_id link...
e.g.
http://hartmarket.com/?merchant_id=1292
http://hartmarket.com/store/recommen...rchant_id=1292
etc

1800HART April 27th, 2012 02:07 AM

Quote:

Originally Posted by 1800HART (Post 31384)
this is extremely cool and I will come with a massive list of merchant_id logo numbers! But, how can the logos be centered in the sidebar?

/// added /////

Oh nevermind! should've looked at the code
$html .= '<img src="'.$logo_url.'" alt="'.$v->merchant.'" width="150" height="40" />'

\\\ added again \\\

Eric ... when the logos appear in the sidebar, whether front page or product detail page ... how can you fix the link to the merchant? With the above code, if you click any of the logos it goes to [current.url]/?merchant_id link...
e.g.
http://hartmarket.com/?merchant_id=1292
http://hartmarket.com/store/recommen...rchant_id=1292
etc

/// while we're at it... ///

Is there a way to list them continuously on the same line that wraps to the next line if runs out of room? EG my sidebar is 300px side, and could fit two 180px logos side by side, or I could place a widget just above the footer below content in a 660px wide content side by side ... I have a few stores with many vendors and linking them down the sidebar takes up too much space :(

1800HART April 27th, 2012 02:26 AM

[off-topic - i don't know why I can't edit previous comments of mine, and must either Reply or Quote Reply only]

//
Above - when I mentioned it would be nice to click the logos in the sidebar and go to a proper URL .. I meant perhaps, directly to the affiliate store with our affiliate code intact as per settings of that store?

Eric April 27th, 2012 08:56 AM

Hi
Quote:

Originally Posted by 1800HART (Post 31387)
Is there a way to list them continuously on the same line that wraps to the next line if runs out of room?

They will show on the same line if there is room but having a 300px wide sidebar won't work if it has any padding at all. By default, they will all appear on the same line given the room to do so.

Quote:

Originally Posted by 1800HART (Post 31391)
Above - when I mentioned it would be nice to click the logos in the sidebar and go to a proper URL .. I meant perhaps, directly to the affiliate store with our affiliate code intact as per settings of that store?

We don't have that URL so it's not possible, not without writing your own custom function and inserting links to the merchant's site yourself.

Eric

SurveillanceTips September 1st, 2012 01:41 AM

Just a quick question. I've been maulling over this code, but I want to know, after listing the products, is there a link on the logo images? where does the link go? extract products of that merchants and display it or what?

1800HART September 1st, 2012 03:16 AM

Well now .. that is interesting ..

what USED To happen was that if you clicked on the logo in the sidebar all the products from that merchant would appear in the center column for me.

Now - since the upgrade to version 3.9 --- i just noticed (D'oh!) that all my merchant logo widgets were REPLACED by an empty Tag Cloud widget in all my sidebars.

>> Eric? did something change in the new version? I won't be able to look closer at this until mid week next week //

Eric September 1st, 2012 08:34 AM

Quote:

Originally Posted by SurveillanceTips (Post 34797)
Just a quick question. I've been maulling over this code, but I want to know, after listing the products, is there a link on the logo images? where does the link go? extract products of that merchants and display it or what?

There is no link because we have no link to go to just the merchant's homepage.

Quote:

Originally Posted by 1800HART (Post 34799)
Well now .. that is interesting ..

what USED To happen was that if you clicked on the logo in the sidebar all the products from that merchant would appear in the center column for me.

Now - since the upgrade to version 3.9 --- i just noticed (D'oh!) that all my merchant logo widgets were REPLACED by an empty Tag Cloud widget in all my sidebars.

>> Eric? did something change in the new version? I won't be able to look closer at this until mid week next week //

Nothing changed as far as this is concerned.

redfoxdeals November 14th, 2013 04:09 PM

Store ID: 43393
Website URL: redfoxdeal.com
URL to page in question: http://www.redfoxdeals.com/?q=store/cat/merchants/

Hi! Thanks for this, I have now added a list of Logos to my sidebar, as well as to my "merchants" page, as listed above however, there are a couple things I have not figured out:

1. It appears that there are a limited number of advertisers showing up, although I know you set up all of the logos for me a few weeks ago

2. I would like the list on the merchant page to be a lot neater, more like nice tidy columns rathar than all smooshed together, is this possible?

3. When I click on any of these logos, they all go back to my home page. I can I have them go to a page of products / coupons for that merchant?

4. How do I set up a list of just coupon merchant logos, or just x logos, rather than all of the merchants in my store?

Thanks for looking in to this for me!

Eric November 14th, 2013 04:17 PM

Hi,

1. There are a total of 11 merchants with products in your store. Two of them appear twice because one is for products and one is for coupons. Therefore only 9 logos will appear on your site. And I see 9 logos on your site.

2. They seem tidy in your sidebar:



If you need further styling, you'll need to apply CSS styling to them.

3. You need to set your Permalink settings to something other than "Default" here: WordPress Admin Area > Settings > Permalinks. I suggest "postname".

4. Just coupon logos is not possible. However if you want to limit the number of logos that appear, change the code from this:

PHP Code:

    $merchants $wpdb->get_results("SELECT merchant, merchant_id FROM ".$wpdb->prefix."dfr_shop_products WHERE state = 1 GROUP BY merchant"); 

To this:

PHP Code:

    $merchants $wpdb->get_results("SELECT merchant, merchant_id FROM ".$wpdb->prefix."dfr_shop_products WHERE state = 1 GROUP BY merchant LIMIT 5"); 

Eric

redfoxdeals November 14th, 2013 04:27 PM

Thank you,
I am still having issues, though :(

1. That makes sense why there are that many logos. thanks
2. They do look good in the side bar, but when I have them listed just on the merchant page in the body part of the page, they are not quite so pretty. Some gaps in between them would be nice. :)

Thank you,
I am still having issues, though :(

1. That makes sense why there are that many logos. thanks
2. They do look good in the side bar, but when I have them listed just on the merchant page in the body part of the page, they are not quite so pretty. Some gaps in between them would be nice. :)
3. My permalinks are already set to "postname"
4. Perfect, thanks!

Eric November 14th, 2013 04:36 PM

Hi,

You're right, you permalinks are set up right. You just need to go to the right URL (ie. no query string).

Here's an example of your links working properly:
http://www.redfoxdeals.com/store/cat...chant_id=40892

Regarding a gap, you could try changing this:
PHP Code:

            $html .= '<img src="'.$logo_url.'" alt="'.$v->merchant.'" width="150" height="40" />'

To this:
PHP Code:

            $html .= '<img src="'.$logo_url.'" alt="'.$v->merchant.'" width="150" height="40" style="display:block;margin:10px;" />'

Eric

redfoxdeals November 18th, 2013 06:33 PM

OK, almost all fixed. I see that your link for the merchant logo worked and brought me to the merchant page, but I am not sure how to get that url set up so that it works for me? Where are the urls being created?
Thanks!

Eric November 18th, 2013 08:40 PM

Hi,

I got the URL by clicking the merchant's logo in the sidebar.

Eric

redfoxdeals November 19th, 2013 02:29 PM

I'm still a touch confused, when I click on a merchant logo on my sidebar it goes to this URL
http://www.redfoxdeals.com/?merchant_id=37220
Which does nothing.
Is it actually working properly for you when you click on a logo?
Thanks

Eric November 19th, 2013 03:27 PM

Hi,

That URL is a filter for your Store's Front Page. However, you don't have a Product list module in your Front Page view therefore no products will appear there.

If you want to have a filter for your Store's Front Page, add a Product List module to the store's front page and set it to "Allow override".

Eric

benjaffer September 17th, 2014 07:30 AM

With that code above, suppose I want to use a slider instead of a sidebar widget. Is it possible?

Eric September 17th, 2014 08:33 AM

Quote:

Originally Posted by benjaffer (Post 50708)
With that code above, suppose I want to use a slider instead of a sidebar widget. Is it possible?

It's probably possible but you'll have to code that yourself. It's beyond the level of support we're able to provide.

Eric


All times are GMT -5. The time now is 06:03 PM.

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