遇到同样的问题。回溯它并确定它发生在我在管理员中编辑订单时,并且该订单包含至少一个带有单个选项的产品,该选项在下订单后被删除。
然后修复了三个文件,以便在编辑此类订单时简单地删除产品 - 所有修改都在“本地”范围内工作,因此核心文件保持不变:
1.app/code/local/Mage/Catalog/Model/Product/Option/Type/Select.php:221
(搜索)
$result = $option->getValueById($optionValue)->getSku();
(前置)
/* hotfix for - PHP Fatal error: Call to a member function getSku() on a non-object - occurs on admin order edit if a product option has been removed */
if (is_null($option->getValueById($optionValue))) {
throw new Exception('missing product option');
}
2.app/code/local/Mage/Sales/Model/Quote.php:695
(搜索)
$item = $this->_addCatalogProduct($candidate, $candidate->getCartQty());
(代替)
/* hotfix for - PHP Fatal error: Call to a member function getSku() on a non-object - occurs on admin order edit if a product option has been removed */
try {
$item = $this->_addCatalogProduct($candidate, $candidate->getCartQty());
} catch ( Exception $e ) {
if ($e->getMessage()=='missing product option') { return null; }
throw new Exception($e->getMessage());
}
3. app/code/local/Mage/Adminhtml/Model/Sales/Order/Create.php:288
(搜索)
if (is_string($item)) {
return $item;
}
(代替)
if (is_string($item)) {
return $item;
/* hotfix for - PHP Fatal error: Call to a member function getSku() on a non-object - occurs on admin order edit if a product option has been removed */
} elseif (is_null($item)) {
return $this;
}