dongwen3437 2009-11-26 02:56
浏览 52
已采纳

Magento致命错误:在非对象上调用成员函数getSku()

I have come across a bizarre error in the Magento shop I'm developing and despite my inquiries online, it appears no one else has ever seen this exact error under the same circumstances. Lemme 'splain.

The full text of the error message is this:

Fatal error: Call to a member function getSku() on a non-object in /path/on/server/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php on line 221.

Now, others have gotten this error message--it was addressed and supposedly fixed in the 1.3.1 roadmap (http://www.magentocommerce.com/roadmap/release/1.3.1). However, the circumstances of those other error messages were where they tried to add an item to the cart--if the item had custom options, it would loop to this error message.

My situation is that I have a SIMPLE item--not bundled or configurable--without any custom options. I can add it to the cart without any trouble. But if I run through the entire checkout procedure, upon placing the order, the error message appears on a white screen. The URL in the browser shows me I’m on the checkout success page.

AND, the order appears to go through perfectly, getting registered by both Magento AND Authorize.net.

I’ve tried debugging the error as far as I can go, but this one’s got me stumped.

For reference, I’m in Magento 1.3.2.4. When I first received the error I reinstalled all the core files and was still able to replicate the error.

I’m going to continue to test, but if anyone has ANY bright ideas about why this is happening, I’d love to hear your thoughts. I’m so close to launch and this thing could put the kibosh on the whole thing.

  • 写回答

4条回答 默认 最新

  • du5114 2009-11-26 03:16
    关注

    I've had this error before and was also not getting any hits on how to solve it. So, I had to modify the core files to fix the error message. The problem is Mage_Catalog_Model_Product_Option::getValueById() can return a null value BUT Catalog/Model/Product/Option/Type/Select.php is NOT checking for this possibility.

    Here's the solution that worked for me:

    Open app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php

    Change line 121 from:

    $result = $option->getValueById($optionValue)->getSku();
    

    To:

    $o= $option->getValueById($optionValue);
    $result = is_object($o) ? $o->getSku() : null;
    

    I always hate changing core files but when there's a bug there's not much else I can do!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题