Possible Solution for Fatal Error When Adding Item to Cart

50 views
Skip to first unread message

Scott Youmans

unread,
Aug 2, 2012, 10:50:17 AM8/2/12
to ship...@googlegroups.com
We started seeing PHP Fatal error: Call to a member function getPrice() on a non-object in IllApps_Shipsync_Model_Shipping_Package_Item.php on line 64.

// LINE 64: $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->getSku());

On a whim, I decided to change it to this, which seemed to fix it, though, of course, now we need to be mindful of this change when upgrading.
$product = Mage::getModel('catalog/product')->load($item->product_id);

Wondering if this is a valid solution or if there's some other issue going on here. The product added to the card had custom product options.

Running Magento Community 1.7.0

Scott Youmans

unread,
Aug 2, 2012, 10:51:15 AM8/2/12
to ship...@googlegroups.com
Sorry, just saw the note that this forum is for developers ... well, consider this a note about a possible bug :)

Dan

unread,
Aug 27, 2012, 3:13:22 PM8/27/12
to ship...@googlegroups.com
Scott thanks, that helped with a conflict with M2EPro. Plus irritating cron messages.

Dan

unread,
Sep 7, 2012, 4:35:12 PM9/7/12
to ship...@googlegroups.com
Bump,
David, is this a valid fix?

David Kirby

unread,
Apr 22, 2014, 3:18:56 PM4/22/14
to ship...@googlegroups.com, d...@onetreebrands.com
Yup, this is correct for Magento 1.5-1.8+.

ShipSync 5.x.x replaces loadByAttribute with :

$product = Mage::getModel('catalog/product')->load($item->getProductId());

Reply all
Reply to author
Forward
0 new messages