Magento: Command Line Script to Import Product Broken; Comments on Development Community

Introduction

I have been running a script based on code posted by srinigenie on the Magento boards here, which I adapted for my use to update prices, inventory levels, descriptions, etc. Up until 1.3, everything was fine. After upgrade to 1.3, boom. Updates didn’t work, and I got an Error/ Warning message:


Error importing:Warning: Invalid argument supplied for foreach() in /u/www/sites/store.uniquephoto.com/e/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 937.

Solution

Thankfully for me, Matt Dean of Organic Internet and Mobile offered up a solution in another thread. Click here for his original post.

I replaced this line:

Mage::app();

With this line:

Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

This worked like a champ for me.

Comments on Development Community

I went back and reviewed the Magento release notes for 1.3, and I don’t see anything that – to me, anyway – would indicate any sort of change would be required. That said, I have to ask myself: “What happened here?” Was this a fixed bug? Assuming it was not (as it’s not noted in the release notes), it must then be, I think, a side effect (or not) that was fixed (or broken) by some other fix. As I write more and more code to interface with Magento, how do I continue to test and more importantly, how do I perform regression testing?

I’m writing up several regression testing scenarios now to tackle problems we’ve had migrating to 1.3. I have to admit this has me a bit worried. I am not worried so much about bugs – they happen and that’s it. I am extremely concerned about backwards compatibility.

In this case, I could be 100% in the wrong – that is, maybe I am using the API in a way that is not recommended by Magento and is therefore, a hack and shame on me for using it this way. However, no mention is made any where on the forums about this.

I hope that communication between the development community and Magento continues to improve. The Community Advisory Board and QA Days are good starts. Making sure that a vibrant development community can continue to work building new extensions is important. I shouldn’t be surprised to one day find a “killer extension” that makes some large number of companies want Magento because of that extension!

Facebook comments: