Monthly Archives: January 2013

Magento Customize Toolbar for list page

Some times we need to show the toolbar as per our need ,But magento had show same tool bar at the bottom and top of listing page

so in order to change the toolbar we can customize is such a way that top toolbar will be different and bottom toolbar will be different

1) First open list.phtml,you will find getToolbarHtml() function at the top  and at the bottom in order to change the bottom toolbar we just add the following code


<?php //echo $this->getToolbarHtml() ?>


<?php  echo $this->getToolbarBlock()->setTemplate('catalog/product/list/toolbar_bottom.phtml')->toHtml(); ?>

2) Second create the new file “toolbar_bottom.phtml” in catalog/product/list and add the customize code as per the need

Hope this will help you!


Magento models, resource models, and collections

Every Module of Magento Uses Model,Resource Models and Collections.But some time we get confused between this so let’s understand in simple way 

A “model” is used to store data, and perhaps performs some business logics against that we create model in every Module to Write some Business Logic
A “resource model” is used to interact with the database on behalf of the “model”. The “resource model” actually performs the CRUD operations.
A “collection model” holds from one to many “models” and knows how to tell the “resource model” to get rows in the basis of information it is given.
There’s a basic ActiveRecord-like one-object-one-table Model, and there’s also an Entity Attribute Value (EAV) Model.
Hope this will Help you!

Magento Stages in life Cycle of Block

Blocks are the main part of the Magento so it has own life cycle .so how it works

1) Blocks are declared in layout XML or instantiated using PHP code
2) After instantiation the _construct() and _prepareLayout() methods are called
3) The controller’s renderLayout() method calls toHtml(); all children are rendered
4) _beforeToHtml(), _toHtml() and _afterToHtml

Hope this will help you