Mage_Adminhtml_Block_Tax_Rule_Grid Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Tax_Rule_Grid:

Mage_Adminhtml_Block_Widget_Grid Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getRowUrl ($row)

Protected Member Functions

 _prepareCollection ()
 _addColumnFilterToCollection ($column)
 _prepareColumns ()


Detailed Description

Definition at line 26 of file Grid.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 29 of file Grid.php.

00030     {
00031         parent::__construct();
00032         $this->setDefaultSort('tax_rule_id');
00033         $this->setId('taxRuleGrid');
00034         $this->setDefaultDir('asc');
00035         $this->setSaveParametersInSession(true);
00036     }


Member Function Documentation

_addColumnFilterToCollection ( column  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 53 of file Grid.php.

00054     {
00055         if ($this->getCollection()) {
00056             switch ($column->getId()) {
00057                 case 'tax_rates':
00058                     $this->getCollection()->joinCalculationData('rate');
00059                     break;
00060 
00061                 case 'customer_tax_classes':
00062                     $this->getCollection()->joinCalculationData('ctc');
00063                     break;
00064 
00065                 case 'product_tax_classes':
00066                     $this->getCollection()->joinCalculationData('ptc');
00067                     break;
00068 
00069             }
00070         }
00071         return parent::_addColumnFilterToCollection($column);
00072     }

_prepareCollection (  )  [protected]

Prepare grid collection object

Returns:
this

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 38 of file Grid.php.

00039     {
00040         $collection = Mage::getModel('tax/calculation_rule')
00041             ->getCollection();
00042         $this->setCollection($collection);
00043         parent::_prepareCollection();
00044         if ($this->getCollection()) {
00045             $this->getCollection()
00046                 ->addCustomerTaxClassesToResult()
00047                 ->addProductTaxClassesToResult()
00048                 ->addRatesToResult();
00049         }
00050         return $this;
00051     }

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 74 of file Grid.php.

00075     {
00076         $this->addColumn('code',
00077             array(
00078                 'header'=>Mage::helper('tax')->__('Name'),
00079                 'align' =>'left',
00080                 'index' => 'code',
00081                 'filter_index' => 'code',
00082             )
00083         );
00084 
00085         $this->addColumn('customer_tax_classes',
00086             array(
00087                 'header'=>Mage::helper('tax')->__('Customer Tax Class'),
00088                 'sortable'  => false,
00089                 'align' =>'left',
00090                 'index' => 'customer_tax_classes',
00091                 'filter_index' => 'ctc.customer_tax_class_id',
00092                 'type'    => 'options',
00093                 'options' => Mage::getModel('tax/class')->getCollection()->setClassTypeFilter('CUSTOMER')->toOptionHash(),
00094             )
00095         );
00096 
00097         $this->addColumn('product_tax_classes',
00098             array(
00099                 'header'=>Mage::helper('tax')->__('Product Tax Class'),
00100                 'sortable'  => false,
00101                 'align' =>'left',
00102                 'index' => 'product_tax_classes',
00103                 'filter_index' => 'ptc.product_tax_class_id',
00104                 'type'    => 'options',
00105                 'options' => Mage::getModel('tax/class')->getCollection()->setClassTypeFilter('PRODUCT')->toOptionHash(),
00106             )
00107         );
00108 
00109         $this->addColumn('tax_rates',
00110             array(
00111                 'sortable'  => false,
00112                 'header'  => Mage::helper('tax')->__('Tax Rate'),
00113                 'align'   => 'left',
00114                 'index'   => 'tax_rates',
00115                 'filter_index' => 'rate.tax_calculation_rate_id',
00116                 'type'    => 'options',
00117                 'options' => Mage::getModel('tax/calculation_rate')->getCollection()->toOptionHash(),
00118             )
00119         );
00120 
00121         $this->addColumn('priority',
00122             array(
00123                 'header'=>Mage::helper('tax')->__('Priority'),
00124                 'width' => '50px',
00125                 'index' => 'priority'
00126             )
00127         );
00128 
00129         $this->addColumn('position',
00130             array(
00131                 'header'=>Mage::helper('tax')->__('Sort Order'),
00132                 'width' => '50px',
00133                 'index' => 'position'
00134             )
00135         );
00136 
00137         $actionsUrl = $this->getUrl('*/*/');
00138 
00139         return parent::_prepareColumns();
00140     }

getRowUrl ( row  ) 

Definition at line 142 of file Grid.php.

00143     {
00144         return $this->getUrl('*/*/edit', array('rule' => $row->getId()));
00145     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:06 2009 for Magento by  doxygen 1.5.8