Datafeedr Support Forums

Datafeedr Support Forums (/index.php)
-   Questions (/forumdisplay.php?f=67)
-   -   List Merchant Logos (/showthread.php?t=4680)

bravecreative June 17th, 2011 04:02 AM

List Merchant Logos
 
1 Attachment(s)
Hello,

I have setup my Datafeedr to use the merchant logo directory.

How can I list my Merchant's logos like this: (see attached)

Obviously clicking through to the correct category which lists products just by those merchants?

bravecreative June 17th, 2011 04:33 AM

I forgot to add - I tried Eric's code on previous posts and this DOES work BUT the URL needs to go to a category like page showing products just from that particular Merchant.

Eric June 17th, 2011 09:03 AM

THREAD MOVED TO CORRECT FORUM.

Eric June 17th, 2011 09:05 AM

Quote:

Originally Posted by bravecreative (Post 21580)
I forgot to add - I tried Eric's code on previous posts and this DOES work BUT the URL needs to go to a category like page showing products just from that particular Merchant.

Can you please provide the link to that post that DOES work. It might be possible just to modify the code slightly but I don't know what code you are talking about.

bravecreative June 17th, 2011 09:21 AM

Hi Eric,

The code is:
PHP Code:

function dfr_get_merchants() {
    global 
$wpdb;
    
$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;
    }
    return 
$list;


And parsed via:

PHP Code:

$merchants str_replace(array("",""), array("",""), datafeedr_tag("Merchant logos"));
echo 
$merchants

It displays text links as the merchant logos do not appear also for some reason, but the link throughs do nothing other than stay on the homepage - I need them to link to a page which lists products by the selected merchant.

Eric June 17th, 2011 10:43 AM

Hi

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() {
    global 
$wpdb;
    
$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;
    }
    return 
$list;


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:

<?php
$merchants 
dfr_get_merchants();
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?>" />
  </a>
<?php
}
?>

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.)



Eric

bravecreative June 20th, 2011 03:53 AM

Thanks Eric, I have given this a go - but the click through's seem to do nothing at all other than refresh the home page?

See: http://www.samsungtvhd.co.uk/

Eric June 20th, 2011 08:31 AM

Hi

That's because you have not done step #3 correctly.

Eric

bravecreative June 20th, 2011 08:42 AM

This is my code to display the logos:
PHP Code:

        <div id="merchants">
        
            <h2>Samsung TV Merchants</h2>
            <?php 
            $merchants 
str_replace(array("",""), array("",""), datafeedr_tag("merchantlogos"));
            echo 
$merchants
            
?>         
            <div class="clear"></div>    
        </div> <!--! end of #merchants -->

This is now showing nothing at all.

bravecreative June 20th, 2011 09:00 AM

Do you want FTP + Factory access? May make life a bit easier..

Eric June 20th, 2011 09:09 AM

Hi

I have factory access ;)

I see you have the "merchantlogos" view as a Widget. But did you configure that widget to appear in your sidebar (Appearance > Widgets)?

Also, you did not add the word "view" to the Custom CSS ID field for your "merchants" View Properties. That is causing the layout to be messed up. (Please see step #4)

Eric

bravecreative June 20th, 2011 09:28 AM

My WordPress theme does not support widgets - So I am manually calling that snippet.

What has the CSS ID got to do with that? I am using my own custom styles in my themes css file so I haven't got to styling the products as of yet because the functionality does not work.

Do you want to go in and have a play?

Eric June 20th, 2011 09:38 AM

Hi

How are you calling the snippet?

The CSS ID will format your page so it doesn't look like this: http://www.samsungtvhd.co.uk/store/m...ant=John+Lewis

Eric

bravecreative June 20th, 2011 09:42 AM

It is just calling the datafeedr tag.

index.php
PHP Code:


        <div id="merchants">
        
            <h2>Samsung TV Merchants</h2>
            <?php 
            $merchants 
str_replace(array("",""), array("",""), datafeedr_tag("merchantlogos"));
            echo 
$merchants
            
?>         
            <div class="clear"></div>    
        </div> <!--! end of #merchants -->

functions.php
PHP Code:

function dfr_get_merchants() {
    global 
$wpdb;
    
$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;
    }
    return 
$list;


All coming from the Widget code in Factory

Before I used a different code and it actually showed the logo's - I also notice in your URL there you have /store/ and that seems to work like a charm.

The code you have provided does not add this?

Eric June 20th, 2011 09:53 AM

Hi

The problem is that you need to call a widget via the datafeedr_tag() like this:
PHP Code:

datafeedr_tag("widget/merchantlogos"

You should just be able to do this:
HTML Code:

<div id="merchants">
        <h2>Samsung TV Merchants</h2>
        <?php echo datafeedr_tag("widget/merchantlogos"); ?>       
        <div class="clear"></div>   
</div>
<!--! end of #merchants -->

Eric

bravecreative June 21st, 2011 03:39 AM

Thanks Eric - all working now.

TheFerryman June 27th, 2011 02:32 AM

Thanks, Eric, this works well, however, there are only merchant logos for about half the UK merchants. I think I read elsewhere that you are working on them when you have time, do you have any time scale on when they will all be available?

I know I could make them myself, but I am struggling for time as well. :)

Thanks.

Bruce

stefan June 27th, 2011 03:09 AM

Quote:

Originally Posted by omnialgroup (Post 21763)
do you have any time scale on when they will all be available?

There is no time scale on when all logos will be available.

Just let us know the merchants you want logos for and I'll add those asap.

Please use the Networks & Merchants forum to request logos.

/forumdisplay.php?f=13

paula_bulakova June 28th, 2011 01:35 AM

Name of the Merchant
 
Hi Eric

Thanks for a great tutorial. I am a total newbie and therefore it is great for me that you provide the detailed steps and pictures as well.

I have a question about Merchant Logos. I have followed your tutorial described in the above posts and displayed merchant logos on my homepage so visitors can click on particular merchant. After click they will get on a page with the product list of the particular merchant.

Now my questions are:
1. how can I display the name of the selected merchant on the top of the page (so the visitor knows where he is)
2. where can I update layout of the product list (currently it's 2 column layout and i want to change it to Template 3 - 1 column layout)

If you need to have a look on my website go to http://www.bestfrenchcuffshirts.com


Thank you in advance for your answers.

Eric June 28th, 2011 08:47 AM

Hi

To display the merchant name, you could add something like this to a Text module on that page:
PHP Code:

<?php echo strip_tags($_GET['merchant']); ?>

To change the layout, go to VIEWS > CUSTOM VIEWS > merchants and edit the Product list module. You want to replace the Product list code that's already there with Template 3 code.

Eric


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

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