BuyLegLamps.com screenshotI know a lot of my posts are rather technical, but this one is a bit different. I’m going to show you an affiliate website that anyone can build, and walk you through exactly how I did it.

First, you need a niche. I’ve covered this before, How to Choose an Affiliate Offer to Promote. For this site, it was all about a love (some may say obsession) I have with Christmas and the movie, A Christmas Story.

I met with A Christmas Story House at the recent ShareASale ThinkTank, which boosted this project to the top of my list. (Hear that, merchants? When you meet with affiliates face-to-face, you become a priority to them). What resulted from this meeting is Buy Leg Lamps.

BuyLegLamps.com screenshot

Buy Leg Lamps

Here’s how the site was created, in about 20 hours

  1. Buy the domain name. Don’t spend too long here. I like domains that start with “buy” and then add the product name.
  2. Install WordPress, add theme. For this site, I went with eStore by Elegant Themes. For $39 you get access to all their themes. eStore looked like a shopping site, which is what I wanted to do.
  3. Start adding products, manually. Yep… this merchant doesn’t have a datafeed, so I was manually adding products. As I looked over their products, I came up with my own categories on my whiteboard, then I started populating them. It took a while to figure out the image sizes that the theme wanted, but once I knew, I was able to go through the products pretty quick. I have 55 products on the site, from A Christmas Story House and Amazon.com
  4. Add something more than just products. In this case, I added a YouTube video of the trailer from A Christmas Story

Now I’d be lying if I said I didn’t do any custom programming on the site. There are a few things I wanted to change.

As an affiliate, my goal is to get the cookie set. So, I changed the links to go to through the affiliate link, and not the shopping cart links. You’ll notice my links look like: /addtocart.php?nProductID=218. I wanted the user to think they were buying the product at this site! addtocart.php is simple:

<?php
	define('WP_USE_THEMES', true);
	require_once('wp-config.php');

	$cQuery = "select * from wp_postmeta where meta_key='afflink' and post_id=" . (int)$_GET['nProductID'] . " limit 1";
	$oResult = mysql_query($cQuery);
	if ($rsData = mysql_fetch_array($oResult)) {
		header("Location:  " . $rsData['meta_value']);
	} // ends
	else {
		header("Location:  /");
	} // ends else from
?>

I add a custom field to each post called afflink and that’s the affiliate link.

I also added Facebook’s commenting, so when a user comments on a product, the comment is shared on their Facebook page, and shown to their friends. If you’re using eStore, edit /wp-content/themes/eStore/includes/single-product.php and add

<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://www.yourwebsite.com<?= $_SERVER['REDIRECT_URL'] ?>" num_posts="6" width="615"></fb:comments>

Then, do a little SEO on the site:

Finally, showoff your site to other Elegant Themes users in their customization showcase and then start getting your backlinks! (BTW, if you liked this post, I’d appreciate a backlink to my Leg Lamp site)


62 Comments » for An Affiliate Website Anyone Can Build
  1. Two important questions – do you have a leg lamp and why no Facebook commenting on this blog?

    • Eric Nagel says:

      Of course I have a Leg Lamp! It’s only on display during Christmas time, though (Black Friday ’til New Years Eve)

      I’m happy with the commenting in Thesis. I also don’t want to lose my current comments. For new sites, I consider Disqus, Facebook, as they have easy plug-ins.

  2. Great post Eric. Just to play devils advocate, what value does this site have to the end user just out of curiosity? Nice looking site.

    • Eric Nagel says:

      Well, I am pulling in just Leg Lamps, and Leg Lamp products. And reorganizing them.

      Sometimes it’s not about adding value… it’s about getting the cookie set πŸ™‚

    • Eric Nagel says:

      Oh, I thought of another value…

      There are 10 results in the SERPs. Would you, as a merchant, want to be #1 (merchant site), or #1 (merchant site) and #2 (merchant-specific affiliate)?

      Eric

  3. Amit says:

    Nice post.
    Without a datafeed how do you plan to keep the site current. Won’t you have to manually replace/modify products/pricing/availability info.

    Plus the ‘Add to Cart’ button to give the impression that the user is buying from your site can be misleading, from my own experience. Buyers thought they bought from my affiliate site and wd shoot customer service emails/complaints to me. Now I clearly mention ‘Buy from xyz.com’ to avoid the confusion.

    • Eric Nagel says:

      Yeah, when I go to update the site, I’ll probably build a tool to quickly update the prices.

      As for the “Add to Cart” button, I want the user to click & get the cookie set. That’s my goal, as an affiliate. If I say “Buy from xyz.com”, the user could just type into their browser “xyz.com” and I don’t get credit for the sale.

  4. noodles says:

    looks like a great approach. I may redo some of my sites with a similar template. How long has the leg site been up and what kind of traffic / sales are you getting?

  5. imagine says:

    Its awesome when you can sell something that you love with regards to the movie. My brother and I have been watching A Christmas Story every Christmas since before I can remember and a few years ago we met with some of the cast members in downtown Cleveland (im originally from the Cleveland area) and also visited the house where they took the exterior shots of it in the movie.

    Thanks for sharing about your site!

  6. Brian Jones says:

    I will be sure to get you that datafeed. So things will run smoothly with little site maintenance on your end.

  7. Hey Eric,

    It’s so cool that you wrote this post because I actually have an epically awesome podcast interview coming up with that guy who bought the A Christmas Story house and he talks about how he slowly built his business from his apartment and how he found the house on eBay and decided to buy it to try and build up his business etc. etc.

    Don’t mean to go all self promotional on you lol but I absolutely love A Christmas Story and Christmas Vaction so I tracked the guy down to interview him. I’ll let you know when it’s up and as always great post dude. I love the actionable tips.

    • Eric Nagel says:

      Hey Chris – yeah, that’d be Brian (commented above). I was star-struck when I met him (he probably didn’t know that). Having visited the house myself, it was great meeting him.

      Can’t wait to hear your podcast!

  8. Gerald says:

    Hey Eric, i saw earlier that you add a custom field called “afflink”.
    Well, i installed a plugin called “Affiliate Link Cookie Maker” and i think it does what you are describing above, and maybe you are using this plugin? Thing is i just can’t get it to work, i’m not tech savvy but it sounds like the same thing you are talking about, but i still can’t get it right. Was wondering if you could explain the it a bit more in the most simplistic way possible πŸ™‚

    • Eric Nagel says:

      Hi Gerald,

      No, I’m not using that plugin. What I did was create a new file, addtocart.php (code above) which pulls the value of “afflink” from the postID that’s passed to it.

      Try creating a post with an afflink value, then use the addtocart.php script I’ve given.

      The preg_match line is just because I was lazy, and didn’t want to keep generating deeplinks, so this takes care of it for me.

  9. Josh says:

    Any other modifications that need to be changed before creating the addtocart.php? I’ve been trying to get my eStore theme to work like yours by using an affiliate link instead of the cart, but nothing is working. Can you post any other modifications and edits to the theme?

    Thanks!

    • Eric Nagel says:

      Hey Josh –

      The theme needs to be changed to link to addtocart
      /wp-content/themes/eStore/includes/single-product.php

      If you email me your site, I’ll take a look at it

  10. Bayar says:

    Sexy leg lamp. It’s funny.

  11. Hugo says:

    Thanks a bunch for sharing that piece of code, awesome!

    By the way; your affiliate website looks so much more appealing than the actual site from the merchant (oops!) They should do a redesign, I bet they can increase conversions on their end quite a bit.

  12. One of these days I’m going to attempt this…

  13. Bolts says:

    Nice site! Do you have any Scut Farkus t-shirts? Why not expand the catalog to all things Christmas Story?

  14. Elwood says:

    Nice walk through!

    I have a question regarding one of my sites that I have using the elegant theme e-store. I have a feed setup from amazon to update the reviews and prices. It updates in its on custom field called amzn_LowestNewPrice, do you know how I have that copy into the e-store price custom field?

    • Eric Nagel says:

      Personally, I’d write a cron that updates the estore custom field with the amzn_LowestNewPrice value. Or have it done each time the product page is called. Or update the eStore template to use amzn_LowestNewPrice. You have a few choices – what you choose depends on how often the prices change, and how much traffic the site gets.

      • Elwood says:

        Hi Eric,

        Thanks so much for your reply.
        The changes wont be very frequent, maybe every couple of weeks if that. The custom cron function seems like a good idea but I think this may be beyond by level of expertise πŸ™‚

        Cheers

  15. Adam says:

    Would it be possible to get some help setting up the php code you have on my site? I’m not exactly sure where to enter my shareasale affiliate code and product ID. I’d greatly appreciate it if you could help me out.

    Thanks,

    Adam.

  16. Austin says:

    This is awesome. I have been pretty disapointed with the various Amazon affiliate store fronts that I’ve tried and found your site in the Elegant Themes forum. It’s nice to have such a different looking theme as an affiliate store vs. all of the same same type sites out there using the same store builder scripts and themes.

    Quick question for you… how are sales going? Are you converting a lot of buyers? I have been an Amazon affiliate for quite some time now and the majority of my success is when referring people through text links. I get very few cookies set from people clicking “add to cart” and conversion rates on actual sales are terrible compared to test links.

    If you’d be willing to share how things are going that’d be great.

    Thanks for posting exactly how to turn the theme into an affiliate theme. It’s awesome!

    Take care,

    Austin

    • Eric Nagel says:

      Hi Austin –

      Sales were great around Christmas, as expected, but have slowed down. Honestly, I’ve ignored the site, but have it on my calendar to get back on it Sept-1.

  17. Sean says:

    Hi Eric,

    I’m wondering whether you would recommend the WordPress Amazon-Associate Plug-in with your E-Store site.

    Also, are their plug-ins that automate the coding that you wrote above?

    I am a newbie to all of this, so even your coding above is intimidating. πŸ™‚

    Thanks!

    Sean

  18. Sean says:

    Thank you, Eric! I took your advise to heart and am delving into your code – the first I’ve ever worked with.

    – Fortunately, I was able to figure out how to add the Facebook commenting code to my single-product.php code. It looks great and I really appreciate that lead.
    – I love how some of your Add To Cart buttons are linked directly to the Amazon product page. Did you add the addtocart.php to the single-product.php code? Also, I’m not sure how I would replace your http://www.shareasale.com and other personalized data with my Amazon data.
    – Can you share the ‘afflink’ field code that you added to each post? Did you just post that in the product description field?

    If this is too much to ask, then I understand. All of your information above has given me hope that personalizing my dream site is within my scope of ability… with sweat and tears. I really appreciate your generous sharing already. – Sean

    • Eric Nagel says:

      OK – I simplified my addtocart.php code above. The other thing you need to do is add a custom field to your WordPress posts.

      When you’re editing a post, in the upper-right there’s a button called “Screen Options” – click that, and make sure “Custom Fields” is enabled. Now, scroll down and find the Custom Fields box. The name of your new custom field should be afflink and the value should be your affiliate link

  19. Sean says:

    Thank you! I now have the afflink fields in my posts.

    I tried inserting the addtocart.php code it into many points of the single-product.php template, but to no avail. Which template does the addtocart.php code fit into? And which part of the template?

    I’ll definitely be referring people to you as a paid consultant for their projects now. Thanks again. πŸ™‚

    • Eric Nagel says:

      Sorry this wasn’t clearer… addtocart.php is a NEW FILE that you have to create. Just copy the code above, paste into a new file, then upload to your server.

      Then you edit single-product.php to point to addtocart.php:

      <a href="/addtocart.php?nProductID=<?= $post->ID ?>" class="addto-cart"><span><?php _e('Add to cart','eStore'); ?></span></a>
      
  20. Sean says:

    You’ve helped me come a long way, Eric! I’m so close I can taste it. πŸ™‚

    – I created the addtocart.php file using the exact code that you posted above and uploaded it using cPanel (in Web Hosting Hub) to the public_html “wp-includes” folder.

    – I copied your new code (from above) and pasted it over the following code in the single-product.php file:

    – I entered an Amazon’s Associates product page link into the afflink field into my post.

    – The result? The content of the post is replaced with the following: Parse error: syntax error, unexpected ‘=’, expecting ‘,’ or ‘;’ in home/dharma12/public_html/wp-content/themes/eStore/includes/single-product.php on line 48

    – I played around with the single-product.php addtocart code that you supplied this morning, which seemed to help, but I could never bring back the nice green Add To Cart button. I kept accidentally replacing the green button with a written link ($post-rel=”nofollow”>ID ?>” class=”addto-cart”>Add to cart), but that link sent me to an error page stating the following: The requested URL /addtocart.php?nProductID= was not found on this server.

    I love how your leglamp website works; I’m just trying to figure out how to make the Add To Cart button so clean as yours. Any suggestions would be MUCH appreciated! πŸ™‚
    Your protege,
    Sean

  21. Sean says:

    Hi again, I just figured it out! Thanks for all of your help, Eric. MUCH appreciated! – Sean

  22. Eric Nagel says:

    Nice job! If you need anything else, feel free to ask

  23. Matt says:

    Your code is pulling the proper post ID but when add to cart is clicked I always get “nothing found for Addtocart.php?nProductID=1” (for example)

    meta afflink is being used. Check out the code on http://asseenontmarket.net for great justice.

    Cheers in advance!

  24. Crystal says:

    Thank you! My website has been getting traffic, and I was looking for a way to use estore as my affiliate store instead of just a blog trying to look like one. You’ve laid it out nicely! Thank you sooooooooooooooooo much!

  25. Sean says:

    Thanks again for all of your help, Eric. I appreciate the inspiration and help that you provided me with my Amazon affiliate site.

  26. Earl says:

    Hi Erik! Thanks for the Tips. I got a problem when I edit the single-page.php using the follow code

    <a href="/addtocart.php?nProductID=ID ?>” class=”addto-cart”>

    After publishing the post it becomes a blank content page. Please help. Thank you.

  27. Earl says:

    Sorry I meant this code

    <a href="/addtocart.php?nProductID=ID ?>” class=”addto-cart”>

  28. mimi says:

    That’s really cool, thanks for the info you have shared!
    I also am in the process of using the estore theme and was wondering how you managed to change the sidebar (where you put ebay listings and the video)?
    I’m a beginner and would love to change mine too πŸ˜‰

  29. Hi!
    I’ve tried to do everything as written, i’ve added addtocart.php to root folder, added afflink as custom field, but when i try open product it shows this

    Parse error: syntax error, unexpected ‘=’, expecting ‘,’ or ‘;’ in /home/content/14/8196014/html/analogplanet/wp-content/themes/eStore/includes/single-product.php on line 48

    Can you look at analogplanet.ru
    there’s just one product as we speak.

  30. Josef Reisz says:

    Just stumbled over this great tutorial! I’ll be testing this setup with a website I’ve run for about a year now. Not knowing exactly how to monetize it. Now I know. πŸ˜‰ THX

  31. george says:

    Hello there Eric, nice Job!
    Could you tell me how to link the images with aff links when working with datafeed?
    Thanks!

    • Eric Nagel says:

      Hi George,

      In this particular case, I’m just linking the image to /addtocart.php?nProductID=13. Add this to eStore/includes/single-product.php

      <a href="/addtocart.php?nProductID=<?= $post- rel="nofollow">ID ?>">

      Before
      <img itemprop="image" src="<?php echo($custom["thumbs"][$i]); ?>" alt="<?php the_title(); ?>" />

      It may be slightly different, as I’ve altered my theme a bit since the original download.

  32. Josef Reisz says:

    Alright, testing this on this website:
    http://www.luftpumpen.de/test

    However, I can’t get the “Add to Cart” Button work with the afflink. It returns an empty page.

    I created the addtocart.php and put it in the root. Then I made the changes in the single.php file.

    What am I missing?

    • Eric Nagel says:

      An empty page means PHP errors are being suppressed. Either log your errors, or display them, to see what’s going on. echo(), print_r(), and exit() are your debugging friends

  33. David Neff says:

    I attended last year’s Share A Sale event as an affiliate and I totally agree with you about meeting face to face with merchant’s. I have several ideas for niche sites to promote products from some of the vendors that took the time to explain their merchant programs and showed an interest in what I do. They are at the top of my list.
    Out of curiosity, is the Leg Lamp site making any commissions at this point?

1 Pings/Trackbacks for "An Affiliate Website Anyone Can Build"
  1. […] type posts on how to build WordPress-based affiliate sites (e.g.: see this post by Joe Sousa, and this one by Eric Nagel), the above-quoted jewel fromΒ Joost de Valk is a must-bookmark for every affiliate. I don’t […]

Leave a Reply

Your email address will not be published. Required fields are marked *

*