2

I need a extension or script that exports product to csv file as following. I know there is no code or anything but could you please help me find a solution for this. thanks

Our Feed Requirement Field we could use from your feed

Product ID                                 column A  -  sku

Product Name                          column B  -  product_name

Product Price                            column C  -  product_price

Product URL                              column F  -  product_url

Product Description                 column D  -  product_description

Product Image URL                  column G -  image_url         

Product Category                     column E  -  category_name
  • you have to create the CSV file via script – Keyul Shah Jul 31 '14 at 12:39
3

You can create a simple script in the root of your magento instance like this:
Let's name it export.php

<?php
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$compilerConfig = MAGENTO_ROOT . '/includes/config.php';
if (file_exists($compilerConfig)) {
    include $compilerConfig;
}
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
ini_set('display_errors', 1);
Mage::app(); 
$storeId = 1; //the store id for the export
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load($storeId));
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect('*');
$collection->addAttributeToFilter('status', 1);//only active products
$lines = array();
//headers
$lines[] = array("Product ID","Product Name","Product Price","Product URL","Product Description","Product Image URL","Product Category");
//each product on one line:
foreach ($collection as $product) {
    $line = array();
    $line[] = $product->getSku();//column A
    $line[] = $product->getName();//column b
    $line[] = $product->getFinalPrice();//column c
    $line[] = $product->getProductUrl(); //column F ?
    $line[] = $product->getDescription();//column D ?
    $line[] = Mage::helper('catalog/image')->init($product, 'image')->__toString(); //column G
    $categories = $product->getCategoryCollection();  
    $categoryNames = array();
    foreach ($categories as $category) {
        $categoryNames[] = $category->getName();
    } 
    $line[] = implode(' | ', $categoryNames); //column E ?
    $lines[] = $line;
}

now you ca just print the contents of $lines or write it directly in a csv

foreach ($lines as $line) {
    echo '"'.implode('","', $line).'"'."\n";
}

Now you just have to call the url "ROOT/export.php" in your browser.

  • 1
    use fputcsv to handle quoting. – Richard Dec 8 '14 at 10:11
  • @Richard. Yes you are right. I just posted here the "heavy lifting". Writing data to a file should be easy. – Marius Dec 8 '14 at 10:12
1

You can try to use the Magento’s Import/Export Profiles

http://www.magentocommerce.com/knowledge-base/entry/tutorial-using-magentos-import-export-profiles

Thanks

  • hi thanks for the answer but it does not export with categories. – Erdem Ece Aug 1 '14 at 11:16
1

You can try to use Advanced Product Feeds extension (http://mirasvit.com/magento-extensions/advanced-product-feeds-generator.html) or MakeFeed service for magento (http://makefeed.com)

1

Check this extension: http://www.commerceextensions.com/magento-product-import-export.html

The developer also offers customization services and I have used them couple of times with no complains.

1

http://www.xtento.com/magento-extensions/magento-product-feed-export-module.html is quite a good option. It allows you to create custom output formats by applying xsl transformations to the order data.

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