Magento has possibility to add total row in any grid in admin panel. You just need to use some additional methods in your Grid Block.
In your Grid Block that extended Mage_Adminhtml_Block_Widget_Grid you need to enable row with totals:
protected $_countTotals = true;
and implement method for calculation totals
public function getTotals() { $totals = new Varien_Object(); $fields = array( 'entity_id' => $this->__('Total'), //first column in the grid 'order_number' => 0, //real names of columns, @see method _prepareColumns 'order_amount' => 0, ); foreach ($this->getCollection() as $item) { foreach($fields as $field=>$value){ $fields[$field]+=$item->getData($field); } } $totals->setData($fields); return $totals; }
You will see something like this
Related posts:
How to remove SID from URL?
Sometimes you can see SID part appears in your Magento URLs.
This part is needed for keep customers...
Creating a Custom API for Magento
The Core API allows you to manage a set of common resources used in Magento. However, you may choose...
Magento get Root Category Id
In Magento for getting root category id for current store view you should just run a code
<?php ...
Url friendly string
If you need to transform some string to url-friendly string in Magento you just need to call method ...