00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Actions extends Mage_Adminhtml_Block_Widget_Form
00036 {
00037 protected function _prepareForm()
00038 {
00039 $model = Mage::registry('current_promo_quote_rule');
00040
00041
00042 $form = new Varien_Data_Form();
00043
00044 $form->setHtmlIdPrefix('rule_');
00045
00046 $fieldset = $form->addFieldset('action_fieldset', array('legend'=>Mage::helper('salesrule')->__('Update prices using the following information')));
00047
00048 $fieldset->addField('simple_action', 'select', array(
00049 'label' => Mage::helper('salesrule')->__('Apply'),
00050 'name' => 'simple_action',
00051 'options' => array(
00052 'by_percent' => Mage::helper('salesrule')->__('Percent of product price discount'),
00053 'by_fixed' => Mage::helper('salesrule')->__('Fixed amount discount'),
00054 'cart_fixed' => Mage::helper('salesrule')->__('Fixed amount discount for whole cart'),
00055 'buy_x_get_y' => Mage::helper('salesrule')->__('Buy X get Y free (discount amount is Y)'),
00056 ),
00057 ));
00058 $fieldset->addField('discount_amount', 'text', array(
00059 'name' => 'discount_amount',
00060 'required' => true,
00061 'class' => 'validate-not-negative-number',
00062 'label' => Mage::helper('salesrule')->__('Discount amount'),
00063 ));
00064 $model->setDiscountAmount($model->getDiscountAmount()*1);
00065
00066 $fieldset->addField('discount_qty', 'text', array(
00067 'name' => 'discount_qty',
00068 'label' => Mage::helper('salesrule')->__('Maximum Qty Discount is Applied to'),
00069 ));
00070 $model->setDiscountQty($model->getDiscountQty()*1);
00071
00072 $fieldset->addField('discount_step', 'text', array(
00073 'name' => 'discount_step',
00074 'label' => Mage::helper('salesrule')->__('Discount Qty Step (Buy X)'),
00075 ));
00076
00077 $fieldset->addField('simple_free_shipping', 'select', array(
00078 'label' => Mage::helper('salesrule')->__('Free shipping'),
00079 'title' => Mage::helper('salesrule')->__('Free shipping'),
00080 'name' => 'simple_free_shipping',
00081 'options' => array(
00082 0 => Mage::helper('salesrule')->__('No'),
00083 Mage_SalesRule_Model_Rule::FREE_SHIPPING_ITEM => Mage::helper('salesrule')->__('For matching items only'),
00084 Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS => Mage::helper('salesrule')->__('For shipment with matching items'),
00085 ),
00086 ));
00087
00088 $fieldset->addField('stop_rules_processing', 'select', array(
00089 'label' => Mage::helper('salesrule')->__('Stop further rules processing'),
00090 'title' => Mage::helper('salesrule')->__('Stop further rules processing'),
00091 'name' => 'stop_rules_processing',
00092 'options' => array(
00093 '1' => Mage::helper('salesrule')->__('Yes'),
00094 '0' => Mage::helper('salesrule')->__('No'),
00095 ),
00096 ));
00097
00098 $renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')
00099 ->setTemplate('promo/fieldset.phtml')
00100 ->setNewChildUrl($this->getUrl('*/promo_quote/newActionHtml/form/rule_actions_fieldset'));
00101
00102 $fieldset = $form->addFieldset('actions_fieldset', array(
00103 'legend'=>Mage::helper('salesrule')->__('Apply the rule only to cart items matching the following conditions (leave blank for all items)')
00104 ))->setRenderer($renderer);
00105
00106 $fieldset->addField('actions', 'text', array(
00107 'name' => 'actions',
00108 'label' => Mage::helper('salesrule')->__('Apply to'),
00109 'title' => Mage::helper('salesrule')->__('Apply to'),
00110 'required' => true,
00111 ))->setRule($model)->setRenderer(Mage::getBlockSingleton('rule/actions'));
00112
00113 $form->setValues($model->getData());
00114
00115 if ($model->isReadonly()) {
00116 foreach ($fieldset->getElements() as $element) {
00117 $element->setReadonly(true, true);
00118 }
00119 }
00120
00121
00122 $this->setForm($form);
00123
00124 return parent::_prepareForm();
00125 }
00126
00127 }