Archive for the ‘Development’ Category
Magento Modules and the Community
Thursday, October 6th, 2011

This post outlines some of our thoughts about the state of the Magento module community, and an idea for how Magento can improve the quality of that community.
Here at Classy Llama Studios we create our own Magento modules every day and have high standards for any module that we write. These standards include having properly commented code, adhering to Zend programming standards, and having both the code and functionality of the module reviewed before it is released. Magento is great because, instead of having to write every module that we use, there are numerous other quality development companies whose modules we can draw from for sites that we develop. Unfortunately, there are a lot of modules out there that are not quality. Issues with modules that we encounter include poorly written code, SQL vulnerabilities, improper code domain separation, and improper utilization of the Magento Application functionalities. Some of these modules do not even work.
This abundance of modules often leaves us with a challenging question. Do we recommend this module to our client? If we do, we often have to prepare our clients for the possibility of hours of development, in addition to the module cost, that may be required to make the module safe and functional. The other option is that we have to take a loss to bring the module to the level necessary for use on our customers’ eCommerce platform. We love our customers and so it is painful for us to have to make either of these choices when the customer is already paying for the module. Because of this, we have been asking ourselves if there is some sort of solution to the problem of poorly coded modules.
The answer we came up with is twofold. For now, we can buy most of our modules from the great companies who have earned our trust up to this point; these companies include AheadWorks, Unirgy, and WebShopApps. This alleviates the problem but it does not come close to eliminating it. We know that there are other developers who write quality modules. We simply don’t know who they are until we have worked with and reviewed their modules. We think that Magento itself is the solution to this dilemma.
Even though Magento has had explosive growth since the release of Magento 1.0, it has only been three and a half years since its release. Since then, Magento has gone through dramatic transitions and upgrades turning it into a much more streamlined and powerful system with numerous features and a massive community. With eBay’s acquisition of Magento, its future looks even brighter. Since Magento is so young, however, there are certain features and programs that they have not had or taken the time to develop. We believe that the development of a Magento module certification would be a great step for the company and the community at large. Magento has over 4800 modules in Magneto Connect, and we realize that reviewing every one of them would be a massive undertaking, so we think that it should be something that Magento would be best able to facilitate on a voluntary basis. When Magento certifies a module, that module would receive special recognition and be more accessible to developers and store owners. This would take the burden of code review and repair off individual development companies or users purchasing the modules and put it back on the original developers of the module. While this could take time to implement, we think that it is an endeavor from which the entire Magento community would benefit.
We’ve communicated this idea to Magento. Here is a snippet of what we’ve told them: … There are many poor quality developers and modules, and the current system doesn’t provide a system of being able to determine which modules are good, and which are not. The current Magento Connect is much like the Android Marketplace – thousands of apps, with only a portion of them being high quality. While we would not like to see the same level of curation as the iOS Marketplace, we would like to see more attention being paid to ensuring that quality modules are promoted, and poor-quality modules are being demoted…
We sincerely hope that Magento does this, but regardless of what they do, we love the platform and will continue to support the company and the community to the best of our ability. We believe that Magento truly is the eCommerce “Platform for Growth” and that it’s many features, programs, modules, developers, store owners, and fans make it a wonderful and enjoyable platform to work with every day.
Tags: Community, Magento, Modules
Posted in Development, Magento, Magento Development, Management | 5 Comments »
Wiz 0.9.5: Admin & Developer Tools, Batch Output
Tuesday, October 4th, 2011
The latest batch of Wiz updates includes some useful stuff for developers as well as some administrative features. Included in this bundle of Wizzy goodness is the ability to output any table output in csv, pipe, or tab delimited output. This makes it very easy to utilize Wiz with other commands (or potentially feed information from Wiz back into itself!)
Here is a complete list of the changes in 0.9.5:
- The internal configuration system was rewritten to look more like Magento’s own configuration system — using XML files. This isn’t really used heavily yet, but we’ve got some stuff coming in the next few months that will take full advantage of this.
- You can now toggle the following “developer” flags from the CLI:
- Allow Symlinks (For templates, 1.5.1.0+)
- Logging
- JS Merging
- CSS Merging
- Profiler
- You can view all of the above configuration values as well with the
devel-configcommand. - Get a list of all registered event listeners.
- Get a list of all Models registered in the system and module rewrites.
- Scriptable output. Output tabular data in csv, pipe-delimieted, or tab-delimited formats.
If you just want to get going:
Browse on Github
Website / Download
Be sure to read over the Readme file on Github for more information about the added commands!
The Good Stuff
Okay, so the configuration system isn’t a huge deal… but it does open up more potential for 3rd party developers to write plugins that need to store things: usernames, passwords, etc. without having to provide their own storage mechanism. Let’s get to the really exciting stuff!
Developer Configuration
$ wiz devel-config +---------------------------------+-------+ | Path | Value | +---------------------------------+-------+ | dev/debug/profiler | No | | dev/js/merge_files | No | | dev/css/merge_css_files | No | | dev/log/active | No | | dev/debug/template_hints | No | | dev/debug/template_hints_blocks | No | | dev/template/allow_symlink | No | +---------------------------------+-------+
You can now flip off/on or view the status of each of these independently. Each of these work the same way devel-showhints works.
Developer Helpers
One of the things I’m curious about sometimes is to see what modules are listening to what events. Well, now with a new command, you can see that:
wiz devel-listeners give you a list of the events and the modules and their model/method that is responding to that event.
Often times, I want to know what overrides have been performed by other modules. Now I can see a total picture of what modules provide what models:
As you can see, all of the standard models are shown, but you can also see what overrides are performed by all of the modules on the system.
Scriptable Table Output
Finally, of the coolest thing (in my opinion) is the scriptable output. Wiz has a pretty decent table output system that makes it fairly easy for your eyes. However, getting that data out of the table took me far too much time. Enter --batch.
The –batch argument takes the model list we show above and transforms it into:
"Model Name","PHP Class"
varien/*,Varien_*
core/*,Mage_Core_Model_*
core_resource/*,Mage_Core_Model_Resource_*
eav/*,Mage_Eav_Model_*
eav_resource/*,Mage_Eav_Model_Resource_*
page/*,Mage_Page_Model_*
install/*,Mage_Install_Model_*
install_resource/*,Mage_Install_Model_Resource_*
admin/*,Mage_Admin_Model_*
The –batch argument can take one of three arguments: csv, pipe, or tab. csv is the default (as you can see above). Pipe replaces the commas with “|”s and tabs… well, you get the idea.
Now you can take your Wiz output and pipe it through grep, cut, etc. or output straight to CSV and load it up into Excel/Numbers/OpenOffice/etc.
Enjoy!
Get Wiz
Browse on Github
Website / Download
Posted in Development, Magento, Magento Development, Wiz | 1 Comment »
The Magento Developer Certification
Monday, October 3rd, 2011
As many of you know, Magento recently announced their Magento Developer Certification program. As one of the few partners who have been involved with Magento since it’s inception, we’re especially excited to see this long-awaited program finally being launched.
Due to our depth of knowledge and experience with the Magento platform, Magento invited us to be a part of the Magento Certification Advisory Board. We’ve been involved in the process of writing questions for the certification for the past couple of months. I want to extend congratulations to one of our Lead Developer’s, David Alger, for representing Classy Llama on the Advisory Board. His contribution to the development of the certification has been substantial – he even won the award for completing the most number of objectives at a one-week onsite question-writing session.
The certification is going to be beta-launched at the Innovate conference at the middle of this month and will be announced to the public later this year. We have four developers who will be at the event and taking the certification.
Posted in Magento Development | 4 Comments »
Add Custom Layout Handles (e.g. Parent Categories)
Wednesday, June 1st, 2011
If you ever need custom layout handles in your local.xml, it’s fairly simple. In this example the observer method will make a new handle for for categories that have children or not, but you can just modify the method to make whatever handles you desire. (I realized after creating this there’s already a handle for anchored categories with no subcategories, catalog_category_layered_nochildren)
First add this to your config.xml in yourcustommodule:
<config> <frontend> <events> <controller_action_layout_load_before> <observers> <yourcustomtheme_observer> <class>yourcustomtheme/observer</class> <method>addHandles</method> </yourcustomtheme_observer> </observers> </controller_action_layout_load_before> </events> </frontend> </config> |
Then add this method to your observer:
class YourPackage_YourCustomTheme_Model_Observer extends CLS_Core_Model_Abstract { public function addHandles($observer) { $category = Mage::registry('current_category'); if ($category instanceof Mage_Catalog_Model_Category) { $update = Mage::getSingleton('core/layout')->getUpdate(); $fertilility = (count($category->getChildrenCategories()->getData())) ? 'parent' : 'nochildren'; $update->addHandle('catalog_category_' . $fertilility); } return $this; } } |
Posted in Development, Magento, Magento Development | 2 Comments »
Wiz 0.9.0-beta: Specify Scope, Create EE Admin Users, and more…
Tuesday, March 29th, 2011
The initial flow of love for Wiz was greatly appreciated! I’m not certain how many people actually have downloaded and are using Wiz today. We may never know fully… But the buzz that was generated was definitely invigorating!
We have recently rolled Wiz out to our entire team here at Classy Llama. No doubt within the next few weeks we will see more features being added as our people put it through the hoops. Enough about that. Let’s get on with it!
Specifying a scope code
By default, Wiz will execute your commands running inside of the admin scope. This is great for practically everything, however using the 301-urlskumap to generate a CSV of SKUs to URLs caused issues when running inside of the admin. Now all you have to do is:
wiz 301-urlskumap --store [code]
And it will execute inside of the store's scope, giving you the proper rewritten URLs. If you leave out the code, it will use the default store. --website is also available.
Adding EE Admin Users with AdminGWS
Creating admin users on Magento Enterprise and Magento Professional is technically the same. The both use SHA256 to store passwords instead of MD5. And they both share the same database structure for users. However, EE has an additional module called Enterprise_AdminGWS. This is important because this module actually modifies the structure of the role table to include GWS (Global, Website, Store) level permissions. Wiz will now check for and properly adapt to the presence of this module.
Log cleaning
One of the comments on the initial post mentioned tying into the Magento provided shell commands. This is the first part of that excellent idea. The one curious thing about this conversion is that the --days argument is not present. Interestingly enough, although Magento provides this option in their shell script it does not work properly. It ignore it completely and uses what is in the config.
Roadmap
We currently have only one driving force behind where Wiz development time gets spent: feature requests. You are more than welcome to submit a feature request/issue on the Wiz Github page. Here is what is being planned and worked on for future releases:
- Indexing control (in the same vein as cache control).
- Compiler functionality.
- Status (lists version, modules, module versions, number of products, categories, etc.) in a report format.
- Auto-updating from within Wiz.
- Module creation and modification.
As always, your feedback is welcomed and greatly appreciated!
If you have not started using Wiz yet, go get it!
Posted in Development, Wiz | No Comments »
No More Square (White Background) Magento Product Images
Monday, March 21st, 2011
Do you have a site with product images of varying proportions. It can be annoying when Magento gives you that white border to make your product image square. Here’s how customize what color that background is: just add backgroundcolor('000', '000', '000') before the resize() method
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail',
$_image->getFile())->backgroundcolor('000', '000', '000')->resize(100); ?>" ... />
Better yet, get rid of the background using keepFrame(false):
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail',
$_image->getFile())->keepFrame(false)->resize(100); ?>" width="100" ... />
Resizing after keepFrame(false) will resize the largest dimension. Don’t forget to delete your image height and width attributes (if need be)!
Here’s (most of) the places you’ll want to change these:
- catalog/product/view/media.phtml
- checkout/cart/item/default.phtml
- catalog/product/list.phtml
There may be a few more but I bet you can find them. Enjoy your no longer square (white background) images!
Posted in Development, Magento Development | 4 Comments »
Dear Facebook…
Monday, March 21st, 2011

The following is an open letter to Facebook. I know Facebook privacy has been an issue in recent times, but I think this one in particular takes the cake (Sorry… the cake is a lie) wins in terms of fail. At the time of writing this article, I found no solution to this issue, and by all means, if it has been fixed/addressed/etc. please let me know. I’m no Facebook addict… but I do like to think I know my way around it a fair amount.
Dear Facebook:
I love you. I really do. You were the first to truly see the social platform as something that could be put to more than a single, specific use. You were the first to fully support developers. You were the first to truly create a platform where friends can influence other friends’ decisions on products, programming languages, and more. You were the first to use a fully open-source platform (before your custom mods [which I still want to see!!]). Most importantly, you are the first to take security and privacy almost as seriously as I do.. at least post facto.
That being said… I hate you. You came into the picture and I had such high hopes for you. Even after your first security issue, I was impressed at how quickly you moved to address it. Just when I finally felt as though my account was getting locked down and safe just the way I like it, you came out with yet another “New Feature!” (Which, sorry… but Myspace beat you to it): The “Facebook Email Address”. This was a great concept, and I was excited to see where you went with it. The Facebook Chat move to XMPP was a wise, and very helpful idea, so I was hoping to see the same from this. Upon further research, however, I noticed that my Facebook Email was the same as my Facebook Profile Name (Example: http://www.facebook.com/MyProfileNameHere), the same one I put in my resume, link friends with, etc. This would be ok I guess, seeing as I would only give out this “email” to the same people who would have my profile name… So I could let that slide.
I had always applauded you for your security in that, unlike other sites, you required users to log in with their personal email address which you never forced them to publicly reveal. I know, I know, that’s still the case… You don’t force me to give out either my personal email address or my facebook email address, at least not directly. By using the Facebook Profile Name as the same information you use for the Facebook Email, it doesn’t take a rocket scientist (or a security researcher for that matter) to connect the dots with other people’s profiles, including people I’m not friends with. Your failure, which I will never understand the reasoning for, was when you decided to give out 50% of my login information to everyone! By making the Facebook Email Address so easy to “guess”, and by permitting users (nearly forcing, as I saw when my @facebook.com email address was auto-populated the first time I went to log in after seeing the notice of it) to log in using their Facebook Email Address, you run into some potential, hopefully obvious, issues.
You’re probably asking yourselves: “Why am I not hating on Twitter about this? They do the same thing!”. You must realize, Twitter is bulit around a completely different platform than Facebook. This is how the two manage to live together in (apparent) harmony. With Twitter, I have very little (actually, none) personal information on there. Twitter is my face to the public. Facebook, on the other hand, is my face to business associates, friends, and family. The place I post semi-private information. The place I want to be able to trust.
My petition and desire is that you enable one of the two security options to clean this up:
1. Disable login with my @facebook.com email completely
2. Give me an option to specify which email I want to log in with
Optionally, I would love to see a feature in Facebook to allow me to control who sees and can access my profile by my Facebook Profile Name. This would also help with this problem, as well as some others
.
Best Regards,
Justin (Jaywalker) Williams
Classy Llama Studios
If you agree, be sure to Digg this to make sure Facebook sees it.
Posted in Security | 4 Comments »
Introducing Wiz, a CLI Tool for Magento
Monday, March 7th, 2011
There is a lot of functionality in Magento that is hard to get to or tedious to work with. There are so many tasks that developers, designers, and administrators do on a daily basis that require time-consuming trips to the Magento backend. If you happen to want to do more than one of those operations, you end up having do each of those tasks one after the other… if only there was a better way!
It is my pleasure to announce Wiz: a command-line interface tool for working with Magento installations. It was built to make your work (and subsequently your life) much easier!
Wiz has a whole bunch of great features, but here are some you’re sure to like:
- Create an admin user (tested in CE & PE)
- Toggle template hints
- Enable/disable module names
- Enable/disable module output
- Run xpath queries over the global config
- Enable/disable/clear caches
- … and more!
Wiz is a work in progress and hasn’t been thoroughly tested with every Magento version out there. However, we’ve been using it with Professional and Community Edition installations without any major problems.
Things planned for future releases:
- Templates for building modules
- Better support for stores and configuration scopes
- More useful utilities like reindexing, cron runs, etc.
Your feedback and bug reports are welcome!
Update: Some screenshots for the curious…

List all modules, versions, and their statuses without going through the backend.

Create an admin user without having to touch the database.

Effortlessly clear, enable, & disable Magento caches.

Enable and disable template hints. Great for theme/skin development.

Dropping easily into MySQL shell for a Magento install.
Posted in Magento, Magento Development, Management | 12 Comments »
Magento Imagine 2011 – “Best Practices for Debugging Magento” assets
Tuesday, February 8th, 2011
I just finished giving a presentation at Magento Imagine conference. I’m posting the link to the Powerpoint and the video I embedded in my presentation:
- Powerpoint presentation: http://bit.ly/fqwvlD
- Eclipse/PDT Debugging walkthrough video: http://bit.ly/fEQ0Ma
Cheers!
Posted in Magento Development | 11 Comments »
Get Configurable Super Attributes
Monday, November 1st, 2010
I wanted to do a check on a configurable product to see if it had a specific attribute. But not just any attribute, a global attribute used to create associated products within the configurable product – a “Super Product Attribute”.
So here ya go:
$_product = $this->getProduct();
$_attributes = $_product->getTypeInstance(true)->getConfigurableAttributes($_product);
foreach($_attributes as $_attribute){
var_dump($_attribute->debug());
}
A little bonus:
The “->debug()” method returns the set of values you can use the get magic method on. For example:
array
'product_super_attribute_id' => string '263' (length=3)
'product_id' => string '27' (length=2)
'attribute_id' => string '80' (length=2)
'position' => string '0' (length=1)
'product_attribute (Mage_Catalog_Model_Resource_Eav_Attribute)' =>
array
'attribute_id' => string '80' (length=2)
'entity_type_id' => string '4' (length=1)
'attribute_code' => string 'color' (length=5)
... |
So var_dump($_attribute->getAttributeId()); will return string ‘80′ (length=2). Just use “get” with the Capitalized Label, getProductAttribute(), getProductId(), getPosition(), etc. Enjoy!
Posted in Development, Magento Development | 3 Comments »


