Varien

Varien

Magento is the robust and flexible open-source shopping cart. It is ecommerce web application launched on 31st March, 2008 and created by Varien. It is built on components of Zend Framework. As Magento is powerful and flexible, it has steep learning curve. If you have knowledge of HTML and CSS and know somewhat of PHP and MySQL then you can have enterprise class shopping cart running in no time. Magento is available under the Open Software License version 3.0. Varien is now Magento Inc. Varien, the company that owns Magento, formerly worked with



osCommerce. They originally planned to split osCommerce but later decided to rewrite it as Magento. Magento officially started development in early 2007. Seven months later the first public beta version was released. On May 30, 2010 Magento mobile was released, it allows store owners to create native mobile storefront apps. Magento supports installation of modules through a web-based interface accessible through the administration area of a Magento installation. Modules are hosted on the Magento e-Commerce website as a PEAR server. Any community member can upload a module through the website and is made available once confirmed by a member of the Magento team. Modules are installed by entering a module key, available on the module page, into the web based interface.


Magento developers are familiar with the MVC (Model View Controller) design pattern that is everywhere throughout web frameworks. In the code of Magento, there are many other components besides the M's the V's and the C's. Each module contains the Controller and Model. Within each module, there are no Views. You will find extra tidbits, such as "helper", "etc" and "sql". In these modules there is also the sort of files which we very often work with. This article will try to describe just what a Block is and how it is used. A top priority of Object Oriented Programming is the decoupling of code which means that code should have the least amount of dependency on other code as possible. Blocks are part of Magento solution to keep the application loosely coupled.


A quick introduction on MVC: When a page in Magento is called, the URL tells Magento what code to run. This is done via a "router" which calls upon a selected Controller to do its work. The URL gets "routed" to a particular Controller, which in turns tells Magento what to do. The Catalog controller, for example, is responsible for telling Magento to load a product collection and then show those products to us. The Controller tells Magento which layout is to be used. This determines which modules are put into place, which in turn tells Magento what Views to output. The data from the Models are given to the Views to be displayed. In the scheme of things here, Blocks fit roughly between the View and the Model.


Magento has sets of modules. Modules act as their own little entities, each containing their own M's V's and C's. These modules create the separate areas within a typical Magento page; the header, header links, mini cart, recently viewed products, static HTML blocks, footer, and so on. Basically, comprised within any given web page are multiple modules, each of which call their own Views.


On any given page request, Magento needs to be able to show a certain set of modules. The possibility of many sets of modules to be displayed on any given page means a decoupling is necessary amongst the Controller, the Models/Blocks and their Views. Blocks allow this decoupling by enabling the module to get its data from its


Models, and push out the data to the Views which display the relevant data. Each functional area of a page can then act separately. In this way, we can decide when we want to show a certain functional area. We can tell it to show up on product pages, but not CMS pages. We can move it from the right to the left column, to the center, to the header, to the footer, or to a defined area we create!



Varien



Big image