Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Actions Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Actions:

Mage_Adminhtml_Block_Widget_Form Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Protected Member Functions

 _prepareForm ()


Detailed Description

Definition at line 35 of file Actions.php.


Member Function Documentation

_prepareForm (  )  [protected]

Prepare form before rendering HTML

Returns:
Mage_Adminhtml_Block_Widget_Form

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 37 of file Actions.php.

00038     {
00039         $model = Mage::registry('current_promo_quote_rule');
00040 
00041         //$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post'));
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         //$form->setUseContainer(true);
00121 
00122         $this->setForm($form);
00123 
00124         return parent::_prepareForm();
00125     }


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

Generated on Sat Jul 4 17:22:54 2009 for Magento by  doxygen 1.5.8