Home » Portfolio » WordPress eCommerce Data Feeder

WordPress eCommerce Data Feeder is a plugin for WordPress eCommerce (WPEC) that allows you to integrate your eCommerce store into an existing back end system.  This is an ideal solution if you already have an inventory system to manage your products.  It has the ability to import data from SQL or CSV.  It also has the ability to send data or export data to a SQL system or allow you to download data in either  CSV format.  This plugin is for the WPEC 3.8 version and is still in development.

Beta is now available for download. Please post any bugs back here.

Download Ecommerce Feeder form https://github.com/analogrithems/ecommerce_feeder

While WordPress works with only MySQL this plugin makes use of PDO and supports connecting to any type of database that your PHP install supports.  This plugin tries to harness the full power of WPEC and offer you the ability to import or export most types of data including

  • Customers Accounts
  • Order History
  • Products
  • Product Categories

This is done in the hopes that it should make it easy for owners of existing eCommerce solutions to migrate to WPEC.  Though this plugin makes it easy to bring data in and out of WPEC, it does require some understanding of how the data is stored.  I will make a best effort to post recipes for connecting to various back end systems but obviously it would be impossible to support them all.  I am however available for contracting to create the need SQL recipes.

Requirements: Note, this plugin has only been tested with the following configuration.  Also as this is by running environment I can’t help you outside this setup.

  • WordPress 3.1
  • WordPress eCommerce 3.8
  • Apache 2.2
  • PHP 5.3

SQL Importing

In order to do a direct import from another database you will be required to know some basic SQL. Also the the server running you WordPress Ecommerce store must be able to talk to your SQL server.   First create a job that includes the SQL driver type ( any PDO driver your PHP supports) then give the authorization credentials (username, password, database, host) and finally you will need to give your sql query.  Below is a sample SQL query I use.

select 

distinct upc.upc as upc,
inv.style as style,
inv.web_caption as description,
inv.web_headline as name,
upc.sizename as variant_Sizes,
color.colorname as variant_Colors,
price.current_price as price,
price.onhand as quantity,
inv.shippment_weight as weight,
inv.include_in_catalog as active
from MyRetail.dbo.inv
full outer join
 MyRetail.dbo.inv_upc upc on inv.inv_id=upc.inv_id
full outer join
 MyRetail.dbo.inv_color color on color.inv_color_id=upc.inv_color_id
full outer join
 MyRetail.dbo.inv_dtl price on upc.upc=price.upc
full outer join
content.dbo.PRODUCT p on p.style=inv.style
where
inv.inactive=0 and
inv.web_caption is not null and
inv.web_headline is not null and
inv.shippment_weight > 1 and
(price.loc_id=777)
group by upc.sizename, color.colorname, inv.web_headline, inv.web_caption,
upc.upc, price.current_price, price.onhand, inv.style,  inv.shippment_weight, inv.include_in_catalog,
 p.IMAGE_FILE
order by style desc

When doing your sql query it’s important to rename your select fields to match the WPEC Data Feeder defined fields. Eventually I’ll create a pretty gui to allow the user to visually do the mapping, until then use the Supported Product Import Fields listed below for product or the list for users even further down.

CSV Import Files

The first line of any of the WordPress eCommerce csv file imports must have the column names as the first line and use Unix EOF

Importing Products From CSV

If you would like to import your product catalog to the store via CSV, use the following CSV file as a template.

sample.product

The first line of any of the WordPress eCommerce csv file imports must have the column names as the first line and use Unix EOF

Supported Product Import Fields.

Here is a list of fields that are currently supported fields

  • style – id number that correlates products, uses this if you want it linked to a inventory backend.  It uses this to for updates also.  All variants must have the same style.
  • upc – unique product code.  Variants can have a different upc then the actual parent product.
  • quantity – The amount of available product.  If a variant, then the applies just to the variant count.
  • name – text name
  • description – long text description, can include html
  • price – int or float
  • special_price – int or float
  • variant_* – If you would like to specify some sort of variant prefix the column name with variant_.  For example if you want to have a Variant for Sizes create a column named variant_Size for color variants you would type variant_Color
  • meta_* – Custom meta data can also be included by creating a column that has meta_ prefixed to it.  For example if you want to have a custom meta field called brand associated to your product you can create a column called meta_Brand.
  • image – the url to download the product image from.  This should be the large resolution image as wordpress will auto size for thumbnails and use this for zoom.
  • weight – currently defaults to ponds, should be an integer or float
  • height – the height of the product in inches int or float
  • width – the width of the product in inches int or float
  • length – the width of the product in inches int or float
  • tags – various product tags, multiple tags separated by |
  • category – The name of the category you want the product to exist in
  • active  – Set to 1 or 0 to publish the product

Importing Users From CSV File

A few things to note about importing records from csv files.  If the username field is blank but the email address field isn’t the email address will be used in place of the username.  Also note that if no password is given a random password is generated.  The user will have to do a password recovery to get access to the account then.

sample.user.import

The first line of any of the WordPress eCommerce csv file imports must have the column names as the first line and use Unix EOF

  • user_login –  This is the username. If the username already exists, then this record will only be used for updates
  • user_pass – password for the account.  If empty random password is assigned
  • user_email – Users email address
  • first_name – Users first name
  • last_name – Users last name
  • nickname – User nickname
  • aim – AOL Instant messenger username
  • yim – Yahoo Instant messenger username
  • jabber – Jabber username
  • description – User description
  • rich_editing – Do you want the rich text editor by default?
  • access_level – by default this is subscriber, can also specify any other wordpress user level
  • billing_first_name
  • billing_last_name
  • billing_address
  • billing_city
  • billing_state
  • billing_zip
  • billing_country
  • billing_phone
  • shipping_first_name
  • shipping_last_name
  • shipping_address
  • shipping_city
  • shipping_state
  • shipping_country
  • shipping_zip

WordPress eCommerce Data Feeder F.A.Q.

Wordpress eCommerce Data Feeder

When Import runs I get one Item added and all the rest just say updating.

This is because you don’t define a style.  The style is how you link parent products.  So each product should have a unique style.  If a product has variations (I.E. Different sizes and colors) they would still have the same style.  This is the product identifier.  Each variant can and usually should have different SKU’s and/or UPC’s

How do I debug eCommerce Feeder

If you are brave enough and want to see whats going on under the hood you can can turn on debugging in eCommerce Feeder by editing ecommerce-feeder/register.php and setting the following

//Only uncomment if you want to do debugging
define(‘ECOMMFEEDER_DEBUG’, 9);

Assuming that the webserver has the proper write access the next time you run an import you will see a file called ecommerce-feeder.log in your ecommerce-feeder directory.

</Random> is Stephen Fry proof thanks to caching by WP Super Cache