Public Member Functions | |
__construct () | |
Protected Member Functions | |
_prepareForm () |
Definition at line 35 of file Form.php.
__construct | ( | ) |
Init class
Reimplemented from Mage_Adminhtml_Block_Widget_Form.
Definition at line 41 of file Form.php.
00042 { 00043 parent::__construct(); 00044 00045 $this->setId('taxRuleForm'); 00046 $this->setTitle(Mage::helper('tax')->__('Tax Rule Information')); 00047 }
_prepareForm | ( | ) | [protected] |
return Mage_Adminhtml_Block_Widget_Form
Reimplemented from Mage_Adminhtml_Block_Widget_Form.
Definition at line 53 of file Form.php.
00054 { 00055 $model = Mage::registry('tax_rule'); 00056 $form = new Varien_Data_Form(array( 00057 'id' => 'edit_form', 00058 'action' => $this->getData('action'), 00059 'method' => 'post' 00060 )); 00061 00062 $fieldset = $form->addFieldset('base_fieldset', array( 00063 'legend' => Mage::helper('tax')->__('Tax Rule Information') 00064 )); 00065 00066 $productClasses = Mage::getModel('tax/class') 00067 ->getCollection() 00068 ->setClassTypeFilter('PRODUCT') 00069 ->toOptionArray(); 00070 00071 $customerClasses = Mage::getModel('tax/class') 00072 ->getCollection() 00073 ->setClassTypeFilter('CUSTOMER') 00074 ->toOptionArray(); 00075 00076 $rates = Mage::getModel('tax/calculation_rate') 00077 ->getCollection() 00078 ->toOptionArray(); 00079 00080 $fieldset->addField('code', 'text', 00081 array( 00082 'name' => 'code', 00083 'label' => Mage::helper('tax')->__('Name'), 00084 'class' => 'required-entry', 00085 'required' => true, 00086 ) 00087 ); 00088 00089 $fieldset->addField('tax_customer_class', 'multiselect', 00090 array( 00091 'name' => 'tax_customer_class', 00092 'label' => Mage::helper('tax')->__('Customer Tax Class'), 00093 'class' => 'required-entry', 00094 'values' => $customerClasses, 00095 'value' => $model->getCustomerTaxClasses(), 00096 'required' => true, 00097 ) 00098 ); 00099 00100 $fieldset->addField('tax_product_class', 'multiselect', 00101 array( 00102 'name' => 'tax_product_class', 00103 'label' => Mage::helper('tax')->__('Product Tax Class'), 00104 'class' => 'required-entry', 00105 'values' => $productClasses, 00106 'value' => $model->getProductTaxClasses(), 00107 'required' => true, 00108 ) 00109 ); 00110 00111 $fieldset->addField('tax_rate', 'multiselect', 00112 array( 00113 'name' => 'tax_rate', 00114 'label' => Mage::helper('tax')->__('Tax Rate'), 00115 'class' => 'required-entry', 00116 'values' => $rates, 00117 'value' => $model->getRates(), 00118 'required' => true, 00119 ) 00120 ); 00121 $fieldset->addField('priority', 'text', 00122 array( 00123 'name' => 'priority', 00124 'label' => Mage::helper('tax')->__('Priority'), 00125 'class' => 'validate-not-negative-number', 00126 'value' => (int) $model->getPriority(), 00127 'required' => true, 00128 'note' => Mage::helper('tax')->__('Tax rates at the same priority are added, others are compounded.'), 00129 ) 00130 ); 00131 $fieldset->addField('position', 'text', 00132 array( 00133 'name' => 'position', 00134 'label' => Mage::helper('tax')->__('Sort Order'), 00135 'class' => 'validate-not-negative-number', 00136 'value' => (int) $model->getPosition(), 00137 'required' => true, 00138 ) 00139 ); 00140 00141 if ($model->getId() > 0 ) { 00142 $fieldset->addField('tax_calculation_rule_id', 'hidden', 00143 array( 00144 'name' => 'tax_calculation_rule_id', 00145 'value' => $model->getId(), 00146 'no_span' => true 00147 ) 00148 ); 00149 } 00150 00151 $form->addValues($model->getData()); 00152 $form->setAction($this->getUrl('*/tax_rule/save')); 00153 $form->setUseContainer(true); 00154 $this->setForm($form); 00155 00156 return parent::_prepareForm(); 00157 }