Quickshiftin - Clever Crazy Code

Using traits in Magento

March 14th, 2015

So I’ve finally started using Magento and on the whole I’m enjoying it. Magento is very flexible and the code is fairly clean. Some of the nomenclature is misleading and comments can be scant, but it’s still way cleaner than most of the older PHP e-commerce systems I’ve used like Virtuemart, OpenCart, ZenCart etc. As I’ve begun building modules to customize Magento, I discovered Alan Storm’s great website and purchased his e-book No Frills Magento Layout. I’ve also been enjoying PHP’s trait feature, you may remember I recently posted on traits too. Trait’s are useful in Magento, I’ll show you how I’m using them already.

More »

PHP traits in the real world

November 29th, 2014

I started dabbling with traits in PHP back when they were under development in 2010. It’s a little surprising then that I’ve just barely come round to actually using them in a project. Seems like PHP 5.3 has been so solid there’s been little need to upgrade, now I’m making the jump from 5.3 straight to 5.5 on a lot of my servers. Anyway, now that I’m rolling out servers with PHP 5.5 traits are on the table. Rather than regurgitating some Hello World example, I’ll illustrate a practial example from my new Softwear codebase and show how traits can save us from carpel tunnel syndrome we contracted before their advent.

More »