I need to export all the products in Magento 1.9 with the module Mage_ImportExport, but in export setting when I select product as Entity Type, Magento doesn't load any Entity Attributes.

So when I click on "Continue" I get the error "No valid data sent"

I've checked the web server log file that gives this error:

PHP Fatal error:  Call to a member function getName() on a non-object app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php on line 171

the error part of that Product.php is:

 * Initialize categories ID to text-path hash.
 * @return Mage_ImportExport_Model_Export_Entity_Product
protected function _initCategories()
    $collection = Mage::getResourceModel('catalog/category_collection')->addNameToResult();
    /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
    foreach ($collection as $category) {
        $structure = preg_split('#/+#', $category->getPath());
        $pathSize  = count($structure);
        if ($pathSize > 1) {
            $path = array();
            for ($i = 1; $i < $pathSize; $i++) {
                $path[] = $collection->getItemById($structure[$i])->getName();
            $this->_rootCategories[$category->getId()] = array_shift($path);
            if ($pathSize > 2) {
                $this->_categories[$category->getId()] = implode('/', $path);

    return $this;

and the line 171 is:

 $path[] = $collection->getItemById($structure[$i])->getName();

any suggestions?

  • 1
    In export, when you change 'Entity Type' to Product one Ajax request will call. check in console and see what response is coming in that Ajax call. Is there any error in that call? Commented Oct 4, 2015 at 13:47
  • Thank you @AkhileshPatel you're right, i get an error in Ajax call, error 500 Internal Server Error, but if i select customer instead product it works, the problem is only for Ajax call of products. What could be the reason?
    – Xavier
    Commented Oct 4, 2015 at 13:58
  • Okay...that could be a time out issue. How many do you have custom attributes? Add set_time_limit(0); in your index.php and check again. Commented Oct 4, 2015 at 14:25
  • I have a few custom attributes just 2 or 3 not more. I updated the question, i double checked the web server log and get the error that I wrote above. It seems an error with category ID, could it be?
    – Xavier
    Commented Oct 4, 2015 at 14:32
  • Also try to enable error reporting, and if Mod_Security is enabled you might to want to whitelist the ajax url. Mod security can be picky when it comes to ajax or post requests. Commented Oct 4, 2015 at 15:34

2 Answers 2


Before this try please try to do re-index data and check again.

The issue is $structure[$i] that is entity_id (category id) passing in this function. It seems entity_id is not a valid in catalog_category_entity or category flat tables.

Check in your database if your flat tables are fine.

Alternative but a not a good solution.

$path[] = $collection->getItemById($structure[$i])->getName();

Replace this with

$category = Mage::getModel('catalog/category')->load($structure[$i]);
$path[] = $category->getName();
  • Thanks, it works, but why you said "not a good solution" what could be the problem of that solution?
    – Xavier
    Commented Oct 5, 2015 at 10:02
  • Great, actually we are passing category id in function getItemById() and which is try to get category name by calling getName() and we are getting non object fatal error. the issue is somewhere in your flat data. we should find out exact problem in database which needs much debug effort. But anyways this will also work for you. Basically it's just returning category name which you will get in csv export!! :) Commented Oct 5, 2015 at 10:39
  • I tried to check entity_id in the database table (catalog_category_entity and flat_store), but they seem to be all ok, do you know if exist, a quicker way to find out the faulty id?
    – Xavier
    Commented Oct 5, 2015 at 12:32
  • I don't know the exact solution that is why I mention we needs to debug in deep :) Commented Oct 5, 2015 at 12:41
  • its not work for me, could pls guide me
    – Gem
    Commented Jul 12, 2016 at 5:12

I had the same issue with my Magento website, and got resolved with the help of Hosting provider, Try This.

php bin/magento indexer:reindex php bin/magento cache:flush

Best Regards Shaik

Your Answer

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

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