Datafeedr Support Forums

Datafeedr Support Forums (/index.php)
-   Questions (/forumdisplay.php?f=67)
-   -   Merchants and offers page (/showthread.php?t=4282)

Nugerama April 4th, 2011 12:18 PM

Merchants and offers page
 
Hi Eric, in my original designs that I put together for my client before discovering datafeedr I included a 'Stores and Offers' page. Now I've had a look at the way to deal with coupons via Affiliate Window and there isn't currently any relevant offers so I'd like really just to create a page that lists my merchants and links to categories displaying their products. The important thing though is that I'd ideally like this to update automatically when my client links up with a new merchant.

Is there any function already built in that might help me achieve this?

Many thanks
Kev

Eric April 4th, 2011 12:19 PM

THREAD MOVED TO 'QUESTIONS' FORUM.

Eric April 4th, 2011 12:24 PM

Hi

Yes, you can create a Custom View (which is its own page), add the code I mentioned here and then set up the links that you need.

This docs page might also be of help: http://www.datafeedr.com/docs/item/173

Eric

Nugerama April 4th, 2011 01:15 PM

Hi Eric, I should have more specific in my post - I wish to display the merchants logos, not just a link. Can Datfeedr get a merchant's logo for me?

Thanks
Kev

Eric April 4th, 2011 01:23 PM

We've provided merchant logos for some of the merchants but not all. But, if a merchant logo is missing, you can add your own to the Merchants Directory on your site (which can be found here: WordPress Admin Area > Tools > Datafeedr > Directories).

Here's more info about that: http://www.datafeedr.com/docs/item/132

[product.merchant_logo] will display the merchant logo in your views.

Eric

Nugerama April 14th, 2011 04:52 PM

Hi Eric, thanks again for your help. I've got to grips with the merchant logos folder and have most of the functionality of the site working now.

I wonder though how I can incorporate the merchant logo shortcode into the following statement that you gave me for ooutputting the stores merchants:

<ul>
<?php
$merchants = dfr_get_merchants();
foreach ($merchants as $merchant) {
$merchant = urlencode($merchant);
?>
<li>
<a href="[server.url type='fullpage' query='merchant=$merchant']"><?php echo urldecode($merchant);?></a>
</li>
<?php } ?>
</ul>

Thanks again
Kev

Eric April 14th, 2011 07:03 PM

Hi

The merchant logo shortcode will not work in that loop. You will have to modify the SQL statement in order to get the merchant_id and then you will have to hardcode something like this:

<img src="http://www.yoursite.com/path/to/merchant/logos/<?php echo $merchant->id; ?>.jpg" />

Eric

Nugerama April 21st, 2011 05:16 AM

Thanks for that Eric, I'll give it a go. In the mean time however I'm still missing a lot of merchant logos: I've followed the instructions and successfully created a directory in siteurl/wp-content/uploads/logos. I know it's working because it pulled in logos from two of my merchants but there's still a lot missing that do have logos available. Why might this be the case?

Many thanks
Kev

Eric April 21st, 2011 06:35 AM

Did you already add the merchant logos to that directory?

Eric April 21st, 2011 07:31 AM

Here's what worked for me:

In your theme's functions.php file, add this:

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;


In a Text Module in a view where you want the logos to appear, add this:

PHP Code:

<?php
$merchants 
dfr_get_merchants();
foreach (
$merchants as $mid => $name) {
?>
  <a href="[server.url type='fullpage' query='merchant=$name']">
    <img src="http://YOURSITE/path/to/logos/<?php echo $mid?>.jpg" alt="<?php echo $name?>" />
  </a>
<?php
}
?>

Make sure you change the img src to the path where your logos can be found.

The only thing that is missing is that that loop above will not download your logos for you. You must add the logos manually to your logos directory.

Merchant logos are automatically downloaded and added to your store when a merchant logo is displayed within the [product.each]...[product.end] loop. If you display your merchant logos on your Category Pages or Product Details pages, then you won't have to manually add the logos to your logo directories.

Eric


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

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