public function render(Varien_Data_Form_Element_Abstract $element) { if ($this->getRequest()->getParam('website') != '') { $priceScope = Mage::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE); if ($priceScope == Mage_Core_Model_Store::PRICE_SCOPE_GLOBAL) { return ''; } } return parent::render($element); }
public function testRenderInheritCheckbox() { $this->_elementMock->expects($this->any())->method('getInherit')->will($this->returnValue(true)); $this->_elementMock->expects($this->any())->method('getCanUseWebsiteValue')->will($this->returnValue(true)); $this->_elementMock->expects($this->any())->method('getCanUseDefaultValue')->will($this->returnValue(true)); $this->_elementMock->expects($this->once())->method('setDisabled')->with(true); $helperMock = $this->getMock('Mage_Backend_Helper_Data', array(), array(), '', false, false); $helperMock->expects($this->any())->method('__')->will($this->returnArgument(0)); $this->_layoutMock->expects($this->any())->method('helper')->with('Mage_Backend_Helper_Data')->will($this->returnValue($helperMock)); $expected = '<td class="use-default">'; $expected .= '<input id="' . $this->_testData['htmlId'] . '_inherit" name="' . $this->_testData['name'] . '[inherit]" type="checkbox" value="1"' . ' class="checkbox config-inherit" checked="checked"' . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> '; $expected .= '<label for="' . $this->_testData['htmlId'] . '_inherit" class="inherit">Use Website</label>'; $actual = $this->_object->render($this->_elementMock); $this->assertContains($expected, $actual); }
/** * Remove scope label * * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); return parent::render($element); }