3
votes

Quite a new install of Magento, Products are setup etc and was just about to export a product CSV and once I submitted the normal form, The error "No valid data sent" I started doing some debug to see what was going off. First stop was the exception.log

Notice: Undefined index:   in /app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php on line 539' in /app/code/core/Mage/Core/functions.php:245

The function thats causing the problem is:

/**
 * Update data row with information about categories. Return true, if data row was updated
 *
 * @param array $dataRow
 * @param array $rowCategories
 * @param int $productId
 * @return bool
 */
protected function _updateDataWithCategoryColumns(&$dataRow, &$rowCategories, $productId)
{
    if (!isset($rowCategories[$productId])) {
        return false;
    }

    $categoryId = array_shift($rowCategories[$productId]);
    $dataRow[self::COL_ROOT_CATEGORY] = $this->_rootCategories[$categoryId];
    if (isset($this->_categories[$categoryId])) {
        $dataRow[self::COL_CATEGORY] = $this->_categories[$categoryId];
    }

    return true;
}

For somereason, $categoryId doesn't get set as $rowCategories isn't an Array.

I've re-run the index management just incase, but it seems to me like theres something wrong with the Categories or something. I know a quick fix is to check that the $categoryId is set before continuing, but I'd like to know what's causing the error in the first place.

3
As for the underlying cause for this specific issue, I'm not sure. However, Dataflow is working just fine for me (while the basic export is not). - Zachary Schuessler

3 Answers

9
votes

Until a fix from magento, you can duplicate the file under
local/Mage/ImportExport/Model/Export/Entity/Product.php

and change line 534:

if (!isset($rowCategories[$productId])) {
    return false;
}

to

if (!isset($rowCategories[$productId]) or empty($rowCategories[$productId])) {
    return false;
}
2
votes

I had the same problem. As I was only trying to export one product - the fix was easy: I just added the product to a category.

1
votes

There seems to be something wrong with the filters on the export products' form. The simple fix for this, on magento 1.7.0.2:

  1. Copy the file app/code/core/Mage/ImportExport/Model/Export.php to app/code/local/Mage/ImportExport/Model/Export.php.
  2. Around line 145, on the export() method, comment out the if, and the else. There is never a filter on the form.
  3. Copy the file app/code/core/Mage/ImportExport/controllers/Adminhtml/ExportController.php to app/code/local/Mage/ImportExport/controllers/Adminhtml/ExportController.
  4. Around line 77, on the exportAction() method, comment out the if and the else. Same reason as above

That did it for me.