3namespace Sale\Handlers\Delivery\Additional\ExtraServices;
5use Bitrix\Sale\Shipment;
6use Bitrix\Main\Localization\Loc;
7use Bitrix\Sale\Delivery\ExtraServices\Base;
9Loc::loadMessages(__FILE__);
11class Insurance
extends Base
15 $structure[
"PARAMS"][
"ONCHANGE"] = $this->createJSOnchange($id);
16 parent::__construct($id, $structure,
$currency, $value, $additionalParams);
17 $this->params[
"TYPE"] =
"Y/N";
20 public static function getClassTitle()
22 return Loc::getMessage(
'SALE_DLVRS_ADD_ESI_TITLE');
25 public function getCostShipment(Shipment $shipment =
null)
27 if($this->value !=
"Y")
30 return $this->getPriceShipment($shipment);
33 protected function getShipmentProductsPrice(Shipment $shipment =
null)
38 foreach($shipment->getShipmentItemCollection() as $shipmentItem)
40 $basketItem = $shipmentItem->getBasketItem();
43 $result += $basketItem->getPrice()*$basketItem->getQuantity();
49 public static function getAdminParamsName()
51 return Loc::getMessage(
'SALE_DLVRS_ADD_ESI_PARAMS_NAME');
56 return \Bitrix\Sale\Internals\Input\Manager::getEditHtml(
57 $name.
"[PARAMS][FEE]",
58 array(
"TYPE" =>
"NUMBER"),
63 protected function createJSOnchange($id)
65 return "BX.onCustomEvent('onDeliveryExtraServiceValueChange', [{'id' : '".$id.
"', 'value': this.checked, 'price': '0'}]);";
68 public static function isEmbeddedOnly()
73 public function getPriceShipment(Shipment $shipment =
null)
75 if(!isset($this->params[
"FEE"]))
81 $shipmentPrice = $this->getShipmentProductsPrice($shipment);
83 return $this->convertToOperatingCurrency(
84 $shipmentPrice * floatval($this->params[
"FEE"]) / 100
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']