Exemplo n.º 1
0
 /**
  * Retrieve Element HTML fragment
  *
  * @return string
  */
 public function getElementHtml()
 {
     if (is_null($this->getValue())) {
         $this->setValue(\Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type\Price::TYPE_USE_CONFIG);
     }
     return parent::getElementHtml();
 }
Exemplo n.º 2
0
 /**
  * Retrieve element html
  *
  * @return string
  */
 public function getElementHtml()
 {
     $value = $this->getValue();
     if ($value == '') {
         $this->setValue($this->_getValueFromConfig());
     }
     $html = parent::getElementHtml();
     $htmlId = 'use_config_' . $this->getHtmlId();
     $checked = $value == '' ? ' checked="checked"' : '';
     $disabled = $this->getReadonly() ? ' disabled="disabled"' : '';
     $html .= '<input id="' . $htmlId . '" name="product[' . $htmlId . ']" ' . $disabled . ' value="1" ' . $checked;
     $html .= ' onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox" />';
     $html .= ' <label for="' . $htmlId . '">' . __('Use Config Settings') . '</label>';
     $html .= '<script type="text/javascript">toggleValueElements($(\'' . $htmlId . '\'), $(\'' . $htmlId . '\').parentNode);</script>';
     return $html;
 }
Exemplo n.º 3
0
 /**
  * Retrieve Element HTML fragment
  *
  * @return string
  */
 public function getElementHtml()
 {
     $elementDisabled = $this->getDisabled() == 'disabled';
     $disabled = false;
     if (!$this->getValue() || $elementDisabled) {
         $this->setData('disabled', 'disabled');
         $disabled = true;
     }
     $html = parent::getElementHtml();
     $htmlId = 'use_config_' . $this->getHtmlId();
     $html .= '<input id="' . $htmlId . '" name="use_config[]" value="' . $this->getId() . '"';
     $html .= $disabled ? ' checked="checked"' : '';
     if ($this->getReadonly() || $elementDisabled) {
         $html .= ' disabled="disabled"';
     }
     $html .= ' onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox" />';
     $html .= ' <label for="' . $htmlId . '" class="normal">' . __('Use Config Settings') . '</label>';
     $html .= '<script>require(["prototype"], function(){toggleValueElements($(\'' . $htmlId . '\'), $(\'' . $htmlId . '\').parentNode);});</script>';
     return $html;
 }
Exemplo n.º 4
0
 /**
  * Join quantity and in stock elements' html
  *
  * @return string
  */
 public function getElementHtml()
 {
     $this->_disableFields();
     return $this->_qty->getElementHtml() . parent::getElementHtml() . $this->_getJs(self::QUANTITY_FIELD_HTML_ID, $this->getId());
 }