Magento 的全新安装,产品已安装等,正要导出产品 CSV,一旦我提交了正常表单,错误“未发送有效数据”我开始进行一些调试以查看发生了什么.第一站是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
导致问题的函数是:
/**
* 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;
}
由于某些原因,$categoryId 没有被设置,因为 $rowCategories 不是一个数组。
为了以防万一,我重新运行了索引管理,但在我看来,类别或其他方面似乎有问题。我知道一个快速解决方法是在继续之前检查 $categoryId 是否已设置,但我想首先知道是什么导致了错误。
最佳答案
在 magento 修复之前,您可以复制
下的文件
本地/Mage/ImportExport/Model/Export/Entity/Product.php
并更改第 534 行:
if (!isset($rowCategories[$productId])) {
return false;
}
到
if (!isset($rowCategories[$productId]) or empty($rowCategories[$productId])) {
return false;
}
关于php - Magento 社区 1.7.0.2 - 导出产品 CSV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11886249/