Author Archives: Marko

Routing in Magento - tracing single HTTP request

Magento routingRouting is an essential part of every MVC, Magento is not an exception to this rule. In order to understand how Magento routing works, it is necessary to get acquainted with execution flow that leads to certain request getting (or not getting) dispatched. It goes without saying that this knowledge comes in handy when you need to explain that 404 being thrown.

Continue reading

Bug behind before/after="Mage_Adminhtml" in Magento

Magento Standard Router BugSince Magento CE 1.3.0 version, creating Magento admin controller required you to specify before="Mage_Adminhtml" or after="Mage_Adminhtml" attribute for your node at admin/routers/adminhtml/args/modules XML Path, depending on type of behavior you want to achieve. Like me, you probably have doubts on why this is necessary, and what is the background of this requirement? Simple answer would be that without it, it simply doesn't work. More precisely, Magento hits you right in the schnoz with 404 after you try accessing admin controller in question, if you don't set one of these attributes at your node. In this article I'll do my best to explain bug in Magento standard router causing this behavior, one that somehow managed to get packaged with last 25+ Magento CE versions without being noticed.

Continue reading

Using Magento Enterprise Edition full page cache at your own controller action

Magento Full Page CacheAs a number one open source eCommerce platform with several years of development behind it, I'm sure you'll agree that Magento is one of the most complex pieces of PHP software ever created. Logical consequence of complexity Magento brings to the table is relatively low performance when compared to custom made eCommerce solutions. In order to improve this situation, Magento stacked several layers of caching one on top of another, with full page cache being the topmost layer, and one that's exclusive to Magento Enterprise Edition. Having power of full page cache nearby is great, but I must point out that by creating custom controller action in Magento you don't automatically benefit from performance boost FPC offers. In this article I'll outline how Magento Enterprise Edition full page cache works, and what you need to do in order to take advantage of features it provides at your custom controller action.

Continue reading

Adding layered navigation to custom controller action in Magento

Cart LayersIn my last article I tried to outline Magento way of displaying custom product collection using custom controller action at store frontend. I also made a promise to write a follow-up on the topic covering adding layered navigation to custom controller action with goal of making your product collection easier to navigate. For purposes of writing this article, I'll shift my focus back to Magento extension for managing catalog price rules based sale items, code I originally wrote to demonstrate adding custom layered navigation filter in Magento in one of my previous articles. As a part of this extension, I also created custom controller action used to display only sale items and added the layered navigation to that controller action, something I'll do my best to explain here.

Continue reading

Displaying custom product collection at Magento frontend

Product collectionDisplaying list of products somewhere at store fronted is very common task when developing for Magento. Whether it's featured products, sale items or the new arrivals, most developers take the custom block - custom .phtml approach. To be honest, there's nothing wrong with that if you have a good reason to roll your own solution, but 99% of the time, Magento way should be the only way. With that being said, idea behind this article is demonstrating Magento way of displaying custom product collection at store frontend by using Magento built-in blocks and templates combined with a little bit of layout magic.

Continue reading