cancel
Showing results for 
Search instead for 
Did you mean: 

Magento Export products with category names + all images

Magento Export products with category names + all images

Magento v 1.9.2.1

I am trying to export all products from a Magento store that includes the SKU, Category Names, and all image paths (preferably on 1 row, and in some delimited field).

In a perfect world, I would end up with a CSV with the following headings:

sku - product_name - product_description - images (/path/img1.jpg|/path/img2.jpg) - price - specified_attribute[s]

1) I tried the System -> Export feature. This seems to be broken on the particular site I am working on. It grabs the categories just fine, but the bulk of the product data - sku, name, description etc - all blank.

2) I tried the Dataflow Profiles and it works ok, except I can't figure out how to get the category names instead of the IDs and the multiple images show up in mutliple rows, I would much prefer some sort of single row/delimited field ie /i/img1.jpg|/i/img2.jpg|....

Any tips or suggestions on which way to go appreciated.

1 REPLY 1

Re: Magento Export products with category names + all images

You could write a small external mage script to loop the product collection, this would allow you to load the categories while processing and also would allow you to customise the output to what you need.

 

Something along the lines of:

include './app/Mage.php';
Mage::app();

// Get the product collection and all attributes
$productCollection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');

foreach ($productCollection as $product){
// Do your processing code here

}

processing the categories would be possible with:

$cat_ids = $product->getCategoryIds();
if(count($cat_ids)>=1){
    foreach($cat_ids as $id){
       $category = Mage::getModel('catalog/category')->load($id);
       echo $category->getName();
    }
}

This should be a good start for you, I can update it more if you need a little more help after I finish work.

Regards
Sven