Tuesday, August 26, 2008
Automate Product Feed Updates
I've got a couple of product feed based sites which run from the feed files which most UK affiliate networks provide. I've had sites like this for ages, and they frequently become out of date because I'd forget to update the product feed. I knew that the smart thing to do would be to automate the whole process, but I was too lazy to find out how to do it, although the truth is once you work it out, it allows you to be even lazier because you don't need to worry at all about keeping your sites up to date - it just happens and your sites are always lovely and fresh.
Now, I daresay every other affiliate has all this sorted already, but it took me a long time to get round to it and I didn't see any clear guide online so if it's something you want to set up and haven't done it yet, here's how I did it.
First you need to have an affiliate site that runs off a product feed download, such as a csv or XML file. When you normally download the product feed, it's usually possible to get hold of the URL required to download the feed directly without logging in - Affiliate Window, Buy.at and Affiliate Future certainly provide this. Make a note of this URL because you will need it later.
Now, I suggest you go and get hold of this command line downloader - scroll down the page to find File Downloader. Once you have downloaded and extracted it, you will have a few files including one called download.exe. This is the really useful bit and to make this file easily accessible to the batch file we're about to make, I just copied and pasted that into the /%windows%/system32 folder.
Now we have the downloader bit sorted, we can begin creating the script which will use it to download the product feed file and automatically upload it to your webspace.
Open up Notepad and enter this text, replacing the text in red with the right text for you.
download "http://URLOFPRODFUCTFEED" /notime /overwrite /output:"c:\program files\downloader\NAMEOFPRODUCTFEEDFILE.csv"
@echo off
echo open FTPSERVERNAME 21 > z
echo USERNAME>> z
echo PASSWORD>> z
echo BINARY >> z
echo cd data >> z
echo put "c:\program files\downloader\NAMEOFPRODUCTFEEDFILE.csv" >> z
echo quit >> z
ftp -i -s:z
cls
exit
You will notice that I have the line "echo cd data >> z". That is basically navigating into a directory called data in my webspace , which is where I want to upload the file to. If you put your file in the root of the webspace, you don't need that line. If you put it in a directory of another name, you would need to change it. Sometimes it's useful to fo through the steps manually from the command line using FTP just to make sure you have it all down right.
Using the File->Save As menu in notepad, save this file with the filename of something like "uploadfeed.bat" and change the "save as file type drop down from text files to "All Files" - that's quite an important bit, otherwise it will just save your script as a text file that doesn't execute when you double click it.
With that all done, you should be able to double click the saved file and watch it execute the successful download and upload of your product feed.
To automate this process, you need to look at creating a scheduled task, which you setup using the wizard in Control Panel, which has been renamed Task Scheduler in Vista. Here's a Microsoft guide to creating a scheduled task.
Usual disclaimers apply with all this: use at your own risk, and remember to test the site after to make sure the feed has successfully gone up. Sometimes people make unnannounced changes to feed formats so you can't completely forget it and still need to check your sites occasionally.
Since I started using this method, it's been a great relief to know my sites are now being updated regularly with no input from me and I wish I had bothered to learn this years ago. There might well be better ways to do all this though, so if you know one, please share in the comments..
Now, I daresay every other affiliate has all this sorted already, but it took me a long time to get round to it and I didn't see any clear guide online so if it's something you want to set up and haven't done it yet, here's how I did it.
First you need to have an affiliate site that runs off a product feed download, such as a csv or XML file. When you normally download the product feed, it's usually possible to get hold of the URL required to download the feed directly without logging in - Affiliate Window, Buy.at and Affiliate Future certainly provide this. Make a note of this URL because you will need it later.
Now, I suggest you go and get hold of this command line downloader - scroll down the page to find File Downloader. Once you have downloaded and extracted it, you will have a few files including one called download.exe. This is the really useful bit and to make this file easily accessible to the batch file we're about to make, I just copied and pasted that into the /%windows%/system32 folder.
Now we have the downloader bit sorted, we can begin creating the script which will use it to download the product feed file and automatically upload it to your webspace.
Open up Notepad and enter this text, replacing the text in red with the right text for you.
download "http://URLOFPRODFUCTFEED" /notime /overwrite /output:"c:\program files\downloader\NAMEOFPRODUCTFEEDFILE.csv"
@echo off
echo open FTPSERVERNAME 21 > z
echo USERNAME>> z
echo PASSWORD>> z
echo BINARY >> z
echo cd data >> z
echo put "c:\program files\downloader\NAMEOFPRODUCTFEEDFILE.csv" >> z
echo quit >> z
ftp -i -s:z
cls
exit
You will notice that I have the line "echo cd data >> z". That is basically navigating into a directory called data in my webspace , which is where I want to upload the file to. If you put your file in the root of the webspace, you don't need that line. If you put it in a directory of another name, you would need to change it. Sometimes it's useful to fo through the steps manually from the command line using FTP just to make sure you have it all down right.
Using the File->Save As menu in notepad, save this file with the filename of something like "uploadfeed.bat" and change the "save as file type drop down from text files to "All Files" - that's quite an important bit, otherwise it will just save your script as a text file that doesn't execute when you double click it.
With that all done, you should be able to double click the saved file and watch it execute the successful download and upload of your product feed.
To automate this process, you need to look at creating a scheduled task, which you setup using the wizard in Control Panel, which has been renamed Task Scheduler in Vista. Here's a Microsoft guide to creating a scheduled task.
Usual disclaimers apply with all this: use at your own risk, and remember to test the site after to make sure the feed has successfully gone up. Sometimes people make unnannounced changes to feed formats so you can't completely forget it and still need to check your sites occasionally.
Since I started using this method, it's been a great relief to know my sites are now being updated regularly with no input from me and I wish I had bothered to learn this years ago. There might well be better ways to do all this though, so if you know one, please share in the comments..
Subscribe to Posts [Atom]









