Magento Product Data and Attribute Exporter

created August 8, 2014, last updated May 24, 2015.

.
closeThis post was last updated 8 years 1 month 13 days ago, some of the information contained here may no longer be actual and any referenced software versions may have been updated!

Over the last few years I have developed a few different PHP scripts to export Magento product data in order to manipulate product pricing, generate Magento  EAN barcodes or create product import data.

Recently I had to export Magento product data to be used as import data for Amazon product listings. Specifically the products had a lot of different attributes associated with them and I wanted to export each product with all of its associated attribute data to map to the relevant Amazon product data.

To accomplish this I returned to my previous code and enhanced it to be able to export user defined Magento product and attribute data to a delimited text file (as well as creating product EAN barcodes which was a function of the original script.)

The script can extract the usual global product data e.g. price, description etc. as well as any custom product attributes.

The export data is configured in an array;

$_getProductData=array(
‘name’ => true,
‘description’ => false,
‘imageurl’ => true,
‘producturl’ => true,
‘type’ => false,
‘ean’ => false,
‘category’ => true
);

We set the array key value to true or false for the product data we want to export. The same applies to attribute data:

$_getProductAttributes=array(
‘colour1’ => ‘color’,
‘custom’ => ‘my_custom_attribute’
);

So here we are exporting the color product attribute as well as a custom attribute.

The tab delimited data is easily imported into Excel for manipulation and further import/export, for example adaption to an Excel format compatible with Amazon product imports.

This data can also become really useful if you want to provide fast external access to your product info for example, in an external app, on Facebook or even within Magento. See my product attribute search app for more information.

You can download the source code for this export script from my Github.

To run the script copy the files to your server and edit the configuration php file config/applicationConfig.php. Configure the paths to your Magento installation and the folder to export to.

Configure the product arrays by editing php/Application.php, edit $_getProductData and $_getProductAttributes.

To run the script execute it with php export.php debug from the command line. To run silently from a cron job leave the debug switch out.

You can also run the script from your web browser if you install it in a web accessible folder.

Here is an example of the output from my Magento dev store ::

id	sku	name	imageurl	producturl	category	colour1
51	1111	Ottoman	http://dev.gaiterjones.com/magento/media/catalog/product/m/a/magento-red-furniture-set.jpg	http://dev.gaiterjones.com/magento/magento-red-furniture-set.html	Living Room	Red
52	1112	Chair	http://dev.gaiterjones.com/magento/media/catalog/product/m/a/magento-red-furniture-set.jpg	http://dev.gaiterjones.com/magento/magento-red-furniture-set.html	Living Room	Red
53	1113	Couch	http://dev.gaiterjones.com/magento/media/catalog/product/m/a/magento-red-furniture-set.jpg	http://dev.gaiterjones.com/magento/magento-red-furniture-set.html	Living Room	Red
83	cn	CN Clogs Beach/Garden Clog	http://dev.gaiterjones.com/magento/media/catalog/product/c/n/cn-clogs-beach-garden-clog.jpg	http://dev.gaiterjones.com/magento/cn-clogs-beach-garden-clog.html	Mens	xxx
29	cn_3	CN Clogs Beach/Garden Clog	http://dev.gaiterjones.com/magento/media/catalog/product/c/n/cn-clogs-beach-garden-clog.jpg	http://dev.gaiterjones.com/magento/cn-clogs-beach-garden-clog.html	Mens	Blue
84	cn_4	CN Clogs Beach/Garden Clog	http://dev.gaiterjones.com/magento/media/catalog/product/c/n/cn-clogs-beach-garden-clog.jpg	http://dev.gaiterjones.com/magento/cn-clogs-beach-garden-clog.html	Mens	Blue
85	cn_5	CN Clogs Beach/Garden Clog	http://dev.gaiterjones.com/magento/media/catalog/product/c/n/cn-clogs-beach-garden-clog.jpg	http://dev.gaiterjones.com/magento/cn-clogs-beach-garden-clog.html	Mens	Blue

xxx

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.