Geo*_*ard 3 php magento magento-1.7
相当新的Magento安装,产品设置等,即将导出产品CSV,一旦我提交了正常的表格,错误"没有有效的数据发送"我开始做一些调试,看看是什么发生了.第一站是例外.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
Run Code Online (Sandbox Code Playgroud)
导致问题的功能是:
/**
* 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;
}
Run Code Online (Sandbox Code Playgroud)
对于某些原因,$ categoryId没有设置为$ rowCategories不是数组.
我刚刚重新运行了索引管理,但在我看来,类似于类别或类似的东西.我知道快速解决方法是在继续之前检查$ categoryId是否已设置,但我想首先知道导致错误的原因.
小智 9
在magento修复之前,您可以复制文件
local/Mage/ImportExport/Model/Export/Entity/Product.php
并更改第534行:
if (!isset($rowCategories[$productId])) {
return false;
}
Run Code Online (Sandbox Code Playgroud)
至
if (!isset($rowCategories[$productId]) or empty($rowCategories[$productId])) {
return false;
}
Run Code Online (Sandbox Code Playgroud)