If you have come to this post looking for an easy, straightforward way to get products from Magento to WordPress e-commerce, this is not for you. If you don’t mind digging around in databases and unclear directions, then welcome, sorry for the mess, have a seat (just shoo off the cat there – oh, is that a hairball? let me get you a new cushion).
I had a tiny shop in Magento Community 18.104.22.168 (because I was too scared to update it, that’s why) but decided to move it all to WordPress using the WP e-Commerce plugin. Even though the shop is quite small, I didn’t want to have to put in every product by hand. So here’s what I did… (nb: as these weren’t large tables and I didn’t know what I was doing, I decided to dump the whole table and edit down to what I needed in Excel. You might want to do it properly. You might not. Also, I’m setting up WordPress on another server, so don’t have both of these installed on one.)
- In Magento: export the catalog_product_flat_1 table to a csv file
- Neaten up a version of csv file so you have the columns: Description, Additional Description, Product Name, Price, SKU, weight, weight unit, stock quantity, is limited quantity
- Save another version keeping at least the name and the relative image path intact (this is used for the images, as might be obvious)
- In the “import” tab of the plugin, import the file
Easy peasy, lemon squeezy. Except, of course, where are the images? They are nowhere. They are not there. Bastards. So here’s where it gets a little dodgy and you’ll have to use these following directions as a guide.
- Find your images in Magento and download them. You can figure out their path using the catalog_product_rule_flat_1 table
- In WordPress admin, upload them into the media library. Have a cup of coffee.
- You need to know the post ids of the product posts and the post ids of the image posts (attachment paths are saved as posts when uploaded) – go into wp_posts and export those.
At this point it gets a little fuzzy, so I’m going to stop numbering the steps. This is all step 5.
The table wp_postmeta is where the linking of the image to the post happens –
insert into wp_postmeta (post_id, meta_key, meta_value) VALUES (18,’_thumbnail_id’,29);
I think I put the post ids on my copy of the Magento table with the image paths (edited down to filenames) then used the image filename – the same(ish – enough) in both the Magento table and the WP table – to match up the image post ids to the product post ids. That might not make a lot of sense but you should be able to look at what you have and figure out how to get everything together. I then simply wrote my statements in Excel:
=CONCATENATE(A18, “VALUES (“,B18,”,’_thumbnail_id’,”,C18,”);”)
where: A18 = insert into wp_postmeta( ; B18 = the product post id ; C18 = the corresponding image post id
and slapped them into the table.
This only gives one image per product but that’s fine for me.