browse the blogs

[ 20 May 2013 ]

Alan Storm: Magento Admin Hello World Revisited:

I rewrote my original Magneto admin console hello world article to be more, um, correct.

My original Magento articles weren’t based on a mystical deep knowledge of the system — they were plain old trial, error, and analysis. For the most part I figured out what the core team was on about, but every so often I’d come up with something that worked but was a massive misuse of the system. Using a custom front name for admin pages was one of those mistakes. We regret the error.

[ 13 May 2013 ]

Stop me if this sounds familiar.

  1. Hey look, a Magento Connect extension, let’s try it out

  2. Oh, right, I need to be logged in to get the extension key

  3. Where’s that password again? [knocks over pills]

  4. Waiting for Magento site to log me in

  5. [Still waiting]

There are, of course (I assume), reasons for Magento to force a sign-in before letting you grab a free extension key. That said, four plus years (!) in it’s still one of the things that annoys me about the platform. So here’s a bookmarklet that’ll extract the Connect 2.0 key from an extension page, even if you’re not logged in.

Visit the bookmarklet landing page, drag the Connect Key link to your bookmarks bar, click on it while …

[ 10 May 2013 ]

Maybe if I write this down I’ll remember it.

You probably know all Magento admin console URLs need a nonce/key in the URL

http://magento.example.com/admin/catalog_product/edit/id/174/key/c4df66cd2118cb5422c9fb5eff7eq4f0/

That’s why we use the Mage::getModel('adminhtml/url') model object to generate URLs.

What I always forget is any POST to Magento’s backend also needs a form_key variable. Double the CSRF protection. Without this a POST will be redirected to the dashboard. You can generate a form_key with

Mage::getSingleton('core/session')->getFormKey()
[ 1 May 2013 ]

This article is part of a longer series covering the n98-magerun power tool

Now that we’ve got a build environment up and running, we can get to work creating our first n98-magerun command. Our end goal for today is to add a helloworld command to n98-magrun

$ ./n98-magerun.phar list

//...

Available commands:
  helloworld                       Displays a Hello World message. (pedagogical

Development Stub

So far, all our examples have used the n98-magerun.phar bundled application. Therefore, our first step today is to run the application from source code. Every phar archive can have an optional “stub” file. This file is meant …

[ 30 Apr 2013 ]

I was about to update the n98-magerun article with some positive developments on those phpunit dependencies when, much to my surprise, this happened

All the XML in code blocks is gone. Vanished. Something something other people’s free blogging systems.

Fortunately the post is mostly available via the V1 API (with entity encoded HTML), but that’s still some pretty weak sauce. I for one do not welcome our always available in the cloud closed source applications.

[ 28 Apr 2013 ]

This article is part of a longer series covering the n98-magerun power tool

Today we’re going to run through setting up your own n98-magerun development environment. This will allow you to develop your own features and contribute bug fixes back to the main repository. This one’s a little longer than our normal Magento Quickies fare, so if you’re in a hurry you may want to save this for later.

There’s two (or maybe three) extra software packages you’ll need to install if you want to work with the n98-magerun source code. The first is PHP Composer, the second is the phing build system.

Composer

Composer is a software package for managing project dependencies. The n98-magerun program relies …

[ 26 Apr 2013 ]

Vinai/fix-sample-data.php:

And Vinai’s fix for the duplicate URL problem partially/previously mentioned below. I try not to be hypercritical of Magento Inc./eBay because I know how hard these things are, but it really sounds like they pushed EE 1.13 out the door to have a Magento Imagine announcement. Fortunately the partner firms are there to catch these things and make smart choices for their clients.

[ 26 Apr 2013 ]

What’s wrong with the new url-keys in Magento? – Fabrizio Branca:

Some musings by Fabrizio Branca on changes to Magento’s product URL handling. I haven’t dug deeply into this, but it sounds like there’s a new typed (vs. a varchar), per store EAV attribute for product URL keys with unique indexing, but the unique indexing hasn’t been thought through completely. Hopefully this is fixed up before the 1.8 CE alpha becomes the shipping version.

[ 26 Apr 2013 ]

This article is part of a longer series covering the n98-magerun power tool

The database: That which, as Magento programmers, we’re not supposed to touch. Use the native objects is a refrain I’ve sung on more than one occasion, and it’s still what I recommend to people starting out with Magento.

Of course, even if we treat the database as a black box datastore, we still need to move that block box datastore around. Also, once you understand the database schemas for a particular Magento sub-system, its often easier to work directly with the database for read operations.

For those intrepid developers willing to brave the wilds of Magento’s database, n98-magerun has a suite of database commands to make …