I need to export the following from all my products.

Sku Name Description

I have tried to use the dataflow profiles, it just has not worked for me at all. We are running at 100k products and I think its too big for that option, I have found this script though which exports sku and category_id

error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
ini_set('display_errors', 1);
$products = Mage::getModel("catalog/product")->getCollection();
$products->addAttributeToFilter('status', 1);//optional for only enabled products
$products->addAttributeToFilter('visibility', 4);//optional for products only visible in catalog and search
$fp = fopen('exports.csv', 'w');
$csvHeader = array("sku", "category_ids");
fputcsv( $fp, $csvHeader,",");
foreach ($products as $product){
$sku = $product->getSku();
$categoryIds = implode('|', $product->getCategoryIds());//change the category separator if needed
fputcsv($fp, array($sku, $categoryIds), ",");

Something like this would be ideal, but I have no idea how to modify it to export different things...

Can someone talk me through it?

1 Answer 1


Just add:


and then you can get them with:

$name = $product->getName();
$description = $product->getDescription();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.