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
The PHP community draws developers from all sorts of different backgrounds — there's the technical and academic on one end of the spectrum, and the bang on the keyboard until it works on the other. Because PHP is such an accessible language, all these
astorm
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)
astorm
Slow Indexing in Magento EE Main Takeaway: If you mix strings/integers in your WHERE clauses for numbers, MySQL can’t use its indexes.
astorm
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.
astorm
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 [...]
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
Magento Design Patterns – Cool Ryan Twelve part series on the “design patterns” used by Magento 1.
astorm
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 [...]
astorm
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.
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
Magento Deployments with Capistrano Mentioned in a tweet by Aaron Bonner, I wasn’t aware of Alistair Stead’s Capistrano/Magento project.
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
Anatomy of the Magento PHP 5.4 Patch Blog post by yours truly, going into the technical details of Magento’s recent PHP 5.4 patch.
astorm
How QuarkXPress became a mere afterthought in publishing I’m a sucker for anything that reminds of late 80s to late 90s computer/Internet culture — add in some publishing and how can I not link it? Great insights on how a business, even with a rock solid lock on their market, can only ignore the flaws in its product for so long.
astorm
Magento’s configuration includes a hard coded field for the base site URL. This often creates headaches when a user migrates a system to a new server/URL, but hasn’t updated the URL entries in the core_config_data table. These headaches are compounded by The fact that the entries in core_config_data are cached by Magento Most [...]
astorm
Magento Router Configuration One of those things I wasn’t concretely aware of — each named Magento <routers/> configuration is associated with a specific router object. You specify the router object you want to associate your <routers/> configuration with via the <use>...</use> tag. This is always standard [...]
astorm
I'm Alan Storm, this is my website. I'm a programmer, and I write about that here. Sometimes people pay me to program things. I also own a tiny technology publishing company. If I had to describe my job I'd say I help other programmers
astorm
Somewhere in the past few dev releases Magento 2 got rid of the MagentoAppDir class/object. The MagentoFilesystem object (and its getPath method) seem to be a reasonable replacement
astorm
Tracking down Foreign Key Errors A Stack Exchange question where I walk though how to track down foreign key constraints in Magento/MySQL. The subtext here: Turning off MySQL foreign key checks and/or randomly typing things in you read on the Internet usually leads to pain.
astorm