public function __construct($id, array $structure, $currency, $value = null, array $additionalParams = array()) { $prices = !empty($structure["PARAMS"]["PRICES"]) && is_array($structure["PARAMS"]["PRICES"]) ? $structure["PARAMS"]["PRICES"] : array(); $structure["PARAMS"]["ONCHANGE"] = $this->createJSOnchange($id, $prices); parent::__construct($id, $structure, $currency, $value); $this->params["TYPE"] = "ENUM"; $this->params["OPTIONS"] = array(); }
public function __construct($id, array $structure, $currency, $value = null, array $additionalParams = array()) { if (isset($structure["PARAMS"]["PRICE"])) { $structure["PARAMS"]["ONCHANGE"] = $this->createJSOnchange($id, $structure["PARAMS"]["PRICE"]); } parent::__construct($id, $structure, $currency, $value); $this->params["TYPE"] = "STRING"; }
public function __construct($id, array $structure, $value = null, array $additionalParams = array()) { $structure["PARAMS"]["ONCHANGE"] = 'BX.onCustomEvent("onDeliveryExtraServiceValueChange", [{"id" : "' . $id . '", "value": this.value, "price": this.value*parseFloat("' . $structure["PARAMS"]["PRICE"] . '")}]);'; parent::__construct($id, $structure, $value); $this->params["TYPE"] = "STRING"; if (isset($structure["PARAMS"]["PRICE"])) { $this->params["PRICE"] = $structure["PARAMS"]["PRICE"]; } }
public function __construct($id, array $structure, $value = null, array $additionalParams = array()) { $structure["PARAMS"]["ONCHANGE"] = 'BX.onCustomEvent("onDeliveryExtraServiceValueChange", [{"id" : "' . $id . '", "value": this.value, "price": ' . $this->getJSPrice($structure) . '}]);'; parent::__construct($id, $structure, $value); $this->params["TYPE"] = "ENUM"; $this->params["OPTIONS"] = array(); if (isset($structure["PARAMS"]["PRICES"]) && is_array($structure["PARAMS"]["PRICES"])) { $this->params["PRICES"] = $structure["PARAMS"]["PRICES"]; foreach ($this->params["PRICES"] as $key => $price) { if (strlen($price["TITLE"]) <= 0) { continue; } $this->params["OPTIONS"][$key] = $price["TITLE"] . " (" . $price["PRICE"] . ")"; } } else { $this->params["OPTIONS"] = array(); } }