Category: Programming Quickies
Back in they day, I ran a Tumblr blog named Magento Quickies where I’d post shorter, less in-depth posts about my travels through Magento’s source code. This Programming Quickies categories is the successor to that Tumblr blog. You’ll find all the old Magento Quickies content here, as well as new short posts about programming in general.
This section has its own RSS feed, the old Magento Quickies feed should should be redirecting, and we’re cross posting notifications for new posts over to magento-quickies.tumblr.com. In other words, you shouldn’t need to know any of this, but the duct tape that keeps the internet held together isn’t aging well, so your mileage may vary.
Below you'll find all the Programming Quickies articles on the site,
followed by a chronological listing of the same.
You may also browse the
7
series directly via the following links.
Pestle, Four Steps to Async Iterators, Checking in on OpenMage and Magento in 2020, Text Encoding and Unicode, Shopware's Development Environment, A Sentimental Gen-X Programmer Culls his Tech Books, and, Containers, Containers, Containers.
Using assign with Magento Blocks Apparently Magento blocks have an assign method, which produces behavior more like a “traditional” PHP MVC view layer. I was sort of aware of this, but it never really sunk in until @vinaikopp’s tweet. That is, if you use code like this #File: [...]
astorm
Passing Data between Controllers and Blocks Probably old hat for most of you, but repeating a lesson never hurts.
astorm
Magento and max_input_vars The unstoppable @benmarks tweets a warning about Magento and max_input_vars. The further an abstraction removes itself from the underlying technology, the more bugs like this pop up. It’s a common anti-pattern I see in in web frameworks using Java-like OO patterns.
astorm
Every model in Magento has an “array like” collection object. $collection = Mage::getModel('sales/order')->getCollection(); foreach($collection as $order) { echo $order->getIncrementId(); } Each collection also has a convenience method to grab the first or the last item from the collection $item = [...]
astorm
Why Some Blocks Methods don’t Work in Some Templates
astorm
This is a small PHP shell script that will extract the default connection information from local.xml and construct the correct command-line script to do a no-locking dump of the database. You’ll need to be in the root folder of a system for this to work. Useful if you spend a lot of time debugging different systems. #!/usr/bin/env [...]
astorm
If you’ve setup your own API methods and are having some trouble getting the resources to show up in the admin console’s resource list, make sure that each resource ACL group node and each each individual ACL node in api.xml have a module= translation attribute <assign_simple_product_to_configurable translate="title" [...]
astorm
Tracing PayPal’s IPN Callback Request Tasks like this make ecommerce programming the dregs.
astorm
I had a client who was using the “store code in URL” feature of Magento throughout their site. This was working well for them, but there were a few URLs where they wanted NO store code, and I was asked to look into it. Digging deep into the URL generation code, I discovered the <direct_front_name> node. <global> [...]
astorm
Punching a Hole in Magento’s Full Page Cache
astorm
Update: Turns out the previous post was missing a <layout> tag in the code examples. This has been fixed, and we regret the error. (Thanks to Bartosz Cisek, proprietor of brillan.pl, for the correction) I was surprised to discover I hadn’t covered this anywhere other than No Frills Magento Layout. The XML files in a [...]
astorm
How To Rewrite a Model Answer on Stack Overflow
astorm
The getChildChildHtml method A Stack Overflow explanation of the getChildChildHtml method on Magento’s block objects, (as opposed to the getChildHtml method). If you’re up for learning more than you ever wanted about the Magento Layout, my book No Frills Magento Layout is your first step into a larger world.
astorm
Adding External Javascript to Magento’s Head Magento’s head template (in 1.6.1 at least, but probably other versions as well), includes a call to $this->getChildHtml();. When called with no paramaters, this method renders all the child blocks of a template. That means you can add any child block to the head block, and have [...]
astorm
You Cache is Unzipped Magento uses the Zend Framework for database access. The Zend Framework’s database code will cache table schemas so it doesn’t need to do a MySQL DESCRIBE for every model on every instantiation/load/save. These caches exist outside of the Magento caches you can enable/disable via the GUI. I lose a few [...]
astorm
Loading a Rewrite Rule Outside of Request Routing Another place where the assumption of a store object makes working with the “raw” Magento PHP APIs tricky.
astorm
How to Fix an Exploded Compiler Compilation mode (which appears to be going away in Magento 2) can occasionally explode a Magento site if the new class files aren’t written out to disk correctly. Fix it quick with the advice in this link.
astorm
Some Magento History on Parent/Child Product Relationships
astorm
Debugging Resource Path is Not Callable Faults in Magento
astorm
Whenever I’m about to tackle a Magento project and/or feature that requires deep knowledge of a new-to-me subsystem, I spend a half-day to a day writing up something like the information below. Sort of an anti-UML, it’s a high level narrative of the relationships between particular objects and systems in Magento. Beyond [...]
astorm