I get this when I run the script. This script is extremely simple and I can’t figure out what Magento changed to make this not work. I have been using load and save without any problems since I started using magento at the release of 1.0
PHP Fatal error: Uncaught exception 'Exception' with message 'Warning: Invalid argument supplied for foreach() in /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 937' in /var/www/magento/app/code/core/Mage/Core/functions.php:246 Stack trace: #0 /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php(937): mageCoreErrorHandler(2, 'Invalid argumen...', '/var/www/magent...', 937, Array) #1 /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Abstract.php(892): Mage_Eav_Model_Entity_Abstract->_collectSaveData(Object(Mage_Catalog_Model_Product)) #2 /var/www/magento/app/code/core/Mage/Core/Model/Abstract.php(251): Mage_Eav_Model_Entity_Abstract->save(Object(Mage_Catalog_Model_Product)) #3 /home/blakew/scripts/testSave.php(12): Mage_Core_Model_Abstract->save() #4 {main} thrown in /var/www/magento/app/code/core/Mage/Core/functions.php on line 246
Perhaps I am not setting something that is now required. I have tried settings storeId, etc… but nothign is working. line 937 of the abstract.php file is a variable called $origData and its an invalid argument. I have traced that back to the mage core classes, but Magento is so abstract that I don’t have my head wrapped around it enough to know whats going on. Any ideas?
I have tried it on different servers even and I have the exact same problem with 1.3
Matt and Jemoon, thanks so much for your efforts. Matt your suggestion worked great. I believe there are quite a few little tricks like this that I am not aware of. Again, thanks so much.
Matt, thanks a lot, this made my code work like a charm. =)
Just out of curiosity, does anyone have the slightest idea of why we can only save products when Mage is set to the admin store view?
It kind of makes sense, given that product updates are only made on the admin side, but still… by the way the code architecture is placed, this doesn’t sound like a real limitation, but sounds more like a bug…
I’m completely speechless… I spent two days of fruitless googling… and THIS IS THE ANSWER. I don’t know WHY it works, I don’t CARE why it works. The point is that IT WORKS.