3namespace Sale\Handlers\Delivery;
5use Bitrix\Currency\CurrencyManager;
7use \Bitrix\Main\Localization\Loc;
8use \Bitrix\Sale\Delivery\CalculationResult;
9use \Bitrix\Sale\Location\GroupTable;
11Loc::loadMessages(__FILE__);
16class SimpleHandler
extends \Bitrix\Sale\Delivery\Services\Base
19 protected $handlerCode =
'BITRIX_SIMPLE';
21 protected static $isCalculatePriceImmediately =
true;
22 protected static $whetherAdminExtraServicesShow =
true;
28 public function __construct(
array $initParams)
30 parent::__construct($initParams);
33 if(!isset($this->config[
"MAIN"][
"0"]))
34 $this->config[
"MAIN"][
"0"] =
"0";
40 public static function getClassTitle()
42 return Loc::getMessage(
"SALE_DLVR_HANDL_SMPL_TITLE2");
48 public static function getClassDescription()
50 return Loc::getMessage(
"SALE_DLVR_HANDL_SMPL_DESCRIPTION");
57 protected function getLocationGroups()
61 'select' =>
array(
'ID',
'CODE',
'LNAME' =>
'NAME.NAME'),
62 'filter' =>
array(
'NAME.LANGUAGE_ID' => LANGUAGE_ID)
65 while($group =
$res->fetch())
66 $result[$group[
'ID']] = $group[
'LNAME'];
76 protected function calculateConcrete(\Bitrix\Sale\Shipment $shipment =
null)
78 $result =
new CalculationResult;
81 $this->config[
"MAIN"][
"0"],
86 $order = $shipment->getCollection()->getOrder();
91 if(!$locationProp =
$props->getDeliveryLocation())
94 if(!$locationCode = $locationProp->getValue())
97 $res = \Bitrix\Sale\Location\LocationTable::getList(
array(
99 new \Bitrix\Main\Entity\ReferenceField(
101 '\Bitrix\Sale\Location\GroupLocationTable',
103 '=this.PARENTS.ID' =>
'ref.LOCATION_ID',
106 "join_type" =>
'inner'
110 'filter' =>
array(
'=CODE' => $locationCode),
111 'select' =>
array(
'CLOSEST_GROUP_ID' =>
'PARENT_GROUP.LOCATION_GROUP_ID'),
112 'order' =>
array(
'PARENTS.DEPTH_LEVEL' =>
'desc'),
116 if($group =
$res->fetch())
118 if(isset($this->config[
"MAIN"][$group[
'CLOSEST_GROUP_ID']]))
123 $this->config[
"MAIN"][$group[
'CLOSEST_GROUP_ID']]
138 protected function getConfigStructure()
142 if(Loader::includeModule(
'currency'))
144 $currencyList = CurrencyManager::getCurrencyList();
145 if (isset($currencyList[$this->currency]))
147 unset($currencyList);
152 "TITLE" => Loc::getMessage(
"SALE_DLVR_HANDL_SMPL_TAB_MAIN"),
153 "DESCRIPTION" => Loc::getMessage(
"SALE_DLVR_HANDL_SMPL_TAB_MAIN_DESCR"),
157 "TYPE" =>
"DELIVERY_READ_ONLY",
158 "NAME" => Loc::getMessage(
"SALE_DLVR_HANDL_SMPL_CURRENCY"),
159 "VALUE" => $this->currency,
166 "NAME" => Loc::getMessage(
"SALE_DLVR_HANDL_SMPL_DEFAULT")
172 foreach(self::getLocationGroups() as $groupId => $groupName)
184 public function isCalculatePriceImmediately()
186 return self::$isCalculatePriceImmediately;
189 public static function whetherAdminExtraServicesShow()
191 return self::$whetherAdminExtraServicesShow;
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
const SALE_VALUE_PRECISION