browse the blogs

[ 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)

[ 2 Apr 2014 ]

Slow Indexing in Magento EE:

Main Takeaway: If you mix strings/integers in your WHERE clauses for numbers, MySQL can’t use its indexes.

[ 26 Mar 2014 ]

Create Dummy Orders:

An n98-magerun add on that adds a order:create:dummy command. Useful for the freelancer “I need sample data to do your ERP project/We don’t trust you with our order information until you’ve done some work for us” catch-22.

[ 18 Mar 2014 ]

Cross Area Session Access:

Speaking of sessions, I whipped up a quick proof of concept for accessing admin sessions from the frontend of Magento — useful if you want to restrict frontend access using backend session ACL rules.

Right now it works with file and db session storage — memcache, redis, etc. would need their own Loader model implementation. The loader models are responsible for yoinking sessions out of storage by session ID. The rest of the tedious and particular session handling logic is handled by the extension code.

[ 18 Mar 2014 ]

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 PHP request finishes. This, in turn, could make sessions appear broken to a client programmer.

Now, this doesn’t happen with a stock Magento because Magento core code instantiates the session resource as a Magento singleton

Mage::getResourceSingleton('core/session');

Magento’s singleton implementation keeps a reference to the object around for the entire request, so PHP never calls __destruct.

However, if you instantiate the resource model as a regular model (because you wanted to reuse the “read/write sessions from database” code), …

[ 10 Mar 2014 ]

Magento Design Patterns – Cool Ryan:

Twelve part series on the “design patterns” used by Magento 1.

[ 3 Mar 2014 ]

How to convert Magento quote into backend order:

An article explaining how to turn an existing customer’s cart (i.e. “quote”) into a Magento order via the backend. The number of workflows Magento has built in for this sort of thing are surprising — I often wonder how often someone’s taken on a custom development project only to discover most of what they wanted has already been built.

[ 2 Mar 2014 ]

Solr and PCI Compliance:

Blog post form Inchoo on compiling the latest Solr to work around PCI compliance issues. The lesson? Vendor support for Enterprise Edition comes mainly from Magento partners, and not Magento/eBay itself.

[ 27 Feb 2014 ]

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 something better evangelism.

[ 27 Feb 2014 ]

Magento Deployments with Capistrano:

Mentioned in a tweet by Aaron Bonner, I wasn’t aware of Alistair Stead’s Capistrano/Magento project.