I have been, or can be if you click on a link and make a purchase, compensated via a cash payment, gift, or something else of value for writing this post. Regardless, I only recommend products or services I use personally and believe will be good for my readers.
I 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.
Here’s how the site was created, in about 20 hours
- Buy the domain name. Don’t spend too long here. I like domains that start with “buy” and then add the product name.
- 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.
- 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
- 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:
- title tags
- meta descriptions
- robots.txt
- sitemap
- image sitemap
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)
Comments
Shawn Collins
Two important questions – do you have a leg lamp and why no Facebook commenting on this blog?
Eric Nagel
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
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.
Logan Thompson
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
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
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
Amit
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
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.
noodles
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?
Eric Nagel
I “finished” the site yesterday (although I have to add “About”, “Contact” etc to the site)
No idea on traffic, since it just started.
noodles
looks slick. I’ve had http://shopmlbjerseys.com/ up for 3 months, it gets lots of traffic, yet I’ve only had a few sales.
Eric Nagel
Link the image – also, can you mask/cloak your affiliate links? Right now, it’s clear you’re pointing to Football Fanatics.
Can you add content to your category pages?
http://shopmlbjerseys.com/category/arizona-diamondbacks/
Change “category” to “teams”
I’m giving more feedback like this at my early-morning whiteboarding sessions at Affiliate Summit (yeah, aff. link!)
imagine
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!
Brian Jones
I will be sure to get you that datafeed. So things will run smoothly with little site maintenance on your end.
Chris Guthrie
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
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!
Gerald
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
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.
Josh
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
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
Bayar
Sexy leg lamp. It’s funny.
Hugo
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.
Trisha Lyn Fawver
One of these days I’m going to attempt this…
Bolts
Nice site! Do you have any Scut Farkus t-shirts? Why not expand the catalog to all things Christmas Story?
Eric Nagel
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.
Elwood
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
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
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
Adam
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.
Eric Nagel
Hi Adam – please see my PHP programmer page at http://ericnagel.wpengine.com/php-programmer
Austin
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
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
Thanks for the reply. I’m going to give it a shot for the next product I choose to promote.
Thanks!
Sean
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
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.
Sean
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
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
Sean
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
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:
Sean
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
Hi!
i have the same error as you, with “unexpected”, how did you work through??
Sean
Hi again, I just figured it out! Thanks for all of your help, Eric. MUCH appreciated! – Sean
Eric Nagel
Nice job! If you need anything else, feel free to ask
Matt
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
Make sure you copy the code for addtocart.php and upload this file to the root of your site (asseenontvmarket.net/addtocart.php)
Crystal
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!
Sean
Thanks again for all of your help, Eric. I appreciate the inspiration and help that you provided me with my Amazon affiliate site.
Earl
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
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.
Earl
Sorry I meant this code
<a href="/addtocart.php?nProductID=ID ?>” class=”addto-cart”>
mimi
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
you can control what’s in the sidebar via widgets: /wp-admin/widgets.php
Mark Gubarenko
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
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.
Josef Reisz
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
george
Hello there Eric, nice Job!
Could you tell me how to link the images with aff links when working with datafeed?
Thanks!
Eric Nagel
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.
Josef Reisz
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
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
David Neff
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
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
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.