Jun.09

An Affiliate Website Anyone Can Build


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)

How To & Tips
Share this Story:
  • facebook
  • twitter
  • gplus

Comments(63)

  1. Shawn Collins
    2005 days ago

    Two important questions – do you have a leg lamp and why no Facebook commenting on this blog?

    • Eric Nagel
      2005 days ago

      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.

      • Shawn Collins
        2005 days ago

        I’ve been considering Facebook comments – it would stink to lose current comments, but I figure most posts don’t get comments after a week or so anyway.

  2. Logan Thompson
    2005 days ago

    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
      2005 days ago

      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
      2005 days ago

      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
    2005 days ago

    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
      2005 days ago

      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
    2005 days ago

    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
    2005 days ago

    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
    2005 days ago

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

  7. Chris Guthrie
    2005 days ago

    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
      2004 days ago

      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
    2000 days ago

    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
      2000 days ago

      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
    1985 days ago

    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
      1984 days ago

      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
    1977 days ago

    Sexy leg lamp. It’s funny.

  11. Hugo
    1970 days ago

    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. Trisha Lyn Fawver
    1874 days ago

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

  13. Bolts
    1823 days ago

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

    • Eric Nagel
      1823 days ago

      I was thinking about that, but really wanted to focus on the Leg Lamp. I’ve added a few other things this year, and may expand again next season.

  14. Elwood
    1775 days ago

    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
      1775 days ago

      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
        1775 days ago

        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
    1768 days ago

    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. Trackback: 3 Articles Worthy of Affiliate Marketer’s Attention « Affiliate Marketing Blog by Geno Prussakov

  17. Austin
    1704 days ago

    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
      1703 days ago

      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.

      • Austin
        1703 days ago

        Thanks for the reply. I’m going to give it a shot for the next product I choose to promote.

        Thanks!

  18. Sean
    1642 days ago

    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

    • Eric Nagel
      1642 days ago

      Hi Sean,

      Sorry, but I’ve never used an Amazon Associates Plugin.

      Don’t be afraid to try this out… it’s the only way to learn new things.

  19. Sean
    1641 days ago

    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
      1641 days ago

      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

  20. Sean
    1640 days ago

    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
      1639 days ago

      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>
      
  21. Sean
    1639 days ago

    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

    • Mark Gubarenko
      1451 days ago

      Hi!
      i have the same error as you, with “unexpected”, how did you work through??

  22. Sean
    1637 days ago

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

  23. Eric Nagel
    1636 days ago

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

  24. Matt
    1586 days ago

    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!

    • Eric Nagel
      1586 days ago

      Make sure you copy the code for addtocart.php and upload this file to the root of your site (asseenontvmarket.net/addtocart.php)

  25. Crystal
    1553 days ago

    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!

  26. Sean
    1495 days ago

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

  27. Earl
    1462 days ago

    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.

    • Eric Nagel
      1458 days ago

      If you see a blank page, you’re getting an error somewhere. Turn on your error display, or look at your server PHP error log.

  28. Earl
    1462 days ago

    Sorry I meant this code

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

  29. mimi
    1452 days ago

    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 πŸ˜‰

    • Eric Nagel
      1451 days ago

      you can control what’s in the sidebar via widgets: /wp-admin/widgets.php

  30. Mark Gubarenko
    1452 days ago

    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.

    • Eric Nagel
      1451 days ago

      Mark – your line 48 will be different than mine, due to some changes I’ve made. Email it to me eric@ericnagel.com and I’ll take a look for you.

  31. Josef Reisz
    1447 days ago

    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

  32. george
    1360 days ago

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

    • Eric Nagel
      1357 days ago

      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.

  33. Josef Reisz
    1350 days ago

    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
      1349 days ago

      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

  34. David Neff
    621 days ago

    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?

    • Eric Nagel
      621 days ago

      Hi David,

      Yep! Still making commissions on Leg Lamps, every month! Each year I tell myself I’m going to freshen up the site in Q3, but never get around to it, but it’s doing well

      • David Neff
        621 days ago

        Awesome to hear you are making commissions on the site πŸ™‚ Almost seemed to niche to me, but the more I think about, everybody needs a leg lamp!

        Here’s ours…. https://instagram.com/p/iWtb_IyJwl/?taken-by=thephototipster

        P.S. Nice choice with Elegant Themes. I use their themes on my sites too.

Leave a comment

Comment