1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
delivery_cpcr.php
См. документацию.
1<?
2/**********************************************************************
3Delivery services for CPCR delivery service (http://www.cpcr.ru/)
4It uses on-line calculator. Calculation only to Russia.
5Files:
6cpcr/cities.php - cache of cpcr ids for cities
7cpcr/locations.php - list of cpcr ids for countries.
8**********************************************************************/
9
11
12IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"].'/bitrix/modules/sale/delivery/delivery_cpcr.php');
13
14define('DELIVERY_CPCR_WRITE_LOG', 0); // flag 'write to log'. use CDeliveryCPCR::__WriteToLog() for logging.
15define('DELIVERY_CPCR_CACHE_LIFETIME', 2592000); // cache lifetime - 30 days (60*60*24*30)
16
17define('DELIVERY_CPCR_CATEGORY_DEFAULT', 8); // default category for delivered goods
18
19define('DELIVERY_CPCR_PRICE_TARIFF', 0.0025); // price koefficient - 0.25%
20
21define('DELIVERY_CPCR_COUNTRY_DEFAULT', '209|0'); // default country - Russia
22define('DELIVERY_CPCR_CITY_DEFAULT', '992|0'); // default city - Moscow
23
24//define('DELIVERY_CPCR_SERVER', 'old.cpcr.ru'); // server name to send data
25define('DELIVERY_CPCR_SERVER', 'www.spsr.ru'); // server name to send data
26
27define('DELIVERY_CPCR_SERVER_PORT', 80); // server port
28//define('DELIVERY_CPCR_SERVER_PAGE', '/components/tarifcalc2/tarifcalc.php?JsHttpRequest='); // server page url
29define('DELIVERY_CPCR_SERVER_PAGE', '/cgi-bin/post09.pl?TARIFFCOMPUTE_2'); // server page url
30
31//define('DELIVERY_CPCR_SERVER_METHOD', 'POST'); // data send method
32define('DELIVERY_CPCR_SERVER_METHOD', 'GET'); // data send method
33
34//define('DELIVERY_CPCR_SERVER_POST_FROM_REGION', 'from_select_region'); // query variable name for "from" region id
35define('DELIVERY_CPCR_SERVER_POST_FROM_REGION', 'FromRegion'); // query variable name for "from" region id
36
37//define('DELIVERY_CPCR_SERVER_POST_FROM_COUNTRY', 'from_select_country'); // query variable name for "from" region id
38define('DELIVERY_CPCR_SERVER_POST_FROM_COUNTRY', 'FromCountry'); // query variable name for "from" region id
39
40//define('DELIVERY_CPCR_SERVER_POST_FROM_CITY_NAME', 'from_Cities_name'); // query variable name for "from" city name
41define('DELIVERY_CPCR_SERVER_POST_FROM_CITY_NAME', 'FromCity'); // query variable name for "from" city name
42
43//define('DELIVERY_CPCR_SERVER_POST_FROM_CITY', 'from_Cities_Id'); // query variable name for "from" city id
44define('DELIVERY_CPCR_SERVER_POST_FROM_CITY', 'FromCity'); // query variable name for "from" city id
45
46define('DELIVERY_CPCR_SERVER_POST_WEIGHT', 'Weight'); // query variable name for order weight
47define('DELIVERY_CPCR_SERVER_POST_CATEGORY', 'Nature'); // query variable name for order goods category
48define('DELIVERY_CPCR_SERVER_POST_PRICE', 'Amount'); // query variable name for order price
49
50
51//define('DELIVERY_CPCR_SERVER_POST_TO_COUNTRY', 'to_select_country'); // query variable name for "to" country id
52define('DELIVERY_CPCR_SERVER_POST_TO_COUNTRY', 'Country'); // query variable name for "to" country id
53
54//define('DELIVERY_CPCR_SERVER_POST_TO_REGION', 'to_select_region'); // query variable name for "to" region id
55define('DELIVERY_CPCR_SERVER_POST_TO_REGION', 'ToRegion'); // query variable name for "to" region id
56
57//define('DELIVERY_CPCR_SERVER_POST_TO_CITY_NAME', 'to_Cities_name'); // query variable name for "to" city name
58define('DELIVERY_CPCR_SERVER_POST_TO_CITY_NAME', 'to_Cities_name'); // query variable name for "to" city name
59
60//define('DELIVERY_CPCR_SERVER_POST_TO_CITY', 'to_Cities_Id'); // query variable name for "to" city id
61define('DELIVERY_CPCR_SERVER_POST_TO_CITY', 'ToCity'); // query variable name for "to" city id
62
63
64define('DELIVERY_CPCR_SERVER_POST_ADDITIONAL', 'Amount=0&AmountCheck=1&SMS=0&InHands=0&BeforeSignal=0&DuesOrder=0&PlatType=0&GabarythSum=60&GabarythB=0'); // additional POST data
65
66define('DELIVERY_CPCR_VALUE_CHECK_STRING', '"Total"'); // first check string - to determine whether delivery price is in response
67//define(
68// 'DELIVERY_CPCR_VALUE_CHECK_REGEXP',
69// '/"(result[2]{0,1})": \[([^\]]*)\]/i'
70//); // second check string - regexp to parse final price from response
71
73{
74 public static function Init()
75 {
76 // fix a possible currency bug
77 if (\Bitrix\Main\Loader::includeModule('currency') && $arCurrency = CCurrency::GetByID('RUR'))
78 $base_currency = 'RUR';
79 else
80 $base_currency = 'RUB';
81
82 return array(
83 /* Basic description */
84 "SID" => "cpcr", // unique string identifier
85 "NAME" => GetMessage('SALE_DH_CPCR_NAME'), // services public title
86 "DESCRIPTION" => GetMessage('SALE_DH_CPCR_DESCRIPTION'), // services public dedcription
87 "DESCRIPTION_INNER" => GetMessage('SALE_DH_CPCR_DESCRIPTION_INNER'), // services private description for admin panel
88 "BASE_CURRENCY" => $base_currency, // services base currency
89
90 "HANDLER" => __FILE__, // services path - don't change it if you do not surely know what you are doin
91
92 "COMPABILITY" => array("CDeliveryCPCR", "Compability"), // callback method to check whether services is compatible with current order
93 "CALCULATOR" => array("CDeliveryCPCR", "Calculate"), // callback method to calculate delivery price
94 "DEPRECATED" => "Y",
95 'GET_ADMIN_MESSAGE' => array('CDeliveryCPCR', 'getAdminMessage'),
96
97 /* List of delivery profiles */
98 "PROFILES" => array(
99 "simple" => array(
100 "TITLE" => GetMessage("SALE_DH_CPCR_SIMPLE_TITLE"),
101 "DESCRIPTION" => GetMessage("SALE_DH_CPCR_SIMPLE_DESCRIPTION"),
102
103 "RESTRICTIONS_WEIGHT" => array(0, 31500),
104 "RESTRICTIONS_SUM" => array(0, 500000),
105 ),
106 "simple13" => array(
107 "TITLE" => GetMessage("SALE_DH_CPCR_SIMPLE13_TITLE"),
108 "DESCRIPTION" => GetMessage("SALE_DH_CPCR_SIMPLE_DESCRIPTION"),
109
110 "RESTRICTIONS_WEIGHT" => array(0, 31500),
111 "RESTRICTIONS_SUM" => array(0, 500000),
112 ),
113 "simple18" => array(
114 "TITLE" => GetMessage("SALE_DH_CPCR_SIMPLE18_TITLE"),
115 "DESCRIPTION" => GetMessage("SALE_DH_CPCR_SIMPLE_DESCRIPTION"),
116
117 "RESTRICTIONS_WEIGHT" => array(0, 31500),
118 "RESTRICTIONS_SUM" => array(0, 500000),
119 ),
120 "econom" => array(
121 "TITLE" => GetMessage("SALE_DH_CPCR_ECONOM_TITLE"),
122 "DESCRIPTION" => GetMessage("SALE_DH_CPCR_ECONOM_DESCRIPTION"),
123
124 "RESTRICTIONS_WEIGHT" => array(0, 68000),
125 "RESTRICTIONS_SUM" => array(0, 500000),
126 ),
127
128 "bizon" => array(
129 "TITLE" => GetMessage("SALE_DH_CPCR_BIZON_TITLE"),
130 "DESCRIPTION" => GetMessage("SALE_DH_CPCR_BIZON_DESCRIPTION"),
131
132 "RESTRICTIONS_WEIGHT" => array(0, 68000),
133 "RESTRICTIONS_SUM" => array(0, 500000),
134 ),
135 "colibri" => array(
136 "TITLE" => GetMessage("SALE_DH_CPCR_COLIBRI_TITLE"),
137 "DESCRIPTION" => GetMessage("SALE_DH_CPCR_COLIBRI_DESCRIPTION"),
138
139 "RESTRICTIONS_WEIGHT" => array(0, 68000),
140 "RESTRICTIONS_SUM" => array(0, 500000),
141 ),
142 "pelican" => array(
143 "TITLE" => GetMessage("SALE_DH_CPCR_PELICAN_TITLE"),
144 "DESCRIPTION" => GetMessage("SALE_DH_CPCR_PELICAN_DESCRIPTION"),
145
146 "RESTRICTIONS_WEIGHT" => array(0, 68000),
147 "RESTRICTIONS_SUM" => array(0, 500000),
148 ),
149 "fraxt" => array(
150 "TITLE" => GetMessage("SALE_DH_CPCR_FRAXT_TITLE"),
151 "DESCRIPTION" => GetMessage("SALE_DH_CPCR_FRAXT_DESCRIPTION"),
152
153 "RESTRICTIONS_WEIGHT" => array(0, 68000),
154 "RESTRICTIONS_SUM" => array(0, 500000),
155 )
156 )
157 );
158 }
159
160 public static function GetConfig()
161 {
162 return array();
163
164 $arConfig = array(
165 "CONFIG_GROUPS" => array(
166 "all" => GetMessage('SALE_DH_CPCR_CONFIG_TITLE'),
167 ),
168
169 "CONFIG" => array(
170 "category" => array(
171 "TYPE" => "DROPDOWN",
173 "TITLE" => GetMessage('SALE_DH_CPCR_CONFIG_CATEGORY'),
174 "GROUP" => "all",
175 "VALUES" => array(),
176 ),
177 ),
178 );
179
180 for ($i = 1; $i < 9; $i++)
181 {
182 $arConfig["CONFIG"]["category"]["VALUES"][$i] = GetMessage('SALE_DH_CPCR_CONFIG_CATEGORY_'.$i);
183 }
184
185 return $arConfig;
186 }
187
188 public static function GetSettings($strSettings)
189 {
190 return array();
191 return array(
192 "category" => intval($strSettings)
193 );
194 }
195
196 public static function SetSettings($arSettings)
197 {
198 return array();
199 $category = intval($arSettings["category"]);
200 if ($category <= 0 || $category > 8) return DELIVERY_CPCR_CATEGORY_DEFAULT;
201 else return $category;
202 }
203
204 public static function __GetLocation($location)
205 {
206 static $arCPCRCountries;
207 static $arCPCRCity;
208
210
211 $arReturn = array();
212
213 if (!is_array($arCPCRCountries))
214 {
215 require ("cpcr/locations.php");
216 }
217
218 foreach ($arCPCRCountries as $country_id => $country_title)
219 {
220 if (
221 $country_title == $arLocation["COUNTRY_NAME_ORIG"]
222 ||
223 $country_title == $arLocation["COUNTRY_SHORT_NAME"]
224 ||
225 $country_title == $arLocation["COUNTRY_NAME_LANG"]
226 ||
227 $country_title == $arLocation["COUNTRY_NAME"]
228 )
229 {
230 $arReturn["COUNTRY"] = $country_id;
231 break;
232 }
233 }
234
235 $arReturn["CITY"] = $arLocation["CITY_NAME_LANG"];
236
237 if (!is_array($arCPCRCity))
238 {
239 require ("cpcr/cities.php");
240 }
241
242 /*
243 if (is_set($arCPCRCity, $arLocation["CITY_ID"]))
244 {
245 $arReturn["CITY_ID"] = $arCPCRCity[$arLocation["CITY_ID"]];
246 }
247 */
248 foreach ($arCPCRCity as $city_id => $city_title)
249 {
250 if (
251 $city_title == $arLocation["CITY_NAME_ORIG"]
252 ||
253 $city_title == $arLocation["CITY_SHORT_NAME"]
254 ||
255 $city_title == $arLocation["CITY_NAME_LANG"]
256 ||
257 $city_title == $arLocation["CITY_NAME"]
258 )
259 {
260 $arReturn["CITY_ID"] = $city_id;
261 break;
262 }
263 }
264
265 $arReturn["ORIGINAL"] = array(
266 "ID" => $arLocation["ID"],
267 "COUNTRY_ID" => $arLocation["COUNTRY_ID"],
268 "CITY_ID" => $arLocation["CITY_ID"],
269 );
270
271 return $arReturn;
272 }
273
274 public static function Calculate($profile, $arConfig, $arOrder, $STEP)
275 {
276 if ($STEP >= 3)
277 return array(
278 "RESULT" => "ERROR",
279 "TEXT" => GetMessage('SALE_DH_CPCR_ERROR_CONNECT'),
280 );
281
282 $arOrder["WEIGHT"] = CSaleMeasure::Convert($arOrder["WEIGHT"], "G", "KG");
283 if ($arOrder["WEIGHT"] <= 0) $arOrder["WEIGHT"] = 1; // weight must not be null - let it be 1 kg
284
285 $arLocationFrom = CDeliveryCPCR::__GetLocation($arOrder["LOCATION_FROM"]);
286 $arLocationTo = CDeliveryCPCR::__GetLocation($arOrder["LOCATION_TO"]);
287
288 // caching is dependent from category, locations "from" & "to" and from weight interval
289 $cache_id = "sale3|9.5.0|cpcr|".
290 $arConfig["category"]['VALUE']."|".
291 $arLocationFrom["ORIGINAL"]["COUNTRY_ID"]."|".
292 $arLocationFrom["ORIGINAL"]["CITY_ID"]."|".
293 $arLocationTo["ORIGINAL"]["COUNTRY_ID"]."|".
294 $arLocationTo["ORIGINAL"]["CITY_ID"];
295
296 if ($arOrder["WEIGHT"] <= 0.5) $cache_id .= "|0"; // first interval - up to 0.5 kg
297 elseif ($arOrder["WEIGHT"] <= 1) $cache_id .= "|1"; //2nd interval - up to 1 kg
298 else $cache_id .= "|".ceil($arOrder["WEIGHT"]); // other intervals - up to next natural number
299
300 $obCache = new CPHPCache();
301
302 if ($obCache->InitCache(DELIVERY_CPCR_CACHE_LIFETIME, $cache_id, "/"))
303 {
304 // cache found
305 $vars = $obCache->GetVars();
306 $arResult = $vars["RESULT"];
307 }
308 else
309 {
310 // format HTTP query request data
311 $arQuery = array();
312
313 $arQuery[] = DELIVERY_CPCR_SERVER_POST_FROM_COUNTRY."=".urlencode($arLocationFrom["COUNTRY"]);
314
315 if (is_set($arLocationFrom["CITY_ID"]))
316 $arQuery[] = DELIVERY_CPCR_SERVER_POST_FROM_CITY."=".urlencode($arLocationFrom["CITY_ID"]);
317 else
318 $arQuery[] = DELIVERY_CPCR_SERVER_POST_FROM_CITY_NAME."=".urlencode(\Bitrix\Main\Text\Encoding::convertEncoding($arLocationFrom["CITY"], LANG_CHARSET, 'windows-1251'));
319
320 $arQuery[] = DELIVERY_CPCR_SERVER_POST_WEIGHT."=".urlencode($arOrder["WEIGHT"]);
321 $arQuery[] = DELIVERY_CPCR_SERVER_POST_CATEGORY."="."1";//urlencode($arConfig["category"]["VALUE"]);
322
323 // price coefficient will be added later - to make caching independent from price
324 $arQuery[] = DELIVERY_CPCR_SERVER_POST_PRICE."=0";
325 $arQuery[] = DELIVERY_CPCR_SERVER_POST_TO_COUNTRY."=".urlencode($arLocationTo["COUNTRY"]);
326
327 /*
328 if (is_set($arLocationTo["REGION"]))
329 $arQuery[] = DELIVERY_CPCR_SERVER_POST_TO_REGION."=".urlencode($arLocationTo["REGION"]);
330 else
331 $arQuery[] = DELIVERY_CPCR_SERVER_POST_TO_REGION."=".urlencode(DELIVERY_CPCR_CITY_DEFAULT);
332 */
333
334 if (is_set($arLocationTo["CITY_ID"]))
335 $arQuery[] = DELIVERY_CPCR_SERVER_POST_TO_CITY."=".urlencode($arLocationTo["CITY_ID"]);
336 else
337 $arQuery[] = DELIVERY_CPCR_SERVER_POST_TO_CITY_NAME."=".urlencode(\Bitrix\Main\Text\Encoding::convertEncoding($arLocationTo["CITY"], LANG_CHARSET, 'windows-1251'));
338
339 CDeliveryCPCR::__Write2Log(print_r($arLocationTo, true));
340
342 $query_string = implode("&", $arQuery);
343
344 $query_page = DELIVERY_CPCR_SERVER_PAGE;
345
346 // get data from server
347 $ob = new CHTTP();
348 $ob->http_timeout = 50;
349
350 $data = $ob->Query(
354 $query_page . (DELIVERY_CPCR_SERVER_METHOD == 'GET' ? ((mb_strpos($query_page, '?') === false ? '?' : '&') . $query_string) : ''),
355 DELIVERY_CPCR_SERVER_METHOD == 'POST' ? $query_string : false
356 //,
357 // "",
358 // "" // Empty content-type because of CPCR inner bugs
359 );
360
361 if($data)
362 $data = \Bitrix\Main\Text\Encoding::convertEncoding($ob->result, 'windows-1251', LANG_CHARSET);
363
364 CDeliveryCPCR::__Write2Log($query_page);
365 CDeliveryCPCR::__Write2Log($query_string);
366 CDeliveryCPCR::__Write2Log($error_number.": ".$error_text);
368
369 if (mb_strpos($data, "<?xml") === false)
370 {
371 return array(
372 "RESULT" => "ERROR",
373 "TEXT" => GetMessage('SALE_DH_CPCR_ERROR_CONNECT'),
374 );
375 }
376
377 $objXML = new CDataXML();
378 $objXML->LoadString($data);
379 $arResult = $objXML->GetArray();
380
381 $arProfiles = array(
382 'SIMPLE' => '"ГЕПАРД-ЭКСПРЕСС"',
383 'ECONOM' => '"ПЕЛИКАН-СТАНДАРТ"',
384 'SIMPLE13' => '"ГЕПАРД-ЭКСПРЕСС 13"',
385 'SIMPLE18' => '"ГЕПАРД-ЭКСПРЕСС 18"',
386 'BIZON' => '"БИЗОН-КАРГО"',
387 'COLIBRI' => '"КОЛИБРИ-ДОКУМЕНТ"',
388 'PELICAN' => '"ПЕЛИКАН-ОНЛАЙН"',
389 'FRAXT' => '"ФРАХТ"',
390 );
391 $arTmpResult = array();
392
393 if(isset($arResult["root"]["#"]["Error"]) AND is_array($arResult["root"]["#"]["Error"]))
394 {
395 return array(
396 "RESULT" => "ERROR",
397 "TEXT" => GetMessage('SALE_DH_CPCR_ERROR_CONNECT').' ('.htmlspecialcharsbx(strip_tags($arResult["root"]["#"]["Tariff"][0]["#"]["TariffType"][0]["#"])).')',
398 );
399 }
400 else
401 {
402 if(!empty($arResult["root"]["#"]["Tariff"]))
403 {
404 foreach($arResult["root"]["#"]["Tariff"] as $key => $val)
405 {
406 foreach($val["#"] as $k => $v)
407 {
408 foreach ($arProfiles as $prof => $title)
409 {
410 if (mb_strtoupper($v[0]["#"]) == mb_strtoupper($title))
411 {
412 $arTmpResult[mb_strtolower($prof)] = array(
413 'VALUE' => $val["#"]["Total_Dost"][0]["#"],
414 'TRANSIT' => $val["#"]["DP"][0]["#"]." ".GetMessage("SALE_DH_CPCR_DAYS")
415 );
416 unset($arProfiles[$prof]);
417 break;
418 }
419 }
420 }
421 }
422 }
423 $arResult = $arTmpResult;
424 if(count($arTmpResult) > 0)
425 {
426 $obCache->StartDataCache();
427 $obCache->EndDataCache(
428 array(
429 "RESULT" => $arResult
430 )
431 );
432 }
433 else
434 {
435 return array(
436 "RESULT" => "ERROR",
437 "TEXT" => GetMessage('SALE_DH_CPCR_ERROR_CONNECT'),
438 );
439 }
440 }
441 }
442
443 if (is_array($arResult[$profile]))
444 {
445 $arResult[$profile]['RESULT'] = 'OK';
446
447 // it's starnge but it seems that CPCR new calculator doesnt count insurance tax at all. so, temporarily comment this line.
448 // TODO: check this later
449 //$arResult[$profile]['VALUE'] += $arOrder["PRICE"] * DELIVERY_CPCR_PRICE_TARIFF
450
451 return $arResult[$profile];
452 }
453 else
454 {
455 return array(
456 "RESULT" => "ERROR",
457 "TEXT" => GetMessage('SALE_DH_CPCR_ERROR_RESPONSE'),
458 );
459 }
460 }
461
462 public static function Compability($arOrder)
463 {
464 $arLocationFrom = CDeliveryCPCR::__GetLocation($arOrder["LOCATION_FROM"]);
465 $arLocationTo = CDeliveryCPCR::__GetLocation($arOrder["LOCATION_TO"]);
466
467 // delivery only from russia and to russia
468 if (
469 $arLocationFrom["COUNTRY"] != DELIVERY_CPCR_COUNTRY_DEFAULT
470 ||
471 $arLocationTo["COUNTRY"] != DELIVERY_CPCR_COUNTRY_DEFAULT
472 )
473 return array();
474 else
475 {
476 $arProfiles = array("simple", "econom");
477
478 if ($arLocationFrom['CITY_ID'] == DELIVERY_CPCR_CITY_DEFAULT)
479 {
480 if (in_array($arLocationTo['CITY_ID'], array(
481 '269|0', '328|0', '1587|0', '455|0', '551|0', '713|0', '873|0', '924|0', '1054|0', '552|0', '1243|0', '1309|0', '1448|0', '893|0', '1828|0', '1907|0', '189|0', '2011|0', '2137|0'
482 )))
483 {
484 $arProfiles[] = "simple13";
485 }
486
487 if (in_array($arLocationTo['CITY_ID'], array(
488 '199|0', '1063|0', '220|0', '286|0', '328|0', '347|0', '1071|0', '1587|0', '1916|0', '1726|0', '735|0', '785|0', '1083|0', '873|0', '1768|0', '1054|0', '1145|0', '552|0', '1176|0', '1243|0', '1309|0', '1387|0', '1472|0', '893|0', '1522|0', '1485|0', '1907|0', '189|0', '2011|0', '345|0'
489 )))
490 {
491 $arProfiles[] = "simple18";
492 }
493 }
494 elseif ($arLocationTo['CITY_ID'] == DELIVERY_CPCR_CITY_DEFAULT)
495 {
496 if (in_array($arLocationFrom['CITY_ID'], array(
497 '2137|0', '1828|0', '1781|0', '1722|0', '1660|0', '1448|0', '924|0', '713|0', '551|0', '455|0', '286|0', '269|0', '122|0', '1746|0', '1042|0', '1759|0', '199|0', '1063|0', '220|0', '286|0', '328|0', '347|0', '1071|0', '1587|0', '1916|0', '1726|0', '735|0', '785|0', '1083|0', '873|0', '1768|0', '1054|0', '1145|0', '552|0', '1243|0', '1309|0', '1387|0', '1472|0', '893|0', '1522|0', '1485|0', '1907|0', '189|0', '2011|0', '345|0'
498 )))
499 {
500 $arProfiles[] = "simple13";
501 }
502
503 if (in_array($arLocationFrom['CITY_ID'], array(
504 '122|0', '1746|0', '1042|0', '1759|0', '199|0', '1063|0', '220|0', '286|0', '328|0', '347|0', '1071|0', '1587|0', '1916|0', '1726|0', '735|0', '785|0', '1083|0', '873|0', '1768|0', '1054|0', '1145|0', '552|0', '1176|0', '1243|0', '1309|0', '1387|0', '1472|0', '893|0', '1522|0', '1485|0', '1907|0', '189|0', '2011|0', '345|0'
505 )))
506 {
507 $arProfiles[] = "simple18";
508 }
509 }
510
511 return $arProfiles; //array("simple", "simple13", "simple18", "econom");
512 }
513 }
514
515 public static function __Write2Log($data)
516 {
517 if (defined('DELIVERY_CPCR_WRITE_LOG') && DELIVERY_CPCR_WRITE_LOG === 1)
518 {
519 $fp = fopen(__DIR__."/cpcr.log", "a");
520 fwrite($fp, "\r\n==========================================\r\n");
521 fwrite($fp, $data);
522 fclose($fp);
523 }
524 }
525
526 public static function getAdminMessage()
527 {
528 return array(
529 'MESSAGE' => GetMessage(
530 'SALE_DH_DEPRECATED_MESSAGE',
531 array(
532 '#A1#' => '<a href="/bitrix/admin/sale_delivery_service_edit.php?lang='.LANGUAGE_ID.'&PARENT_ID=0&CLASS_NAME=%5CSale%5CHandlers%5CDelivery%5CSpsrHandler">',
533 '#A2#' => '</a>'
534 )
535 ),
536 "TYPE" => "ERROR",
537 "HTML" => true
538 );
539 }
540}
541AddEventHandler("sale", "onSaleDeliveryHandlersBuildList", array('CDeliveryCPCR', 'Init'));
542?>
$arResult
Определения generate_coupon.php:16
static convertEncoding($data, $charsetFrom, $charsetTo)
Определения encoding.php:17
static GetByID($currency)
Определения currency.php:453
Определения xml.php:396
Определения delivery_cpcr.php:73
static __GetLocation($location)
Определения delivery_cpcr.php:204
static __Write2Log($data)
Определения delivery_cpcr.php:515
static getAdminMessage()
Определения delivery_cpcr.php:526
static SetSettings($arSettings)
Определения delivery_cpcr.php:196
static GetConfig()
Определения delivery_cpcr.php:160
static GetSettings($strSettings)
Определения delivery_cpcr.php:188
static Init()
Определения delivery_cpcr.php:74
static Calculate($profile, $arConfig, $arOrder, $STEP)
Определения delivery_cpcr.php:274
static Compability($arOrder)
Определения delivery_cpcr.php:462
Определения http.php:7
static IncludeModule($module_name)
Определения module.php:151
static getLocationByIdHitCached($id)
Определения helper.php:462
static Convert($value, $measureFrom, $measureTo="G")
Определения measurement.php:37
$base_currency
Определения commerceml_g_run_cur.php:2
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
$STEP
Определения csv_new_setup.php:23
const LANG_CHARSET
Определения include.php:65
AddEventHandler($FROM_MODULE_ID, $MESSAGE_ID, $CALLBACK, $SORT=100, $FULL_PATH=false)
Определения tools.php:5165
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
is_set($a, $k=false)
Определения tools.php:2133
GetMessage($name, $aReplace=null)
Определения tools.php:3397
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
$arCPCRCity
Определения cities.php:2
$arCPCRCountries
Определения locations.php:2
const DELIVERY_CPCR_SERVER_POST_CATEGORY
Определения delivery_cpcr.php:47
const DELIVERY_CPCR_SERVER_PORT
Определения delivery_cpcr.php:27
const DELIVERY_CPCR_WRITE_LOG
Определения delivery_cpcr.php:14
const DELIVERY_CPCR_SERVER_METHOD
Определения delivery_cpcr.php:32
const DELIVERY_CPCR_SERVER_POST_FROM_COUNTRY
Определения delivery_cpcr.php:38
const DELIVERY_CPCR_SERVER_POST_PRICE
Определения delivery_cpcr.php:48
const DELIVERY_CPCR_SERVER_POST_TO_COUNTRY
Определения delivery_cpcr.php:52
const DELIVERY_CPCR_CACHE_LIFETIME
Определения delivery_cpcr.php:15
const DELIVERY_CPCR_SERVER_POST_ADDITIONAL
Определения delivery_cpcr.php:64
const DELIVERY_CPCR_CITY_DEFAULT
Определения delivery_cpcr.php:22
const DELIVERY_CPCR_SERVER_POST_FROM_CITY
Определения delivery_cpcr.php:44
const DELIVERY_CPCR_SERVER_POST_TO_CITY
Определения delivery_cpcr.php:61
const DELIVERY_CPCR_CATEGORY_DEFAULT
Определения delivery_cpcr.php:17
const DELIVERY_CPCR_COUNTRY_DEFAULT
Определения delivery_cpcr.php:21
const DELIVERY_CPCR_SERVER
Определения delivery_cpcr.php:25
const DELIVERY_CPCR_SERVER_POST_FROM_CITY_NAME
Определения delivery_cpcr.php:41
const DELIVERY_CPCR_SERVER_POST_TO_CITY_NAME
Определения delivery_cpcr.php:58
const DELIVERY_CPCR_SERVER_POST_WEIGHT
Определения delivery_cpcr.php:46
const DELIVERY_CPCR_SERVER_PAGE
Определения delivery_cpcr.php:29
$i
Определения factura.php:643
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$title
Определения pdf.php:123
$arLocation['REGION_NAME']
Определения options.php:2800
$val
Определения options.php:1793
$location
Определения options.php:2729
$k
Определения template_pdf.php:567