/** * Load Wysiwyg on demand and prepare layout */ protected function _prepareLayout() { parent::_prepareLayout(); if (Mage::helper('catalog')->isModuleEnabled('Mage_Cms') && Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) { $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); } }
/** * Prepare attributes form of bundle product * * @return void */ protected function _prepareForm() { parent::_prepareForm(); $special_price = $this->getForm()->getElement('special_price'); if ($special_price) { $special_price->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_special')->setDisableChild(false)); } $sku = $this->getForm()->getElement('sku'); if ($sku) { $sku->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_extend')->setDisableChild(false)); } $price = $this->getForm()->getElement('price'); if ($price) { $price->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_extend', 'adminhtml.catalog.product.bundle.edit.tab.attributes.price')->setDisableChild(true)); } $tax = $this->getForm()->getElement('tax_class_id'); if ($tax) { $tax->setAfterElementHtml('<script type="text/javascript">' . "\r\n function changeTaxClassId() {\r\n if (\$('price_type').value == '" . Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC . "') {\r\n \$('tax_class_id').disabled = true;\r\n \$('tax_class_id').value = '0';\r\n \$('tax_class_id').removeClassName('required-entry');\r\n if (\$('advice-required-entry-tax_class_id')) {\r\n \$('advice-required-entry-tax_class_id').remove();\r\n }\r\n } else {\r\n \$('tax_class_id').disabled = false;\r\n " . ($tax->getRequired() ? "\$('tax_class_id').addClassName('required-entry');" : '') . "\r\n }\r\n }\r\n\r\n if (\$('price_type')) {\r\n \$('price_type').observe('change', changeTaxClassId);\r\n changeTaxClassId();\r\n }\r\n " . '</script>'); } $weight = $this->getForm()->getElement('weight'); if ($weight) { $weight->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_extend')->setDisableChild(true)); } $tier_price = $this->getForm()->getElement('tier_price'); if ($tier_price) { $tier_price->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_tier')->setPriceColumnHeader(Mage::helper('bundle')->__('Percent Discount'))->setPriceValidation('validate-greater-than-zero validate-percents')); } $mapEnabled = $this->getForm()->getElement('msrp_enabled'); if ($mapEnabled && $this->getCanEditPrice() !== false) { $mapEnabled->setAfterElementHtml('<script type="text/javascript">' . "\r\n function changePriceTypeMap() {\r\n if (\$('price_type').value == " . Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC . ") {\r\n \$('msrp_enabled').setValue(" . Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type_Enabled::MSRP_ENABLE_NO . ");\r\n \$('msrp_enabled').disable();\r\n \$('msrp_display_actual_price_type').setValue(" . Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type_Price::TYPE_USE_CONFIG . ");\r\n \$('msrp_display_actual_price_type').disable();\r\n \$('msrp').setValue('');\r\n \$('msrp').disable();\r\n } else {\r\n \$('msrp_enabled').enable();\r\n \$('msrp_display_actual_price_type').enable();\r\n \$('msrp').enable();\r\n }\r\n }\r\n document.observe('dom:loaded', function() {\r\n \$('price_type').observe('change', changePriceTypeMap);\r\n changePriceTypeMap();\r\n });\r\n " . '</script>'); } }
protected function _toHtml() { $typeId = $this->_getProduct()->getTypeId(); if (in_array($typeId, Mage::helper('bundle')->getAllowedSelectionTypes())) { return parent::_toHtml(); } return ''; }
/** * {@inheritdoc} */ public function _toHtml() { $prefix = ''; if ($this->getGroup()->getAttributeGroupName() == 'OrderFlow') { $block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'orderflow_info', array('template' => 'realtimedespatch/catalog/product/tab/orderflow.phtml')); $prefix = $block->toHtml(); } return $prefix . '' . parent::_toHtml(); }
protected function _prepareForm() { parent::_prepareForm(); $group = $this->getGroup(); if ($group) { $point_sell_product = $this->getForm()->getElement('mw_reward_point_sell_product'); if ($point_sell_product) { $point_sell_product->setRenderer($this->getLayout()->createBlock('rewardpoints/adminhtml_renderer_catalog_product_edit_tab_attributes_sell')); } $product_reward_point = $this->getForm()->getElement('reward_point_product'); if ($product_reward_point) { $product_reward_point->setRenderer($this->getLayout()->createBlock('rewardpoints/adminhtml_renderer_catalog_product_edit_tab_attributes_reward')); } } }
protected function _prepareForm() { parent::_prepareForm(); if ($special_price = $this->getForm()->getElement('special_price')) { $special_price->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_special')->setDisableChild(false)); } if ($sku = $this->getForm()->getElement('sku')) { $sku->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_extend')->setDisableChild(false)); } if ($price = $this->getForm()->getElement('price')) { $price->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_extend')->setDisableChild(true)); } if ($weight = $this->getForm()->getElement('weight')) { $weight->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_extend')->setDisableChild(true)); } if ($weight = $this->getForm()->getElement('tier_price')) { $weight->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_tier')->setPriceColumnHeader(Mage::helper('bundle')->__('Percent Discount'))); } }
protected function _prepareForm() { parent::_prepareForm(); if ($special_price = $this->getForm()->getElement('special_price')) { $special_price->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_special')->setDisableChild(false)); } if ($sku = $this->getForm()->getElement('sku')) { $sku->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_extend')->setDisableChild(false)); } if ($price = $this->getForm()->getElement('price')) { $price->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_extend')->setDisableChild(true)); } if ($tax = $this->getForm()->getElement('tax_class_id')) { $tax->setAfterElementHtml('<script type="text/javascript">' . "\n function changeTaxClassId() {\n if (\$('price_type').value == '" . Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC . "') {\n \$('tax_class_id').disabled = true;\n \$('tax_class_id').value = '0';\n \$('tax_class_id').removeClassName('required-entry');\n if (\$('advice-required-entry-tax_class_id')) {\n \$('advice-required-entry-tax_class_id').remove();\n }\n } else {\n \$('tax_class_id').disabled = false;\n " . ($tax->getRequired() ? "\$('tax_class_id').addClassName('required-entry');" : '') . "\n }\n }\n\n \$('price_type').observe('change', changeTaxClassId);\n changeTaxClassId();\n " . '</script>'); } if ($weight = $this->getForm()->getElement('weight')) { $weight->setRenderer($this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_attributes_extend')->setDisableChild(true)); } if ($weight = $this->getForm()->getElement('tier_price')) { $weight->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_tier')->setPriceColumnHeader(Mage::helper('bundle')->__('Percent Discount'))->setPriceValidation('validate-greater-than-zero validate-percents')); } }