View Single Post
  #3  
Old January 30th, 2012, 08:57 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Here's how you can use a function to use 2 different IDs for the same network.

In your views where you have a "Buy" button, use the following HTML to link to the merchant's page:

HTML Code:
<a href="<?php echo dfr_url_sub($product); ?>" title="[product.name]" target="_blank" rel="nofollow">[product.name]</a>
Add the following function to your theme's functions.php file. Be sure to make the 2 substitutions as mentioned in the 2 comments.
PHP Code:
function dfr_url_sub($product) {
    
    
// Change to match your TradeDouble UK affiliate ID
    
$tradedoubler_uk_affiliate_id '12345';
    
    
// Change to match your TradeDouble Denmark affiliate ID
    
$tradedoubler_dk_affiliate_id '67890';
    
    if (
$product->net_id == 40) {
        
$url str_replace($tradedoubler_dk_affiliate_id$tradedoubler_uk_affiliate_id$product->url);
    } else {
        
$url $product->url;
    }
    return 
$url;

If your affiliate ID here The Factory > Your Store > Store menu > Affiliate ID's & Tracking Parameters > Tradedoubler is set to your UK ID, change it to your Denmark ID.

Now all of the URLs to the merchant's site will have the correct affiliate ID. The only downside is your affiliate URLs aren't cloaked.

Eric