browse the blogs

[ 17 Jun 2014 ]

Replay SQL Log:

An interesting project (also forked and improved by Magento stalwart fbrnc) that lets you replay the contents of Magento’s database log for the purpose of improving performance during a Setup Resource upgrade. I haven’t tried using it, but it looks useful.

Also, if there’s any computer science teachers out there, it’s a nice example of how eventually every system starts to recreate other systems (database transactions/bin-log replay).

[ 27 May 2014 ]

Vinai Koop (author of Grokking Magento) pointed me towards the magento-hackathon/composer-command-integrator Magento package (in a GitHub thread).

This packages adds a deploy-all command to the Firegento Magneto composer project which (presumably) allows users to explicitly trigger an installation of their packages into their Magneto system. (As opposed to the current Composer Installer behavior, which only installs when a package is downloaded or updated)

[ 20 May 2014 ]

In his soon to be referenced widely Magento Infinite Theme Fallback Fix, Eric Wiese notes that layout update XML files added via theme.xml are ignored by the parent/child theme inheritance. An XML file added to a parent’s theme.xml will not be added automatically to the child theme’s layout.

Eric’s solution is a custom module that makes theme inheritance consider these files.

If installing a module isn’t a solution available to you, here’s another option. Just specify the file from the parent theme you’d like in the child’s theme.xml.

In Eric’s example his US theme’s theme.xml

<?xml version="1.0"?>

[ 18 May 2014 ]

One of the things Magento 1.9 brings to the table is unlimited theme fallback via a parent/child theme mechanism. If you ever need to find the current theme’s parent programmatically, here’s what you’ll want to do.

$design     = Mage::getDesign();
$config     = Mage::getSingleton('core/design_config');
$area       = $design->getArea();
$package    = $design->getPackageName();
$theme      = $design->getTheme('');            

$parent     = (string)$config->getNode($area . '/' . $package . '/' . $theme . '/parent');


The core/design_config model/singleton is a new service model that’s responsible for reading the new theme.xml files. Then we fetch the area, design …

[ 18 May 2014 ]

Magento Infinite Theme Fallback Fix:

Covers Magento 1.9’s new parent/child theme concept, and offers an extension for more Magento 2 like merging of theme files (vs. complete file replacement)

[ 18 May 2014 ]

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
Checkout.prototype.gotoSection = function (section, reloadProgressBlock) {
// Adds class so that the page can be styled to only show the "Checkout Method" step
if ((this.currentStep == 'login' || this.currentStep == 'billing') && section == 'billing') {

if (reloadProgressBlock) {

[ 5 May 2014 ]

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();
if($block->getNameInLayout() != 'foo')

$new_output = Mage::getSingleton('core/layout')->createBlock('group/class')

$new_html = str_replace('to find', $new_output , $transport->getHtml());


Pretty standard stuff, if a little simplified for the sake of pseudo code. This sort of transformation is often necessary when a particular Magento block/template doesn’t have a method to rewrite, and the block template is complex enough that you don’t feel comfortable creating your own version of the template.

When Magento fires core_block_abstract_to_html_after, it sends along the transport object specifically so you can do …

[ 4 Apr 2014 ]

Use Reflection to find the class that a method belongs to:

Some reflection and PHP token parsing to get to the actual class with a method definition (or, by way of inference, if a method is magic or not)