1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Block_Promo_Catalog_Edit_Tab_Actions
35: extends Mage_Adminhtml_Block_Widget_Form
36: implements Mage_Adminhtml_Block_Widget_Tab_Interface
37: {
38: 39: 40: 41: 42:
43: public function getTabLabel()
44: {
45: return Mage::helper('catalogrule')->__('Actions');
46: }
47:
48: 49: 50: 51: 52:
53: public function getTabTitle()
54: {
55: return Mage::helper('catalogrule')->__('Actions');
56: }
57:
58: 59: 60: 61: 62:
63: public function canShowTab()
64: {
65: return true;
66: }
67:
68: 69: 70: 71: 72:
73: public function isHidden()
74: {
75: return false;
76: }
77:
78: protected function _prepareForm()
79: {
80: $model = Mage::registry('current_promo_catalog_rule');
81:
82: $form = new Varien_Data_Form();
83:
84: $form->setHtmlIdPrefix('rule_');
85:
86: $fieldset = $form->addFieldset('action_fieldset', array(
87: 'legend' => Mage::helper('catalogrule')->__('Update Prices Using the Following Information')
88: )
89: );
90:
91: $fieldset->addField('simple_action', 'select', array(
92: 'label' => Mage::helper('catalogrule')->__('Apply'),
93: 'name' => 'simple_action',
94: 'options' => array(
95: 'by_percent' => Mage::helper('catalogrule')->__('By Percentage of the Original Price'),
96: 'by_fixed' => Mage::helper('catalogrule')->__('By Fixed Amount'),
97: 'to_percent' => Mage::helper('catalogrule')->__('To Percentage of the Original Price'),
98: 'to_fixed' => Mage::helper('catalogrule')->__('To Fixed Amount'),
99: ),
100: ));
101:
102: $fieldset->addField('discount_amount', 'text', array(
103: 'name' => 'discount_amount',
104: 'required' => true,
105: 'class' => 'validate-not-negative-number',
106: 'label' => Mage::helper('catalogrule')->__('Discount Amount'),
107: ));
108:
109: $fieldset->addField('sub_is_enable', 'select', array(
110: 'name' => 'sub_is_enable',
111: 'label' => Mage::helper('catalogrule')->__('Enable Discount to Subproducts'),
112: 'title' => Mage::helper('catalogrule')->__('Enable Discount to Subproducts'),
113: 'onchange' => 'hideShowSubproductOptions(this);',
114: 'values' => array(
115: 0 => Mage::helper('catalogrule')->__('No'),
116: 1 => Mage::helper('catalogrule')->__('Yes')
117: )
118: ));
119:
120: $fieldset->addField('sub_simple_action', 'select', array(
121: 'label' => Mage::helper('catalogrule')->__('Apply'),
122: 'name' => 'sub_simple_action',
123: 'options' => array(
124: 'by_percent' => Mage::helper('catalogrule')->__('By Percentage of the Original Price'),
125: 'by_fixed' => Mage::helper('catalogrule')->__('By Fixed Amount'),
126: 'to_percent' => Mage::helper('catalogrule')->__('To Percentage of the Original Price'),
127: 'to_fixed' => Mage::helper('catalogrule')->__('To Fixed Amount'),
128: ),
129: ));
130:
131: $fieldset->addField('sub_discount_amount', 'text', array(
132: 'name' => 'sub_discount_amount',
133: 'required' => true,
134: 'class' => 'validate-not-negative-number',
135: 'label' => Mage::helper('catalogrule')->__('Discount Amount'),
136: ));
137:
138: $fieldset->addField('stop_rules_processing', 'select', array(
139: 'label' => Mage::helper('catalogrule')->__('Stop Further Rules Processing'),
140: 'title' => Mage::helper('catalogrule')->__('Stop Further Rules Processing'),
141: 'name' => 'stop_rules_processing',
142: 'options' => array(
143: '1' => Mage::helper('catalogrule')->__('Yes'),
144: '0' => Mage::helper('catalogrule')->__('No'),
145: ),
146: ));
147:
148: $form->setValues($model->getData());
149:
150:
151:
152: if ($model->isReadonly()) {
153: foreach ($fieldset->getElements() as $element) {
154: $element->setReadonly(true, true);
155: }
156: }
157:
158: $this->setForm($form);
159:
160: return parent::_prepareForm();
161: }
162: }
163: