Convert CSV Data Feeds To Wordpress Posts
Posted on October 29th, 2008 in Wordpress |
Convert your Affiliate product data feeds into wordpress posts, creating perfect posts with Titles, Descriptions, Affiliate Links, Images and Prices. The tool will work with any, yes i said ANY! Affiliate data feeds, but for peace of mind I’ve used it with Commission Junction, Affiliate Future & Affiliate Window.
Installation
1. Unzip the downloaded file upcsv.zip
2. Upload the complete folder /upcsv/ to the following location http://www.yourblog.com/wp-admin/
3. Navigate to http://www.yourblog.com/wp-admin/upcsv/upload.php
4. Done!
Formatting
Every .csv file must contain a Title, Description, Image, Link and Price, formatted as shown below. I’ve used Neo Office to edit the data feed titles, “Title” obviously being the wordpress post title and so on.

Leave the price without the pound sign this is added in by the tool.
Edit the following code in upload.php to change the affiliate link button,
<a href=\”$row[link]\”><img src=\”http://www.matboo.co.uk/buynow.gif\” alt=\”Buy now\” /></a>”;
Download Below
CSV To Wordpress Post (4.01 KB)
Errors
You may come across some errors about file memory size these are usualy solved by removing excess fields from your csv file to decrease the upload size, e.g some affiliate data feeds come with other columns which arent needed like data, time - just delete these.
Your host might not support the file upload size of your data feed, to solve this you could ask for an increase or for example if your uploading 1,000 products cut 500 then repaste into another file and upload, usually this isnt a problem.
Example Post
Here is an example of a product from the data feed converted into a wordpress post.

You are free to edit the code and make modifications but you are not allowed to sell the tool and you must credit us with a link if you are going to release updated versions on your own site
Requirements
PHP 4.*
Wordpress
55 Responses
Really useful little tool in the arsenal.
If people don’t want to publish immediately, then they can comment out the line 38 - publish status and schedule them manually once created.
It might be neat to automate the publishing schedule automatically to randomise according to parameters.
One thing that I can’t get to work is the upload category. Does the category need to be pre-existing or will a slug be automagically created? I have tried both ways and failed.
But great work!!
[...] Free Convert Affiliate Feeds to Wordpress Posts script [...]
I’ve only tried it using category’s set in the .csv file for each post, as far as i know it can use pre-existing ones, make sure the csv file is formatted with commas as separators as shown in the readme
Nice - I’ve been using a paid csv import plugin but this looks easier to use - One question, can it upload tags?
Tags are supported but it would be simple to add. The php is self explanatory really even for newbies, tags are a rubbish anyway hehe!!
lol! I don’t generally use tags, but a couple of my sites use them as an option to search on price.
What is the advantage of this over Zack Preble’s CSV Import: http://www.zackpreble.com/2008/03/28/importing-posts-from-csv-file-into-wordpress/
Does this allow for the creation of custom fields, like Zack’s version?
Mine can post affiliate links, images and basically u can design what the post will look like
oh,great work,thx,I will try it …..:)
I am having the same problem with the categories insertion? I am running wordpress 2.5.1 and no matter what I try in the category field it sets every post inserted to the default category for the site.
I am setting out the datafeeds exactly as above and it works great for everything else but just the category. It would be really great if you could find a work around because I have tried existing categories, new categories, category id’s ect and nothing works?
I checked the database setup as well and post_category seems to take an integer but even changing the integer in the backend doesnt seem to change the category so I think the category fields for the posts must be stored else where.
Anyone have an luck with this and getting categories to work somehow on WP 2.5 and above?
It works on 2.6.1 and 2.6.3, i’ve had no problems with the category, and i have no idea wat could be causing it maybe you have a plugin which is effecting it?
Just a quick thank you for creating a great script. I have just spend an hour editing it fo my site and turning it into a pretty advanced price comparison tool. One thing I did notice is that there was an issue (for me anyway) with the link being pulled through as it was using $row[link] which needs changing to $row[links]. That worked for me anyway.
Thanks again for the great script.
I want to insert tags also , how can i do that.
Title, Description, Category, Image, Link, Price, Tags
Thanks for your time
Hey - first off, I love the script; it’s exactly what I was looking for. Thank you!
I am having one problem, though - for some reason the categories aren’t uploading correctly. I have them listed in the .csv files and in the upload.php file but when I upload everything to my blog, the categories all list as “categorized” still. Any idea why this might be happening and how to fix it?
Thanks!
Thanks for this tool. It really help a newbie like me to experiment. I have the following questions and issues. Hope you can help. Thanks in advance.
1. I am using 2.6.2 and like others, I couldn’t get the category to work. It default to “uncategorized”.
2. I have concern with security. This tool does not look like it is password protected. Anyone who know the path to upload.php can upload junk to my site. I changed the name upload.php to something else for my protection…but not sure if that’s good enough of a solution.
2. Is there a way to concatenate 2 fields for the post’s title or the post’s content? For example, I’d like to combine the title field with the price field to format the post title to say…”Dell laptop for $399.00.
3. Is there a way to get the image hyperlinked? Also, instead of using “click here to buy” image to link, can I use text. For example, “Click here to go to Dell.com”.
1. I have no idea, its worked fine for me, you might have a plugin thats interfering with the category.
2. Deny access to upload.php with .htaccess, so only your ip can use the file.
2a. Of course, you the code is rather simple try editing your self.
3. Check the readme it tells you have to do that.
First of all, this looks like it may well be just what I’ve been looking for … so thanks very much!
I do have a quick question about categories though. I’m looking to use the plugin to display a load of ebooks at the above address. Will the plugin be able to let me break down the books into various categories such as “Sport”, “Politics”, “Autobiographies” etc etc …
Thanks again for your help
Will a post update with new prices/text If a post is submitted again with new data or will it add a new post?
Yes it will check the picture above, i have different category for my different products
# chrisgrr nope sry
I am having the same problem with the categories. I have a clean install of wordpress 2.6.3 without any addition plugins or themes installed. This is exactly what I have been searching for. Has anybody been able to get the categories working?
hi,
great script.
Can a single long post content be split by a few paragraph? or a new line?
how?
Awesome!! Great tool. Any way of making categories and subcategories work?
Hey - I still can’t get the categories to work and I’ve tried everything I can think of. I edited (or tried) your script, and the posting php script from wordpress itself. I tried a csv file with categories that I didn’t previously have and ones I did. and still everything uploads as “uncategorized”. Any thoughts on what I could be doing wrong? Thanks for the help!
I dont know why it isnt working it works fine for me, make sure the fields called Category! maybe ask on the wordpress forum
Hi mate, i have just found this by chance and I have been looking for a long time. I really needed something UK styled and supporting affiliatewindow. The only one I found was datafeedr and they charge monthly.
Will post again if I have success!!
thank you very much for the work and effort.
Awesome affiliate marketing tool… well done there…
[...] Convert CSV Datafeeds to Wordpress Posts - Not actually a plugin, in that you have to navigate to the tool manually in Wordpress, but it will also do the job. [...]
Hi Mat,
When i upload CSV, there is an error message who said :
Warning: Wrong parameter count for fgetcsv() in /…/www/wp-admin/upcsv/upload.php on line 17
Warning: Invalid argument supplied for foreach() in /…/www/wp-admin/upcsv/upload.php on line 23
I verify the csv file and all is ok in, but i can’t verify with the screenshot of your csv file in the post.
Can you help me ?
Fred (from france)
Hello,
I uploaded your script & a csv file & got it mostly working (great tool by the way!).
1 problem is that I want to call the images from the website of the merchant, not to upload them all to my site, but the image is for some reason being called from wp-content/themes/mimbo2.1/images/ even though the correct http://www.etc address is correct in the csv.
How can I fix this please?
PS - suppose I was really, realy dumb & uploaded the wrong affilite links for all 1400 products - how would I delete them so that I could replace them please?
Change
$my_post['post_category'] = prep($row['category']);
to
$my_post['post_category'] = array(prep($row['category']));
I’m sure there is some function that could be used to lookup a category by name but it’s not in there now.
Also note you have to use the term_id & not the name of the category.
Hi There,
Can’t seem to get this working on my site. I get to the page to import the CSV fine, but when I import a file, I wait a few seconds, then nothing happens. There’s no confirmation that the file’s been loaded or anything, and I look in my posts and find that nothing’s been added. Is this happening for other people? I think one of the reasons may be that I’m going to http://www.yourblog.com/default/wp-admin/upcsv/upload.php, since I placed all of my wordpress files under a directory called “default”. Could that be the reason? Your help is much appreciated!!! Thanks, Nick.
What’s this?
Warning: Wrong parameter count for fgetcsv() in /*/upcsv/upload.php on line 17
Warning: Invalid argument supplied for foreach() in /*/upcsv/upload.php on line 23
Hello,
me again!
I think I know why posts aren’t being assigned to categories any more, although I’m not sure how to fix it - I think it is because the script uses post_category which is no longer supported by Wordpress.
I’m sure it would be easy to fix for someone who knows what they’re doin
what does it mean when you get the following error?
Warning: Wrong parameter count for fgetcsv() in /home/content/g/r/a//wp-admin/upcsv/upload.php on line 17/
Great script if I can get it to work.. Thanks
Thank you very much for this great “plugin”!! I´ve a question regarding the character coding. As I am German, the csv-files I am using, contain language specifi characters like “ü” or “ä” and if a text contains one of those characters, the import of csv-data stops at this point. Is it possible to integrate UTF-8 encoding or how could I solve this issue? Thank you very much in advance!
[...] UPCSV plugin is also a similar plugin which is targeted specifically to the merchant datafeeds. The UPCSV [...]
hi! i would like to use with tradedoubler is possible?
Hi, do you know of a way I can set up a cron job to submit a different feed every hour from my host/server, so this can run whilst I’m away?
Chris
Quick question…
I don’t have products, I would just like to upload posts with custom fields. Will this allow for that?
[...] then had to import the CSV. Wordpress v2.7.1 does not come with a built-in CSV import routine, but I found a plugin that installed nicely. After a couple of false starts (my fault), I had [...]
[...] Were still working on a new script, this time it will be the real deal, a proper plugin not just a script, with many more features. Like style settings, custom buttons, cloaked affiliate links etc.. for now you can use the old plugin csv to wordpress [...]
Hi
I really loved this idea, but im having some troubles using it.
I have the upcs folder with 755 permissions
i uploaded a csv file made with cved, all was ok, but after the upload of it, it just dont show nothing unless the same page to upload csv.
What should happen?
I really really like this tool.
PS: can you send or post a test csv file so i can debug if its a problem with my csv file?
Thank you
a great plugin - however, I am absolutely pulling my hair out trying to get the categories to store! - I have triple checked the name of the column in my csv file is called “Catergory” and have used both the ID numbers and names of the category. I have looked at the WP code (wp_insert_post) and it is doing everything it should - apart from inserting or setting the category.
please please please can you help out on this one - I have looked everywhere including the wp support codex and nothing is helping. I find it strange how it works for you - yet so many others it is not.
im on wp 2.7.1 by the way
(and I know you are currently developing a “proper” plugin which I intend to use - but need to get this running now)
whats the ETA on the new plugin?
Really goot tool for affiliate users
Respects to author.
Has ne noe got this working with latest Wordpress version
Any update about the latest plugin you were working?
Thanks man… Does the error below means anything to u. this happened when i click on upload.php
Fatal error: Cannot redeclare prep() (previously declared in E:\domains\r\xxx.com\user\htdocs\in\wp-admin\upcsv\upload.php:10) in E:\domains\r\xxx.com\user\htdocs\in\wp-content\plugins\cforms\lib_aux.php on line 116
How can I put the affilaite link with the image url in excel? This way someone can click on the image and not just the buy button.
Also, is there a way to change the affilaite link in the datafeed to hide it when people mouseover the image or button?
Thanks
V2 has now been released http://www.matboo.co.uk/2009/04/02/csv-to-wordpress-post-v2-released/
i have a csv file with over 146k products and i’m guessing that it’s timing out after 500 or so. Is there any easy way to get all 146k items in without splitting up the csv file into multiple csv files and then importing one by one?
Hello, the default MS Excel delimeters are ; and , and the plugin parses ” and , so it should be nice to change it accourding to excel for convenience. Could you help me with that, please.
Looking through all the import scripts and plugins but your own like many seems to rely on having the right columns.
I found CSV 2 POST and it states that the columns can be in any order and named anything you want. Basically no editing required to import it. I know how these things work so it sounds too goo to be true.
Tempated to buy it however because if it works, wow!
USE THE LATEST PLUGIN GRR