Ejemplo n.º 1
0
 /**
  * Add Weight Switcher radio-button element html to weight field
  *
  * @return string
  */
 public function getElementHtml()
 {
     if (!$this->getForm()->getDataObject()->getTypeInstance()->hasWeight()) {
         $this->weightSwitcher->setValue(WeightResolver::HAS_NO_WEIGHT);
     }
     if ($this->getDisabled()) {
         $this->weightSwitcher->setDisabled($this->getDisabled());
     }
     return '<div class="admin__field-control weight-switcher">' . '<div class="admin__control-switcher" data-role="weight-switcher">' . $this->weightSwitcher->getLabelHtml() . '<div class="admin__field-control-group">' . $this->weightSwitcher->getElementHtml() . '</div>' . '</div>' . '<div class="admin__control-addon">' . parent::getElementHtml() . '<label class="admin__addon-suffix" for="' . $this->getHtmlId() . '"><span>' . $this->directoryHelper->getWeightUnit() . '</span></label>' . '</div>' . '</div>';
 }
Ejemplo n.º 2
0
 /**
  * Add Is Virtual checkbox html to weight field
  *
  * @return string
  */
 public function getElementHtml()
 {
     if (!$this->getForm()->getDataObject()->getTypeInstance()->hasWeight()) {
         $this->_virtual->setChecked('checked');
     }
     if ($this->getDisabled()) {
         $this->_virtual->setDisabled($this->getDisabled());
     }
     return '<div class="fields-group-2"><div class="field"><div class="addon"><div class="control">' . parent::getElementHtml() . '<label class="addafter" for="' . $this->getHtmlId() . '"><strong>' . __('lbs') . '</strong></label>' . '</div></div></div><div class="field choice">' . $this->_virtual->getElementHtml() . $this->_virtual->getLabelHtml() . '</div></div>';
 }
Ejemplo 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;
     }
     parent::addClass('validate-number validate-number-range number-range-0.01-1000000000');
     $html = parent::getElementHtml();
     $htmlId = 'use_config_' . $this->getHtmlId();
     $html .= '<br/><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;
 }
Ejemplo 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());
 }