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!

My Last Polaroid Picture?

Grandmom K loved her Polaroid. I remember the little photo- album- on- a- stand in which she placed all her pictures. Every one labeled on that extra white space at the bottom. Everything from birthday parties, to family picnics, to Grandpop’s 60 plus pound Red Drums he’d catch off Altantic City.

Polaroid pictures look like memories. They’re a bit softened, or misty – not just stuck in time, but alive in time. They immediately take on a look that my memories take on over time.

So here’s Trent, a Polaroid taken on Saturday, at the town Easter Egg Hunt. After that is an image taken with my Digital SLR. That is, a Polaroid of Trent, and then a picture of Trent having his picture taken.

Last Polaroid? Trent, Easter 2009
Last Polaroid? Trent, Easter 2009

And this picture from my DSLR:

A Picture of Trent Having His Picture Taken
A Picture of Trent Having His Picture Taken

I think Grandmom would have loved both pictures. But I think she’d keep the Polaroid.

And I wish I had a few more Polaroids of her.