Example #1
0
 /**
  * Get Element Html
  *
  * @return string
  */
 public function getElementHtml()
 {
     $elementHtml = parent::getElementHtml();
     $switchAttributeCode = $this->getAttribute()->getAttributeCode() . '_type';
     $switchAttributeValue = $this->getProduct()->getData($switchAttributeCode);
     $html = '<select style="display:none;" name="product[' . $switchAttributeCode . ']" id="' . $switchAttributeCode . '" type="select" class="required-entry select next-toinput"' . ($this->getProduct()->getId() && $this->getAttribute()->getAttributeCode() == 'price' || $this->getElement()->getReadonly() ? ' disabled="disabled"' : '') . '>
         <option value="">' . $this->__('-- Select --') . '</option>
         <option value="' . self::DYNAMIC . '">' . $this->__('Dynamic') . '</option>
         <option selected="selected" value="' . self::FIXED . '">' . $this->__('Fixed') . '</option>
     </select>';
     if (!($this->getAttribute()->getAttributeCode() == 'price' && $this->getCanReadPrice() === false)) {
         $html .= '<span class="next-toselect">' . $elementHtml . '</span>';
     }
     if ($this->getDisableChild() && !$this->getElement()->getReadonly()) {
         $html .= "<script type=\"text/javascript\">\r\n                function " . $switchAttributeCode . "_change() {\r\n                    if (\$('" . $switchAttributeCode . "').value == '" . self::DYNAMIC . "') {\r\n                        if (\$('" . $this->getAttribute()->getAttributeCode() . "')) {\r\n                            \$('" . $this->getAttribute()->getAttributeCode() . "').disabled = true;\r\n                            \$('" . $this->getAttribute()->getAttributeCode() . "').value = '';\r\n                            \$('" . $this->getAttribute()->getAttributeCode() . "').removeClassName('required-entry');\r\n                        }\r\n\r\n                        if (\$('dynamic-price-warrning')) {\r\n                            \$('dynamic-price-warrning').show();\r\n                        }\r\n                    } else {\r\n                        if (\$('" . $this->getAttribute()->getAttributeCode() . "')) {";
         if ($this->getAttribute()->getAttributeCode() == 'price' && $this->getCanEditPrice() === false && $this->getCanReadPrice() === true && $this->getProduct()->isObjectNew()) {
             $defaultProductPrice = $this->getDefaultProductPrice() ? $this->getDefaultProductPrice() : "''";
             $html .= "\$('" . $this->getAttribute()->getAttributeCode() . "').value = " . $defaultProductPrice . ";";
         } else {
             $html .= "\$('" . $this->getAttribute()->getAttributeCode() . "').disabled = false;\r\n                          \$('" . $this->getAttribute()->getAttributeCode() . "').addClassName('required-entry');";
         }
         $html .= "}\r\n\r\n                        if (\$('dynamic-price-warrning')) {\r\n                            \$('dynamic-price-warrning').hide();\r\n                        }\r\n                    }\r\n                }";
         if (!($this->getAttribute()->getAttributeCode() == 'price' && !$this->getCanEditPrice() && !$this->getProduct()->isObjectNew())) {
             $html .= "\$('" . $switchAttributeCode . "').observe('change', " . $switchAttributeCode . "_change);";
         }
         $html .= $switchAttributeCode . "_change();\r\n            </script>";
     }
     return $html;
 }
Example #2
0
 public function getElementHtml()
 {
     $elementHtml = parent::getElementHtml();
     $switchAttributeCode = $this->getAttribute()->getAttributeCode() . '_type';
     $switchAttributeValue = $this->getProduct()->getData($switchAttributeCode);
     $html = '<select name="product[' . $switchAttributeCode . ']" id="' . $switchAttributeCode . '" type="select" class="required-entry select next-toinput"' . ($this->getProduct()->getId() && $this->getAttribute()->getAttributeCode() == 'price' || $this->getElement()->getReadonly() ? ' disabled="disabled"' : '') . '>
         <option value="">' . $this->__('-- Select --') . '</option>
         <option ' . ($switchAttributeValue == self::DYNAMIC ? 'selected' : '') . ' value="' . self::DYNAMIC . '">' . $this->__('Dynamic') . '</option>
         <option ' . ($switchAttributeValue == self::FIXED ? 'selected' : '') . ' value="' . self::FIXED . '">' . $this->__('Fixed') . '</option>
     </select>';
     $html .= '<span class="next-toselect">' . $elementHtml . '</span>';
     if ($this->getDisableChild() && !$this->getElement()->getReadonly()) {
         $html .= "<script type=\"text/javascript\">\n                function " . $switchAttributeCode . "_change() {\n                    if (\$('" . $switchAttributeCode . "').value == '" . self::DYNAMIC . "') {\n                        \$('" . $this->getAttribute()->getAttributeCode() . "').disabled = true;\n                        \$('" . $this->getAttribute()->getAttributeCode() . "').value = '';\n                        \$('" . $this->getAttribute()->getAttributeCode() . "').removeClassName('required-entry');\n\n                        if (\$('dynamic-price-warrning')) {\n                            \$('dynamic-price-warrning').show();\n                        }\n                    } else {\n                        \$('" . $this->getAttribute()->getAttributeCode() . "').disabled = false;\n                        \$('" . $this->getAttribute()->getAttributeCode() . "').addClassName('required-entry');\n\n                        if (\$('dynamic-price-warrning')) {\n                            \$('dynamic-price-warrning').hide();\n                        }\n                    }\n                }\n\n                \$('" . $switchAttributeCode . "').observe('change', " . $switchAttributeCode . "_change);\n                " . $switchAttributeCode . "_change();\n            </script>";
     }
     return $html;
 }
Example #3
0
 public function getElementHtml()
 {
     $element = $this->getElement();
     $params = $this->getRequest()->getParams();
     if ($params['id']) {
         $product = Mage::getModel('catalog/product')->load($params['id']);
         if ($product) {
             switch ($product->getTypeId()) {
                 case 'simple':
                 case 'virtual':
                 case 'downloadable':
                     return parent::getElementHtml();
                     break;
                 case 'grouped':
                 case 'bundle':
                 case 'configurable':
                     return parent::getElementHtml() . "<script type='text/javascript'>var mwSetPoints = new MW.ProductView()</script>";
                     /*$block = $this->getLayout()->createBlock('rewardpoints/adminhtml_sellproducts_edit_tab_grid');
                                                 $block->setSingle(true);
                                                 $block->setFilterVisible(false);
                                                 $block->setPagerVisible(false);
                                                 $block->setProductId($product->getId());
                     
                                                 $data     = array(
                                                     'name'    => 'mw_show_hide_sell_point',
                                                     'class'   => 'mw_show_hide_sell_point',
                                                     'label'   => 'Show/Hide',
                                                     'value'   => 1,
                                                     'checked' => true
                                                 );
                                                 $checkbox = new Varien_Data_Form_Element_Checkbox($data);
                                                 $checkbox->setForm($element->getForm());
                     
                                                 $script        = "<script type='text/javascript'>var mwViewSellPoint = new MW.ProductView.SellPoint()</script>";
                                                 $html_renderer = $checkbox->getElementHtml() .
                                                     $checkbox->getLabelHtml() .
                                                     "<div class='mw-sell-point-product'>" .
                                                     $block->toHtml() .
                                                     "</div>" .
                                                     $script;
                     
                                                 return $html_renderer;*/
                     break;
             }
         }
     }
 }
Example #4
0
 public function getElementHtml()
 {
     $element = $this->getElement();
     if (!$element->getValue()) {
         return parent::getElementHtml();
     }
     $element->setOnkeyup("onUrlkeyChanged('" . $element->getHtmlId() . "')");
     $element->setOnchange("onUrlkeyChanged('" . $element->getHtmlId() . "')");
     $data = array('name' => $element->getData('name') . '_create_redirect', 'disabled' => true);
     $hidden = new Varien_Data_Form_Element_Hidden($data);
     $hidden->setForm($element->getForm());
     $storeId = $element->getForm()->getDataObject()->getStoreId();
     $data['html_id'] = $element->getHtmlId() . '_create_redirect';
     $data['label'] = Mage::helper('catalog')->__('Create Permanent Redirect for old URL');
     $data['value'] = $element->getValue();
     $data['checked'] = Mage::helper('catalog')->shouldSaveUrlRewritesHistory($storeId);
     $checkbox = new Varien_Data_Form_Element_Checkbox($data);
     $checkbox->setForm($element->getForm());
     return parent::getElementHtml() . '<br/>' . $hidden->getElementHtml() . $checkbox->getElementHtml() . $checkbox->getLabelHtml();
 }
Example #5
0
 public function getElementHtml()
 {
     $element = $this->getElement();
     $params = $this->getRequest()->getParams();
     if ($params['id']) {
         $product = Mage::getModel('catalog/product')->load($params['id']);
         foreach ($product->getOptions() as $option) {
         }
         if ($product) {
             switch ($product->getTypeId()) {
                 case 'simple':
                 case 'virtual':
                 case 'downloadable':
                     return parent::getElementHtml();
                     break;
                 case 'grouped':
                 case 'bundle':
                 case 'configurable':
                     $block = $this->getLayout()->createBlock('rewardpoints/adminhtml_gridboth');
                     $block->setSingle(true);
                     $block->setFilterVisible(false);
                     $block->setPagerVisible(false);
                     $block->setProductId($product->getId());
                     $block->setProduct($product);
                     if ($product->getTypeId() == 'configurable') {
                         $block->setIsConfigurable();
                     }
                     $data = array('name' => 'mw_show_hide_set_point', 'class' => 'mw_show_hide_set_point', 'label' => 'Set for this product?', 'value' => 0, 'checked' => false);
                     $checkbox = new Varien_Data_Form_Element_Checkbox($data);
                     $checkbox->setForm($element->getForm());
                     $html_renderer = $checkbox->getElementHtml() . "<span id='mw-lb-set-point'>" . $checkbox->getLabelHtml() . "</span>" . "<div class='mw-reward-point-product'>" . $block->toHtml() . "</div>" . "<div class='mw-reward-point-input' style='display:none'>" . parent::getElementHtml() . "</div>";
                     return $html_renderer;
                     break;
             }
         }
     }
 }