编程语言
首页 > 编程语言> > php – Magento Community 1.7.0.2 – 导出产品CSV

php – Magento Community 1.7.0.2 – 导出产品CSV

作者:互联网

相当新的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

导致问题的功能是:

/**
 * 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修复之前,您可以复制文件
本地/法师/ ImportExport /型号/导出/实体/ Product.php

并更改第534行:

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

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

标签:php,magento,magento-1-7
来源: https://codeday.me/bug/20190715/1469491.html