10 Concepts Magento Developers Should Know

Magento is an ecommerce platform built on open source technology.  If you are new to Magento it may seem difficult to know where to start, as there just seems to be so many things to do at once. Everyone has their own idea of how to use the application, but if you don’t know where to start, you might want to keep these concepts in mind.

1. Magento Observers

Because Magento is event driven, so the observer pattern is often used. This application maintains a list of all its observers, and Magento will notify them in case of changes. Here is an example of Magento’s observers and events.

if (!$this->getIsInStock()) {
 ->setMessage($_helper->__('This product is currently out of stock.'))
 ->setQuoteMessage($_helper->__('Some of the products are currently out of stock'))
 return $result;

With the code above, you will be able to verify any information about a product before it is added to any cart. With this code you don’t even need to know the product name to get all the facts. But really this is one of the simplest codes and there are more powerful codes that you can use.

2. Collections

Magento has a powerful collection and it is very flexible. Here is an example that will show you how powerful it can be. There are a lot of tutorials about Magento collections but this should give you an idea of just what it can do.

$collection = Mage::getModel('catalog/product')->getCollection();
 foreach ($collection as $product){
 echo $product->getData('brand');

And here:

$collection = Mage::getModel('catalog/product')->getCollection();
 $collection->addAttributeToFilter('type_id', array('eq'=>Mage_Catalog_Model_Product_Type::TYPE_SIMPLE));

3. Check the Layouts

This is one of the most impressive features of Magento, and it is what sets the e-commerce application apart from others. With its catalog/product/view.phtml you get something that out of the box types will find very useful.

These layouts are very flexible and can handle different kinds of products. In addition you can use these layouts to customize a product and apply different styles. And you can make the changes without working on any template code.

Here is a good example:

<reference name="product.info">
 <!-- <action method="unsetChild"><name>description</name></action> -->
 <action method="unsetChild"><name>additional</name></action>
 <block type="catalog/product_view_attributes" name="tab1" as="specs" template="catalog/product/view/tab1.phtml">
 <action method="addToParentGroup"><group>detailed_info</group></action>
 <action method="setTitle" translate="value"><value>Specs</value></action>
 <block type="catalog/product_view_attributes" name="tab2" as="fabric" template="catalog/product/view/tab2.phtml">
 <action method="addToParentGroup"><group>detailed_info</group></action>
 <action method="setTitle" translate="value"><value>Fabric</value></action>

4. Magento admin html

Magento’s admin html is much better than its OOP. Also keep in mind that developments take place in the admin and much of the work is very easy. Creating skeletons in the program is very straightforward and there are a lot of things you can do with it. Also, renderers should be utilized only if you cannot use SQL.

5. The Core Library

Its core library is set upon the Zend Framework and is pretty good. However, their finest codes are classes not in the code pools. These classes have many features such as the autoload plus several handy tools.

6. Controllers

What makes Magento work so well is their controllers are very simple, as is its routing. There are a lot of things that you need to know about these controllers, but there are two areas here: admin and frontend. The no routes and CMS pages also have their respective controllers.

Magento’s MVC (Model-View-Controller) architecture can be traced back to Xerox Parc, but Magento developers have done a great job with this one. The one thing you need to remember about Magento controllers is that all the controllers can access the Response and Request objects.

To get the information just use:

 $request->getServer(‘param’), not the $_REQUEST arrays or $_GET, $_POST.

7. Cron PHP

PHP is good, but cron jobs are better, and Magento has support for it. Not only does the application have a very good .cron.php file that permits you to put a crontab node at your module config. For this to work you need to use the following syntax.

 <schedule><cron_expr>0 1 * * *</cron_expr></schedule>

8. Full Page Caching

Magento’s full page cache may seem complex but it does the job. In addition you can configure the application FPC to regenerate every so often. This is a really good feature because it saves the trouble of dealing with cache invalidation.

What makes this cache very useful is that it works as a technique for copying web content. It does this by copying the a URL’s output at a cache container This feature naturally has many benefits such as reducing database stress, lower memory consumption and most importantly keep bandwidth usage to a minimum.

To give you an idea of how the cache works, here is the Mage_Core_Model_App run function.

 * Run application. Run process responsible for request processing and sending response.
 * List of supported parameters:
 * scope_code - code of default scope (website/store_group/store code)
 * scope_type - type of default scope (website/group/store)
 * options - configuration options
 * @param array $params application run parameters
 * @return Mage_Core_Model_App
 public function run($params)
 $options = isset($params['options']) ? $params['options'] : array();
 Mage::register('application_params', $params);
if ($this->_cache->processRequest()) {
 } else {
 $this->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
if ($this->_config->isLocalConfigLoaded()) {
 $scopeCode = isset($params['scope_code']) ? $params['scope_code'] : '';
 $scopeType = isset($params['scope_type']) ? $params['scope_type'] : 'store';
 $this->_initCurrentStore($scopeCode, $scopeType);
 return $this;

9. Translation

The Magento translation isn’t really translation but more like string replacements. In addition you can use it for theme level translation which can be very useful. By simply using the translation you can begin to change labels and messages to dig into code or templates.

10. Important Files

There are many important files in Magento but three of the most important are indexer.php, log.php and compiler.php. These have a lot of features so you should get familiar with them. Make no mistake about it, they are very important and essential for your e-commerce business.

These are just some of the most common concepts that you should know about Magento. What has been given here is just an overview, so use the information provided her to go further in-depth and master the program. This will take time, but the information here will make a huge difference. For a developer, learning these concepts will be absolutely necessary.

Bio: Rachel Fowler is a choreographer for http://bigdropinc.com/. They offer an excellent video production service to make your brand stand out.


One thought on “10 Concepts Magento Developers Should Know

  1. As magento is an open source content management system each and every developer must know all the concepts of magento. This post has already described some of the concepts but there are many more which will be useful for Responsive Web Design.
    Thank you for sharing your post and will be waiting for more posts related to Content Management System. Magento has build up its own identity and it is very easy to use for new comers also.
    Thank you once again.

Add Comment