I’m still digging into the new Magento 1.9 CE responsive web design (RWD) theme, but one thing I noticed immediately (since it conflicted with my new Custom Checkout Step extension) is how the theme needed to replace a method in the Prototype JS Checkout class. #File: skin/frontend/rwd/default/js/opcheckout_rwd.js [...]
astorm
Here’s a fun little heisenbug I had to deal with. I was working in a Magento block observer — specifically the core_block_abstract_to_html_after event. If the block was a specific block, I wanted to change its output slightly. $transport = $observer->getTransport(); $block = $observer->getBlock(); [...]
astorm
I gave this little bit of Magento code an ugh on Twitter. #File: app/code/core/Mage/Core/Model/Resource/Session.php public function __destruct() { session_write_close(); } Why? Because PHP automatically calls __destruct when it cleans up memory for an object, which means this code could potentially close and save the session before the [...]
astorm
Save Simple Data in Magento with Flags – Cool Ryan Magento has a base Mage_Core_Model_Flag (core/flag) model you can extend to save simple flag data in and out of Magento without needing to create a new table/data-store. I’d never seen these before today, despite the feature going back as far as Magento 1.3. Something [...]
astorm
In response to a retweet of adam_webdev by kalenjordan Magento’s flexible layout system makes adding a javascript library like handlebars a cinch. First, download the latest version of handlebars and drop it in your root javascript folder js/handlebars-v1.3.0.js Next, add the following to your local.xml file. <layout> <!-- [...]
astorm
Alan Storm: Developing Commands for N98-magerun One last n98-magerun article. This one covers how I created the config:search command, and is really a sneaky way of teaching you about test driven development.
astorm
Magento TinyMCE Config A new, small, Magento module (authored by me) that makes adding additional TinyMCE configuration items easy. Built to work around Magento’s stripping of certain HTML5 tag attributes.
astorm
Test driven development is all the rage in certain PHP circles (while rage inducing code is all the rage in other PHP circles). Today we’re going to cover using the PHPUnit testing tools that ship with n98-magerun, as well as cover some programatic testing basics. Creating a test in n98-magerun is simple. First, make sure [...]
astorm
OSL 3.0 Explained I am still not your, or anyone’s, lawyer, but this is a great breakdown of the motives and intent of the OSL software license. (tip fo the hat to hakre)
astorm
Serializable Fields in Magento Collections The behavior of model objects in a model context vs. a collection context is one of those problems most classic OOP (i.e. Java) style language/frameworks often miss on. Needing to learn the rules of what gets loaded when means more mental overhead is added when you’re coding, and the goal [...]
astorm
I’m happy to report n98-magerun have incorporated and improved my old attribute migration generator script into a new dev:setup:script:attribute command. $ n98-magerun list dev:setup:script ... Available commands for the "dev:setup:script" namespace: dev:setup:script:attribute Creates attribute script for a given attribute code If [...]
astorm
Throughout this series we’ve skirted around one important issue. Namely, the opaque nature of PHP’s phar format. Many groups claim the term “open source” in someway or another. There’s open source the license, which dictates how and where code can be used and shared. Then there’s open source “you [...]
astorm
Recursive Layout Updates won’t Work in CMS Page Model Meaning you can’t use the <update handle="foo"/> syntax when you’re entering a custom layout update to use on a specific XML field. I encounter this bug about a once a year.
astorm
Alan Storm: Magento Admin Hello World Revisited I rewrote my original Magento 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 [...]
astorm
Stop me if this sounds familiar. Hey look, a Magento Connect extension, let’s try it out Oh, right, I need to be logged in to get the extension key Where’s that password again? [knocks over pills] Waiting for Magento site to log me in [Still waiting] There are, of course (I assume), reasons for Magento to force a sign-in [...]
astorm
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 [...]
astorm
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 [...]
astorm
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 [...]
astorm
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 [...]
astorm
This article is part of a longer series covering the n98-magerun power tool We’re almost at the end of our n98-magerun command review. Today we’re going to blitz through the remaining commands on our plate $ n98-magerun list local Available commands for the "local-config:generate" namespace: local-config:generate Generates [...]
astorm