1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
include.php
См. документацию.
1<?php
2
9
10const CATALOG_CONTAINER_PATH = 'modules/catalog/.container.php';
11
12const CATALOG_PATH2EXPORTS = '/bitrix/php_interface/include/catalog_export/';
13const CATALOG_PATH2EXPORTS_DEF = '/bitrix/modules/catalog/load/';
14const CATALOG_DEFAULT_EXPORT_PATH = '/bitrix/catalog_export/';
15
16const CATALOG_PATH2IMPORTS = '/bitrix/php_interface/include/catalog_import/';
17const CATALOG_PATH2IMPORTS_DEF = '/bitrix/modules/catalog/load_import/';
18
25
28
29/*
30* @deprecated deprecated since catalog 14.5.3
31* @see CCatalogDiscount::ENTITY_ID
32*/
34/*
35* @deprecated deprecated since catalog 14.5.3
36* @see CCatalogDiscountSave::ENTITY_ID
37*/
39
40/*
41* @deprecated deprecated since catalog 14.5.3
42* @see CCatalogDiscount::OLD_FORMAT
43*/
45/*
46* @deprecated deprecated since catalog 14.5.3
47* @see CCatalogDiscount::CURRENT_FORMAT
48*/
50
51const BX_CATALOG_FILENAME_REG = '/[^a-zA-Z0-9\s!#\$%&\‍(\‍)\[\]\{\}+\.;=@\^_\~\/\\\\\-]/i';
52
53// Constants for the store control: //
59const DOC_ARRIVAL = 'A';
63const DOC_MOVING = 'M';
67const DOC_RETURNS = 'R';
71const DOC_DEDUCT = 'D';
75const DOC_INVENTORY = 'I';
76
77//**********************************//
78
81
82if (!Loader::includeModule('iblock'))
83{
84 $APPLICATION->ThrowException(Loc::getMessage('CAT_ERROR_IBLOCK_NOT_INSTALLED'));
85
86 return false;
87}
88
89if (!Loader::includeModule('currency'))
90{
91 $APPLICATION->ThrowException(Loc::getMessage('CAT_ERROR_CURRENCY_NOT_INSTALLED'));
92
93 return false;
94}
95
97 'js' => '/bitrix/js/catalog/core_tree.js',
98 'css' => '/bitrix/panel/catalog/catalog_cond.css',
99 'lang' => '/bitrix/modules/catalog/lang/'.LANGUAGE_ID.'/js_core_tree.php',
100 'rel' => [
101 'core',
102 'date',
103 'window',
104 ],
105];
106CJSCore::RegisterExt('core_condtree', $arTreeDescr);
107
112
113require_once __DIR__ . '/autoload.php';
114
115if (defined('CATALOG_GLOBAL_VARS') && CATALOG_GLOBAL_VARS == 'Y')
116{
117 global $CATALOG_CATALOG_CACHE;
118 $CATALOG_CATALOG_CACHE = null;
119
120 global $CATALOG_ONETIME_COUPONS_ORDER;
121 $CATALOG_ONETIME_COUPONS_ORDER = null;
122
123 global $CATALOG_PRODUCT_CACHE;
124 $CATALOG_PRODUCT_CACHE = null;
125
126 global $MAIN_EXTRA_LIST_CACHE;
127 $MAIN_EXTRA_LIST_CACHE = null;
128
129 global $CATALOG_BASE_GROUP;
130 $CATALOG_BASE_GROUP = array();
131
132 global $CATALOG_TIME_PERIOD_TYPES;
134 $CATALOG_TIME_PERIOD_TYPES = CCatalogProduct::GetTimePeriodTypes(true);
135
146
159}
160
161/*************************************************************/
170function GetCatalogGroups($by = "SORT", $order = "ASC")
171{
172 return CCatalogGroup::GetList(array($by => $order));
173}
174
182function GetCatalogGroup($CATALOG_GROUP_ID)
183{
184 return CCatalogGroup::GetByID((int)$CATALOG_GROUP_ID);
185}
186
194function GetCatalogGroupName($CATALOG_GROUP_ID)
195{
196 $rn = CCatalogGroup::GetByID((int)$CATALOG_GROUP_ID);
197
198 return $rn["NAME_LANG"] ?? null;
199}
200
208function GetCatalogProduct($PRODUCT_ID)
209{
210 return CCatalogProduct::GetByID((int)$PRODUCT_ID);
211}
212
221function GetCatalogProductEx($PRODUCT_ID, $boolAllValues = false)
222{
223 return CCatalogProduct::GetByIDEx((int)$PRODUCT_ID, $boolAllValues);
224}
225
234function GetCatalogProductPrice($PRODUCT_ID, $CATALOG_GROUP_ID)
235{
237 [
238 'CATALOG_GROUP_ID' => 'ASC',
239 ],
240 [
241 'PRODUCT_ID' => (int)$PRODUCT_ID,
242 'CATALOG_GROUP_ID' => (int)$CATALOG_GROUP_ID,
243 ]
244 );
245
246 return $db_res->Fetch();
247}
248
258function GetCatalogProductPriceList($PRODUCT_ID, $by = "SORT", $order = "ASC")
259{
261 [
262 $by => $order,
263 ],
264 [
265 'PRODUCT_ID' => (int)$PRODUCT_ID,
266 ]
267 );
268
269 $arPrice = [];
270 while ($res = $db_res->Fetch())
271 {
272 $arPrice[] = $res;
273 }
274 unset($db_res);
275
276 return $arPrice;
277}
278
288function GetCatalogProductTable($IBLOCK, $SECT_ID=false, $arOrder=array("sort"=>"asc"), $cnt=0)
289{
290 return false;
291}
292
301function FormatCurrency($fSum, $strCurrency)
302{
303 return CCurrencyLang::CurrencyFormat($fSum, $strCurrency, true);
304}
305
317function CatalogBasketCallback($productID, $quantity = 0, $renewal = "N", $intUserID = 0, $strSiteID = false)
318{
319 $arParams = [
320 'PRODUCT_ID' => $productID,
321 'QUANTITY' => $quantity,
322 'RENEWAL' => $renewal,
323 'USER_ID' => $intUserID,
324 'SITE_ID' => $strSiteID,
325 'CHECK_QUANTITY' => 'Y',
326 'AVAILABLE_QUANTITY' => 'Y',
327 ];
328
330}
331
343function CatalogBasketOrderCallback($productID, $quantity, $renewal = "N", $intUserID = 0, $strSiteID = false)
344{
345 $arParams = [
346 'PRODUCT_ID' => $productID,
347 'QUANTITY' => $quantity,
348 'RENEWAL' => $renewal,
349 'USER_ID' => $intUserID,
350 'SITE_ID' => $strSiteID
351 ];
352
354 if (!empty($arResult) && is_array($arResult) && isset($arResult['QUANTITY']))
355 {
356 CCatalogProduct::QuantityTracer($productID, $arResult['QUANTITY']);
357 }
358
359 return $arResult;
360}
361
370function CatalogViewedProductCallback($productID, $UserID, $strSiteID = SITE_ID)
371{
372 global $USER;
373
374 $productID = intval($productID);
375 $UserID = intval($UserID);
376
377 if ($productID <= 0)
378 return false;
379
380 static $arUserCache = array();
381 if ($UserID > 0)
382 {
383 if (!isset($arUserCache[$UserID]))
384 {
385 $rsUsers = CUser::GetList('ID', 'ASC', array("ID_EQUAL_EXACT"=>$UserID), array('FIELDS' => array('ID')));
386 if ($arUser = $rsUsers->Fetch())
387 $arUserCache[$arUser['ID']] = CUser::GetUserGroup($arUser['ID']);
388 else
389 return false;
390 }
391
393
394 $dbIBlockElement = CIBlockElement::GetList(
395 array(),
396 array(
397 "ID" => $productID,
398 "ACTIVE" => "Y",
399 "ACTIVE_DATE" => "Y",
400 "CHECK_PERMISSIONS" => "N",
401 ),
402 false,
403 false,
404 array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL', 'TIMESTAMP_X', 'PREVIEW_PICTURE', 'DETAIL_PICTURE')
405 );
406 if(!($arProduct = $dbIBlockElement->GetNext()))
407 return false;
408
409 if (CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], "RIGHTS_MODE") == 'E')
410 {
411 $arUserRights = CIBlockElementRights::GetUserOperations($productID,$UserID);
412 if (empty($arUserRights))
413 return false;
414 elseif (!is_array($arUserRights) || !array_key_exists('element_read',$arUserRights))
415 return false;
416 }
417 else
418 {
419 if (CIBlock::GetPermission($arProduct['IBLOCK_ID'], $UserID) < 'R')
420 return false;
421 }
422 }
423 else
424 {
425 $dbIBlockElement = CIBlockElement::GetList(
426 array(),
427 array(
428 "ID" => $productID,
429 "ACTIVE" => "Y",
430 "ACTIVE_DATE" => "Y",
431 "CHECK_PERMISSIONS" => "Y",
432 "MIN_PERMISSION" => "R",
433 ),
434 false,
435 false,
436 array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL', 'TIMESTAMP_X', 'PREVIEW_PICTURE', 'DETAIL_PICTURE')
437 );
438 if(!($arProduct = $dbIBlockElement->GetNext()))
439 return false;
440 }
441
442 $bTrace = true;
443 if ($arCatalogProduct = CCatalogProduct::GetByID($productID))
444 {
445 if ($arCatalogProduct["CAN_BUY_ZERO"] != "Y" && ($arCatalogProduct["QUANTITY_TRACE"] == "Y" && doubleval($arCatalogProduct["QUANTITY"]) <= 0))
446 {
447 $currentPrice = 0.0;
448 $currentDiscount = 0.0;
449 $bTrace = false;
450 }
451 }
452
453 if ($bTrace)
454 {
455 $arPrice = CCatalogProduct::GetOptimalPrice($productID, 1, ($UserID > 0 ? $arUserCache[$UserID] : $USER->GetUserGroupArray()), "N", array(), ($UserID > 0 ? $strSiteID : false), array());
456
457 if (!empty($arPrice) && is_array($arPrice))
458 {
459 $currentPrice = $arPrice["PRICE"]["PRICE"];
460 $currentDiscount = 0.0;
461
462 if ($arPrice['PRICE']['VAT_INCLUDED'] == 'N')
463 {
464 if(doubleval($arPrice['PRICE']['VAT_RATE']) > 0)
465 {
466 $currentPrice *= (1 + $arPrice['PRICE']['VAT_RATE']);
467 $arPrice['PRICE']['VAT_INCLUDED'] = 'Y';
468 }
469 }
470
471 if (!empty($arPrice["DISCOUNT"]))
472 {
473 if ($arPrice["DISCOUNT"]["VALUE_TYPE"]=="F")
474 {
475 if ($arPrice["DISCOUNT"]["CURRENCY"] == $arPrice["PRICE"]["CURRENCY"])
476 $currentDiscount = $arPrice["DISCOUNT"]["VALUE"];
477 else
478 $currentDiscount = CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT"]["VALUE"], $arPrice["DISCOUNT"]["CURRENCY"], $arPrice["PRICE"]["CURRENCY"]);
479 }
480 elseif ($arPrice["DISCOUNT"]["VALUE_TYPE"]=="S")
481 {
482 if ($arPrice["DISCOUNT"]["CURRENCY"] == $arPrice["PRICE"]["CURRENCY"])
483 $currentDiscount = $arPrice["DISCOUNT"]["VALUE"];
484 else
485 $currentDiscount = CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT"]["VALUE"], $arPrice["DISCOUNT"]["CURRENCY"], $arPrice["PRICE"]["CURRENCY"]);
486 }
487 else
488 {
489 $currentDiscount = $currentPrice * $arPrice["DISCOUNT"]["VALUE"] / 100.0;
490
491 if (doubleval($arPrice["DISCOUNT"]["MAX_DISCOUNT"]) > 0)
492 {
493 if ($arPrice["DISCOUNT"]["CURRENCY"] == $arPrice["PRICE"]["CURRENCY"])
494 $maxDiscount = $arPrice["DISCOUNT"]["MAX_DISCOUNT"];
495 else
496 $maxDiscount = CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT"]["MAX_DISCOUNT"], $arPrice["DISCOUNT"]["CURRENCY"], $arPrice["PRICE"]["CURRENCY"]);
497
498 if ($currentDiscount > $maxDiscount)
499 $currentDiscount = $maxDiscount;
500 }
501 }
502
503 if ($arPrice["DISCOUNT"]["VALUE_TYPE"] == "S")
504 {
505 $currentDiscount_tmp = $currentPrice - $currentDiscount;
506 $currentPrice = $currentDiscount;
507 $currentDiscount = $currentDiscount_tmp;
508 unset($currentDiscount_tmp);
509 }
510 else
511 {
512 $currentPrice = $currentPrice - $currentDiscount;
513 }
514 }
515
516 if (empty($arPrice["PRICE"]["CATALOG_GROUP_NAME"]))
517 {
518 if (!empty($arPrice["PRICE"]["CATALOG_GROUP_ID"]))
519 {
520 $rsCatGroups = CCatalogGroup::GetList(array(),array('ID' => $arPrice["PRICE"]["CATALOG_GROUP_ID"]),false,array('nTopCount' => 1),array('ID','NAME','NAME_LANG'));
521 if ($arCatGroup = $rsCatGroups->Fetch())
522 {
523 $arPrice["PRICE"]["CATALOG_GROUP_NAME"] = (!empty($arCatGroup['NAME_LANG']) ? $arCatGroup['NAME_LANG'] : $arCatGroup['NAME']);
524 }
525 }
526 }
527 }
528 else
529 {
530 $currentPrice = 0.0;
531 $currentDiscount = 0.0;
532 }
533 }
534
536 "PREVIEW_PICTURE" => $arProduct['PREVIEW_PICTURE'],
537 "DETAIL_PICTURE" => $arProduct['DETAIL_PICTURE'],
538 "PRODUCT_PRICE_ID" => $arPrice["PRICE"]["ID"],
539 "PRICE" => $currentPrice,
540 "VAT_RATE" => $arPrice['PRICE']['VAT_RATE'],
541 "CURRENCY" => $arPrice["PRICE"]["CURRENCY"],
542 "DISCOUNT_PRICE" => $currentDiscount,
543 "NAME" => $arProduct["~NAME"],
544 "DETAIL_PAGE_URL" => $arProduct['~DETAIL_PAGE_URL'],
545 "NOTES" => $arPrice["PRICE"]["CATALOG_GROUP_NAME"]
546 );
547
548 if ($UserID > 0)
550
551 return $arResult;
552}
553
561function CatalogDeactivateOneTimeCoupons($intOrderID = 0)
562{
564}
565
566function CatalogPayOrderCallback($productID, $userID, $bPaid, $orderID)
567{
568 global $DB;
569 global $USER;
570
571 $productID = intval($productID);
572 $userID = intval($userID);
573 $bPaid = (bool)$bPaid;
574 $orderID = intval($orderID);
575
576 if ($userID <= 0)
577 return false;
578
579 $dbIBlockElement = CIBlockElement::GetList(
580 array(),
581 array(
582 "ID" => $productID,
583 "ACTIVE" => "Y",
584 "ACTIVE_DATE" => "Y",
585 "CHECK_PERMISSIONS" => "N",
586 ),
587 false,
588 false,
589 array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL')
590 );
591 if ($arIBlockElement = $dbIBlockElement->GetNext())
592 {
593 $arCatalog = CCatalog::GetByID($arIBlockElement["IBLOCK_ID"]);
594 if ($arCatalog["SUBSCRIPTION"] == "Y")
595 {
596 $arProduct = CCatalogProduct::GetByID($productID);
597
598 if ($bPaid)
599 {
600 if ('E' == CIBlock::GetArrayByID($arIBlockElement['IBLOCK_ID'], "RIGHTS_MODE"))
601 {
602 $arUserRights = CIBlockElementRights::GetUserOperations($productID, $userID);
603 if (empty($arUserRights))
604 {
605 return false;
606 }
607 elseif (!is_array($arUserRights) || !array_key_exists('element_read', $arUserRights))
608 {
609 return false;
610 }
611 }
612 else
613 {
614 if ('R' > CIBlock::GetPermission($arIBlockElement['IBLOCK_ID'], $userID))
615 {
616 return false;
617 }
618 }
619
620 $arUserGroups = array();
621 $arTmp = array();
622 $ind = -1;
623 $curTime = time();
624 $dbProductGroups = CCatalogProductGroups::GetList(
625 array(),
626 array("PRODUCT_ID" => $productID),
627 false,
628 false,
629 array("GROUP_ID", "ACCESS_LENGTH", "ACCESS_LENGTH_TYPE")
630 );
631 while ($arProductGroups = $dbProductGroups->Fetch())
632 {
633 $ind++;
634
635 $arProductGroups['GROUP_ID'] = intval($arProductGroups['GROUP_ID']);
636 $accessType = $arProductGroups["ACCESS_LENGTH_TYPE"];
637 $accessLength = intval($arProductGroups["ACCESS_LENGTH"]);
638
639 $accessVal = 0;
640 if (0 < $accessLength)
641 {
642 if ($accessType == CCatalogProduct::TIME_PERIOD_HOUR)
643 $accessVal = mktime(date("H") + $accessLength, date("i"), date("s"), date("m"), date("d"), date("Y"));
645 $accessVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + $accessLength, date("Y"));
647 $accessVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + 7 * $accessLength, date("Y"));
649 $accessVal = mktime(date("H"), date("i"), date("s"), date("m") + $accessLength, date("d"), date("Y"));
651 $accessVal = mktime(date("H"), date("i"), date("s"), date("m") + 3 * $accessLength, date("d"), date("Y"));
653 $accessVal = mktime(date("H"), date("i"), date("s"), date("m") + 6 * $accessLength, date("d"), date("Y"));
655 $accessVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y") + $accessLength);
657 $accessVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y") + 2 * $accessLength);
658 }
659
660 $arUserGroups[$ind] = array(
661 "GROUP_ID" => $arProductGroups["GROUP_ID"],
662 "DATE_ACTIVE_FROM" => date($DB->DateFormatToPHP(CLang::GetDateFormat("FULL", SITE_ID)), $curTime),
663 "DATE_ACTIVE_TO" => (0 < $accessLength ? date($DB->DateFormatToPHP(CLang::GetDateFormat("FULL", SITE_ID)), $accessVal) : false)
664 );
665
666 $arTmp[$arProductGroups["GROUP_ID"]] = $ind;
667 }
668
669 if (!empty($arUserGroups))
670 {
671 $dbOldGroups = CUser::GetUserGroupEx($userID);
672 while ($arOldGroups = $dbOldGroups->Fetch())
673 {
674 $arOldGroups["GROUP_ID"] = intval($arOldGroups["GROUP_ID"]);
675 if (array_key_exists($arOldGroups["GROUP_ID"], $arTmp))
676 {
677 if ($arOldGroups["DATE_ACTIVE_FROM"] == '')
678 {
679 $arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_FROM"] = false;
680 }
681 else
682 {
683 $oldDate = CDatabase::FormatDate($arOldGroups["DATE_ACTIVE_FROM"], CSite::GetDateFormat("SHORT", SITE_ID), "YYYYMMDDHHMISS");
684 $newDate = CDatabase::FormatDate($arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_FROM"], CSite::GetDateFormat("SHORT", SITE_ID), "YYYYMMDDHHMISS");
685 if ($oldDate > $newDate)
686 $arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_FROM"] = $arOldGroups["DATE_ACTIVE_FROM"];
687 }
688
689 if ($arOldGroups["DATE_ACTIVE_TO"] == '')
690 {
691 $arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_TO"] = false;
692 }
693 elseif (false !== $arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_TO"])
694 {
695 $oldDate = CDatabase::FormatDate($arOldGroups["DATE_ACTIVE_TO"], CSite::GetDateFormat("SHORT", SITE_ID), "YYYYMMDDHHMISS");
696 $newDate = CDatabase::FormatDate($arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_TO"], CSite::GetDateFormat("SHORT", SITE_ID), "YYYYMMDDHHMISS");
697 if ($oldDate > $newDate)
698 $arUserGroups[$arTmp[$arOldGroups["GROUP_ID"]]]["DATE_ACTIVE_TO"] = $arOldGroups["DATE_ACTIVE_TO"];
699 }
700 }
701 else
702 {
703 $ind++;
704
705 $arUserGroups[$ind] = array(
706 "GROUP_ID" => $arOldGroups["GROUP_ID"],
707 "DATE_ACTIVE_FROM" => $arOldGroups["DATE_ACTIVE_FROM"],
708 "DATE_ACTIVE_TO" => $arOldGroups["DATE_ACTIVE_TO"]
709 );
710 }
711 }
712
713 CUser::SetUserGroup($userID, $arUserGroups);
715 {
716 if (intval($USER->GetID()) == $userID)
717 {
718 $arUserGroupsTmp = array();
719 foreach ($arUserGroups as &$arOneGroup)
720 {
721 $arUserGroupsTmp[] = $arOneGroup["GROUP_ID"];
722 }
723 if (isset($arOneGroup))
724 unset($arOneGroup);
725
726 $USER->SetUserGroupArray($arUserGroupsTmp);
727 }
728 }
729 }
730 }
731 else
732 {
733 $arUserGroups = array();
734 $ind = -1;
735 $arTmp = array();
736
737 $dbOldGroups = CUser::GetUserGroupEx($userID);
738 while ($arOldGroups = $dbOldGroups->Fetch())
739 {
740 $ind++;
741 $arOldGroups["GROUP_ID"] = intval($arOldGroups["GROUP_ID"]);
742 $arUserGroups[$ind] = array(
743 "GROUP_ID" => $arOldGroups["GROUP_ID"],
744 "DATE_ACTIVE_FROM" => $arOldGroups["DATE_ACTIVE_FROM"],
745 "DATE_ACTIVE_TO" => $arOldGroups["DATE_ACTIVE_FROM"]
746 );
747
748 $arTmp[$arOldGroups["GROUP_ID"]] = $ind;
749 }
750
751 $bNeedUpdate = false;
752 $dbProductGroups = CCatalogProductGroups::GetList(
753 array(),
754 array("PRODUCT_ID" => $productID),
755 false,
756 false,
757 array("GROUP_ID")
758 );
759 while ($arProductGroups = $dbProductGroups->Fetch())
760 {
761 $arProductGroups["GROUP_ID"] = intval($arProductGroups["GROUP_ID"]);
762 if (array_key_exists($arProductGroups["GROUP_ID"], $arTmp))
763 {
764 unset($arUserGroups[$arProductGroups["GROUP_ID"]]);
765 $bNeedUpdate = true;
766 }
767 }
768
769 if ($bNeedUpdate)
770 {
771 CUser::SetUserGroup($userID, $arUserGroups);
772
774 {
775 if (intval($USER->GetID()) == $userID)
776 {
777 $arUserGroupsTmp = array();
778 foreach ($arUserGroups as &$arOneGroup)
779 {
780 $arUserGroupsTmp[] = $arOneGroup["GROUP_ID"];
781 }
782 if (isset($arOneGroup))
783 unset($arOneGroup);
784
785 $USER->SetUserGroupArray($arUserGroupsTmp);
786 }
787 }
788 }
789 }
790
791 if ($arProduct["PRICE_TYPE"] != "S")
792 {
793 if ($bPaid)
794 {
795 $recurType = $arProduct["RECUR_SCHEME_TYPE"];
796 $recurLength = intval($arProduct["RECUR_SCHEME_LENGTH"]);
797
798 $recurSchemeVal = 0;
799 if ($recurType == CCatalogProduct::TIME_PERIOD_HOUR)
800 $recurSchemeVal = mktime(date("H") + $recurLength, date("i"), date("s"), date("m"), date("d"), date("Y"));
802 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + $recurLength, date("Y"));
804 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + 7 * $recurLength, date("Y"));
806 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m") + $recurLength, date("d"), date("Y"));
808 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m") + 3 * $recurLength, date("d"), date("Y"));
810 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m") + 6 * $recurLength, date("d"), date("Y"));
812 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y") + $recurLength);
814 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y") + 2 * $recurLength);
815
817 "USER_ID" => $userID,
818 "MODULE" => "catalog",
819 "PRODUCT_ID" => $productID,
820 "PRODUCT_NAME" => $arIBlockElement["~NAME"],
821 "PRODUCT_URL" => $arIBlockElement["~DETAIL_PAGE_URL"],
822 "PRODUCT_PRICE_ID" => false,
823 "PRICE_TYPE" => $arProduct["PRICE_TYPE"],
824 "RECUR_SCHEME_TYPE" => $recurType,
825 "RECUR_SCHEME_LENGTH" => $recurLength,
826 "WITHOUT_ORDER" => $arProduct["WITHOUT_ORDER"],
827 "PRICE" => false,
828 "CURRENCY" => false,
829 "CANCELED" => "N",
830 "CANCELED_REASON" => false,
831 "PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider",
832 "DESCRIPTION" => false,
833 "PRIOR_DATE" => false,
834 "NEXT_DATE" => Date(
835 $DB->DateFormatToPHP(CLang::GetDateFormat("FULL", SITE_ID)),
836 $recurSchemeVal
837 )
838 );
839 return $arFields;
840 }
841 }
842 }
843 return true;
844 }
845
846 return false;
847}
848
849function CatalogRecurringCallback($productID, $userID)
850{
851 global $APPLICATION;
852 global $DB;
853
854 $productID = intval($productID);
855 if ($productID <= 0)
856 return false;
857
858 $userID = intval($userID);
859 if ($userID <= 0)
860 return false;
861
862 $arProduct = CCatalogProduct::GetByID($productID);
863 if (!$arProduct)
864 {
865 $APPLICATION->ThrowException(str_replace("#ID#", $productID, Loc::getMessage("I_NO_PRODUCT")), "NO_PRODUCT");
866 return false;
867 }
868
869 if ($arProduct["PRICE_TYPE"] == "T")
870 {
871 $arProduct = CCatalogProduct::GetByID($arProduct["TRIAL_PRICE_ID"]);
872 if (!$arProduct)
873 {
874 $APPLICATION->ThrowException(str_replace("#TRIAL_ID#", $productID, str_replace("#ID#", $arProduct["TRIAL_PRICE_ID"], Loc::getMessage("I_NO_TRIAL_PRODUCT"))), "NO_PRODUCT_TRIAL");
875 return false;
876 }
877 }
878 $productID = intval($arProduct["ID"]);
879
880 if ($arProduct["PRICE_TYPE"] != "R")
881 {
882 $APPLICATION->ThrowException(str_replace("#ID#", $productID, Loc::getMessage("I_PRODUCT_NOT_SUBSCR")), "NO_IBLOCK_SUBSCR");
883 return false;
884 }
885
886 $dbIBlockElement = CIBlockElement::GetList(
887 array(),
888 array(
889 "ID" => $productID,
890 "ACTIVE" => "Y",
891 "ACTIVE_DATE" => "Y",
892 "CHECK_PERMISSIONS" => "N",
893 ),
894 false,
895 false,
896 array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL')
897 );
898 if(!($arIBlockElement = $dbIBlockElement->GetNext()))
899 {
900 $APPLICATION->ThrowException(str_replace("#ID#", $productID, Loc::getMessage("I_NO_IBLOCK_ELEM")), "NO_IBLOCK_ELEMENT");
901 return false;
902 }
903 if ('E' == CIBlock::GetArrayByID($arIBlockElement['IBLOCK_ID'], "RIGHTS_MODE"))
904 {
905 $arUserRights = CIBlockElementRights::GetUserOperations($productID, $userID);
906 if (empty($arUserRights))
907 {
908 $APPLICATION->ThrowException(str_replace("#ID#", $productID, Loc::getMessage("I_NO_IBLOCK_ELEM")), "NO_IBLOCK_ELEMENT");
909 return false;
910 }
911 elseif (!is_array($arUserRights) || !array_key_exists('element_read', $arUserRights))
912 {
913 $APPLICATION->ThrowException(str_replace("#ID#", $productID, Loc::getMessage("I_NO_IBLOCK_ELEM")), "NO_IBLOCK_ELEMENT");
914 return false;
915 }
916 }
917 else
918 {
919 if ('R' > CIBlock::GetPermission($arIBlockElement['IBLOCK_ID'], $userID))
920 {
921 $APPLICATION->ThrowException(str_replace("#ID#", $productID, Loc::getMessage("I_NO_IBLOCK_ELEM")), "NO_IBLOCK_ELEMENT");
922 return false;
923 }
924 }
925
926 $arCatalog = CCatalog::GetByID($arIBlockElement["IBLOCK_ID"]);
927 if ($arCatalog["SUBSCRIPTION"] != "Y")
928 {
929 $APPLICATION->ThrowException(str_replace("#ID#", $arIBlockElement["IBLOCK_ID"], Loc::getMessage("I_CATALOG_NOT_SUBSCR")), "NOT_SUBSCRIPTION");
930 return false;
931 }
932
933 if ($arProduct["CAN_BUY_ZERO"]!="Y" && ($arProduct["QUANTITY_TRACE"] == "Y" && doubleval($arProduct["QUANTITY"]) <= 0))
934 {
935 $APPLICATION->ThrowException(str_replace("#ID#", $productID, Loc::getMessage("I_PRODUCT_SOLD")), "PRODUCT_END");
936 return false;
937 }
938
939 $arUserGroups = CUser::GetUserGroup($userID);
940 $arUserGroups = array_values(array_unique($arUserGroups));
941
943
944 $arPrice = CCatalogProduct::GetOptimalPrice($productID, 1, $arUserGroups, "Y");
945 if (empty($arPrice))
946 {
947 if ($nearestQuantity = CCatalogProduct::GetNearestQuantityPrice($productID, 1, $arUserGroups))
948 {
949 $quantity = $nearestQuantity;
950 $arPrice = CCatalogProduct::GetOptimalPrice($productID, $quantity, $arUserGroups, "Y");
951 }
952 }
953
955
956 if (empty($arPrice))
957 {
958 return false;
959 }
960
961 $currentPrice = $arPrice["PRICE"]["PRICE"];
962
963 //SIGURD: logic change. see mantiss 5036.
964 // discount applied to a final price with VAT already included.
965 if (doubleval($arPrice['PRICE']['VAT_RATE']) > 0 && $arPrice['PRICE']['VAT_INCLUDED'] != 'Y')
966 $currentPrice *= (1 + $arPrice['PRICE']['VAT_RATE']);
967
968 $arDiscountList = array();
969
970 if (!empty($arPrice["DISCOUNT_LIST"]))
971 {
972 foreach ($arPrice["DISCOUNT_LIST"] as &$arOneDiscount)
973 {
974 switch ($arOneDiscount['VALUE_TYPE'])
975 {
977 if ($arOneDiscount['CURRENCY'] == $arPrice["PRICE"]["CURRENCY"])
978 $currentDiscount = $arOneDiscount['VALUE'];
979 else
980 $currentDiscount = CCurrencyRates::ConvertCurrency($arOneDiscount["VALUE"], $arOneDiscount["CURRENCY"], $arPrice["PRICE"]["CURRENCY"]);
981 $currentPrice = $currentPrice - $currentDiscount;
982 unset($currentDiscount);
983 break;
985 $currentDiscount = $currentPrice*$arOneDiscount["VALUE"]/100.0;
986 if (0 < $arOneDiscount['MAX_DISCOUNT'])
987 {
988 if ($arOneDiscount['CURRENCY'] == $arPrice["PRICE"]["CURRENCY"])
989 $dblMaxDiscount = $arOneDiscount['MAX_DISCOUNT'];
990 else
991 $dblMaxDiscount = CCurrencyRates::ConvertCurrency($arOneDiscount['MAX_DISCOUNT'], $arOneDiscount["CURRENCY"], $arPrice["PRICE"]["CURRENCY"]);
992 if ($currentDiscount > $dblMaxDiscount)
993 $currentDiscount = $dblMaxDiscount;
994 }
995 $currentPrice = $currentPrice - $currentDiscount;
996 unset($currentDiscount);
997 break;
999 if ($arOneDiscount['CURRENCY'] == $arPrice["PRICE"]["CURRENCY"])
1000 $currentPrice = $arOneDiscount['VALUE'];
1001 else
1002 $currentPrice = CCurrencyRates::ConvertCurrency($arOneDiscount['VALUE'], $arOneDiscount["CURRENCY"], $arPrice["PRICE"]["CURRENCY"]);
1003 break;
1004 }
1005
1006 $arOneList = array(
1007 'ID' => $arOneDiscount['ID'],
1008 'NAME' => $arOneDiscount['NAME'],
1009 'COUPON' => '',
1010 'MODULE_ID' => 'catalog',
1011 );
1012
1013 if ($arOneDiscount['COUPON'])
1014 {
1015 $arOneList['COUPON'] = $arOneDiscount['COUPON'];
1016 }
1017 $arDiscountList[] = $arOneList;
1018 }
1019 unset($arOneDiscount);
1020 }
1021
1022 $recurType = $arProduct["RECUR_SCHEME_TYPE"];
1023 $recurLength = intval($arProduct["RECUR_SCHEME_LENGTH"]);
1024
1025 $recurSchemeVal = 0;
1026 if ($recurType == CCatalogProduct::TIME_PERIOD_HOUR)
1027 $recurSchemeVal = mktime(date("H") + $recurLength, date("i"), date("s"), date("m"), date("d"), date("Y"));
1029 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + $recurLength, date("Y"));
1031 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") + 7 * $recurLength, date("Y"));
1033 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m") + $recurLength, date("d"), date("Y"));
1035 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m") + 3 * $recurLength, date("d"), date("Y"));
1037 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m") + 6 * $recurLength, date("d"), date("Y"));
1039 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y") + $recurLength);
1041 $recurSchemeVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y") + 2 * $recurLength);
1042
1043 $arResult = array(
1044 "WEIGHT" => floatval($arProduct["WEIGHT"]),
1045 "DIMENSIONS" => serialize(array(
1046 "WIDTH" => $arProduct["WIDTH"],
1047 "HEIGHT" => $arProduct["HEIGHT"],
1048 "LENGTH" => $arProduct["LENGTH"]
1049 )),
1050 "VAT_RATE" => $arPrice["PRICE"]["VAT_RATE"],
1051 "QUANTITY" => 1,
1052 "PRICE" => $currentPrice,
1053 "WITHOUT_ORDER" => $arProduct["WITHOUT_ORDER"],
1054 "PRODUCT_ID" => $productID,
1055 "PRODUCT_NAME" => $arIBlockElement["~NAME"],
1056 "PRODUCT_URL" => $arIBlockElement["~DETAIL_PAGE_URL"],
1057 "PRODUCT_PRICE_ID" => $arPrice["PRICE"]["ID"],
1058 "CURRENCY" => $arPrice["PRICE"]["CURRENCY"],
1059 "NAME" => $arIBlockElement["NAME"],
1060 "MODULE" => "catalog",
1061 "PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider",
1062 "CATALOG_GROUP_NAME" => $arPrice["PRICE"]["CATALOG_GROUP_NAME"],
1063 "DETAIL_PAGE_URL" => $arIBlockElement["~DETAIL_PAGE_URL"],
1064 "PRICE_TYPE" => $arProduct["PRICE_TYPE"],
1065 "RECUR_SCHEME_TYPE" => $arProduct["RECUR_SCHEME_TYPE"],
1066 "RECUR_SCHEME_LENGTH" => $arProduct["RECUR_SCHEME_LENGTH"],
1067 "PRODUCT_XML_ID" => $arIBlockElement["~XML_ID"],
1068 "TYPE" => ($arProduct["TYPE"] == CCatalogProduct::TYPE_SET) ? CCatalogProductSet::TYPE_SET : NULL,
1069 "NEXT_DATE" => date(
1070 $DB->DateFormatToPHP(CLang::GetDateFormat("FULL", SITE_ID)),
1071 $recurSchemeVal
1072 )
1073 );
1074 if (!empty($arPrice["DISCOUNT_LIST"]))
1075 {
1076 $arResult['DISCOUNT_LIST'] = $arDiscountList;
1077 }
1078
1079 return $arResult;
1080}
1081
1082function CatalogBasketCancelCallback($PRODUCT_ID, $QUANTITY, $bCancel)
1083{
1084 $PRODUCT_ID = intval($PRODUCT_ID);
1085 $QUANTITY = doubleval($QUANTITY);
1086 $bCancel = (bool)$bCancel;
1087
1088 if ($bCancel)
1089 CCatalogProduct::QuantityTracer($PRODUCT_ID, -$QUANTITY);
1090 else
1091 {
1092 CCatalogProduct::QuantityTracer($PRODUCT_ID, $QUANTITY);
1093 }
1094}
1095
1106function Add2Basket($PRICE_ID, $QUANTITY = 1, $arRewriteFields = array(), $arProductParams = array())
1107{
1108 global $APPLICATION;
1109
1110 $PRICE_ID = (int)$PRICE_ID;
1111 if ($PRICE_ID <= 0)
1112 {
1113 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_PRODUCT_PRICE_NOT_FOUND'), "NO_PRODUCT_PRICE");
1114 return false;
1115 }
1116 $QUANTITY = (float)$QUANTITY;
1117 if ($QUANTITY <= 0)
1118 $QUANTITY = 1;
1119
1120 if (!Loader::includeModule("sale"))
1121 {
1122 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_SALE_MODULE'), "NO_SALE_MODULE");
1123 return false;
1124 }
1125 if (Loader::includeModule("statistic") && isset($_SESSION['SESS_SEARCHER_ID']) && (int)$_SESSION["SESS_SEARCHER_ID"] > 0)
1126 {
1127 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_SESS_SEARCHER'), "SESS_SEARCHER");
1128 return false;
1129 }
1130
1131 $rsPrices = CPrice::GetListEx(
1132 array(),
1133 array('ID' => $PRICE_ID),
1134 false,
1135 false,
1136 array(
1137 'ID',
1138 'PRODUCT_ID',
1139 'PRICE',
1140 'CURRENCY',
1141 'CATALOG_GROUP_ID'
1142 )
1143 );
1144 if (!($arPrice = $rsPrices->Fetch()))
1145 {
1146 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_PRODUCT_PRICE_NOT_FOUND'), "NO_PRODUCT_PRICE");
1147 return false;
1148 }
1149 $arPrice['CATALOG_GROUP_NAME'] = '';
1150 $rsCatGroups = CCatalogGroup::GetListEx(
1151 array(),
1152 array('ID' => $arPrice['CATALOG_GROUP_ID']),
1153 false,
1154 false,
1155 array(
1156 'ID',
1157 'NAME',
1158 'NAME_LANG'
1159 )
1160 );
1161 if ($arCatGroup = $rsCatGroups->Fetch())
1162 {
1163 $arPrice['CATALOG_GROUP_NAME'] = (!empty($arCatGroup['NAME_LANG']) ? $arCatGroup['NAME_LANG'] : $arCatGroup['NAME']);
1164 }
1165 $rsProducts = CCatalogProduct::GetList(
1166 array(),
1167 array('ID' => $arPrice["PRODUCT_ID"]),
1168 false,
1169 false,
1170 array(
1171 'ID',
1172 'CAN_BUY_ZERO',
1173 'QUANTITY_TRACE',
1174 'QUANTITY',
1175 'WEIGHT',
1176 'WIDTH',
1177 'HEIGHT',
1178 'LENGTH',
1179 'TYPE',
1180 'MEASURE'
1181 )
1182 );
1183 if (!($arCatalogProduct = $rsProducts->Fetch()))
1184 {
1185 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_PRODUCT'), "NO_PRODUCT");
1186 return false;
1187 }
1188 if (
1189 ($arCatalogProduct['TYPE'] == Catalog\ProductTable::TYPE_SKU || $arCatalogProduct['TYPE'] == Catalog\ProductTable::TYPE_EMPTY_SKU)
1190 && Main\Config\Option::get('catalog', 'show_catalog_tab_with_offers') != 'Y'
1191 )
1192 {
1193 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_CANNOT_ADD_SKU'), "NO_PRODUCT");
1194 return false;
1195 }
1196 if ($arCatalogProduct['TYPE'] == Catalog\ProductTable::TYPE_SET)
1197 {
1199 if (empty($allSets))
1200 {
1201 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_PRODUCT_SET'), "NO_PRODUCT");
1202 return false;
1203 }
1204 $set = current($allSets);
1205 unset($allSets);
1206 $itemIds = array();
1207 foreach ($set['ITEMS'] as $item)
1208 {
1209 if ($item['ITEM_ID'] != $item['OWNER_ID'])
1210 $itemIds[$item['ITEM_ID']] = $item['ITEM_ID'];
1211 }
1212 if (empty($itemIds))
1213 {
1214 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_PRODUCT_SET'), "NO_PRODUCT");
1215 return false;
1216 }
1217 $iterator = CIBlockElement::GetList(
1218 array(),
1219 array(
1220 'ID' => $itemIds,
1221 'ACTIVE' => 'Y',
1222 'ACTIVE_DATE' => 'Y',
1223 'CHECK_PERMISSIONS' => 'N'
1224 ),
1225 false,
1226 false,
1227 array('ID', 'IBLOCK_ID')
1228 );
1229 while ($row = $iterator->Fetch())
1230 {
1231 if (isset($itemIds[$row['ID']]))
1232 unset($itemIds[$row['ID']]);
1233 }
1234 unset($row, $iterator);
1235 if (!empty($itemIds))
1236 {
1237 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_PRODUCT_SET_ITEM'), "NO_PRODUCT");
1238 return false;
1239 }
1240 }
1241
1242 $arCatalogProduct['MEASURE'] = (int)$arCatalogProduct['MEASURE'];
1243 $arCatalogProduct['MEASURE_NAME'] = '';
1244 $arCatalogProduct['MEASURE_CODE'] = 0;
1245 if ($arCatalogProduct['MEASURE'] <= 0)
1246 {
1247 $arMeasure = CCatalogMeasure::getDefaultMeasure(true, true);
1248 $arCatalogProduct['MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
1249 $arCatalogProduct['MEASURE_CODE'] = $arMeasure['CODE'];
1250 }
1251 else
1252 {
1253 $rsMeasures = CCatalogMeasure::getList(
1254 array(),
1255 array('ID' => $arCatalogProduct['MEASURE']),
1256 false,
1257 false,
1258 array('ID', 'SYMBOL_RUS', 'CODE')
1259 );
1260 if ($arMeasure = $rsMeasures->GetNext())
1261 {
1262 $arCatalogProduct['MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
1263 $arCatalogProduct['MEASURE_CODE'] = $arMeasure['CODE'];
1264 }
1265 }
1266
1267 $dblQuantity = (float)$arCatalogProduct["QUANTITY"];
1268 $boolQuantity = ($arCatalogProduct["CAN_BUY_ZERO"] != 'Y' && $arCatalogProduct["QUANTITY_TRACE"] == 'Y');
1269 if ($boolQuantity && $dblQuantity <= 0)
1270 {
1271 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_PRODUCT_RUN_OUT'), "PRODUCT_RUN_OUT");
1272 return false;
1273 }
1274
1275 $rsItems = CIBlockElement::GetList(
1276 array(),
1277 array(
1278 "ID" => $arPrice["PRODUCT_ID"],
1279 "ACTIVE" => "Y",
1280 "ACTIVE_DATE" => "Y",
1281 "CHECK_PERMISSIONS" => "Y",
1282 "MIN_PERMISSION" => "R"
1283 ),
1284 false,
1285 false,
1286 array(
1287 'ID',
1288 'IBLOCK_ID',
1289 'NAME',
1290 'XML_ID',
1291 'DETAIL_PAGE_URL'
1292 )
1293 );
1294 if (!($arProduct = $rsItems->GetNext()))
1295 {
1296 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_PRODUCT'), "NO_PRODUCT");
1297 return false;
1298 }
1299
1300 $arProps = array();
1301
1302 $strIBlockXmlID = (string)CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'XML_ID');
1303 if ($strIBlockXmlID !== '')
1304 {
1305 $arProps[] = array(
1306 "NAME" => "Catalog XML_ID",
1307 "CODE" => "CATALOG.XML_ID",
1308 "VALUE" => $strIBlockXmlID
1309 );
1310 }
1311
1312 // add sku props
1313 $arParentSku = CCatalogSku::GetProductInfo($arProduct['ID'], $arProduct['IBLOCK_ID']);
1314 if (!empty($arParentSku))
1315 {
1316 if (mb_strpos($arProduct["~XML_ID"], '#') === false)
1317 {
1318 $parentIterator = Iblock\ElementTable::getList(array(
1319 'select' => array('ID', 'XML_ID'),
1320 'filter' => array('ID' => $arParentSku['ID'])
1321 ));
1322 if ($parent = $parentIterator->fetch())
1323 {
1324 $arProduct["~XML_ID"] = $parent['XML_ID'].'#'.$arProduct["~XML_ID"];
1325 }
1326 unset($parent, $parentIterator);
1327 }
1328 }
1329
1330 if (!empty($arProductParams) && is_array($arProductParams))
1331 {
1332 foreach ($arProductParams as &$arOneProductParams)
1333 {
1334 $arProps[] = array(
1335 "NAME" => $arOneProductParams["NAME"],
1336 "CODE" => $arOneProductParams["CODE"],
1337 "VALUE" => $arOneProductParams["VALUE"],
1338 "SORT" => $arOneProductParams["SORT"],
1339 );
1340 }
1341 unset($arOneProductParams);
1342 }
1343
1344 $arProps[] = array(
1345 "NAME" => "Product XML_ID",
1346 "CODE" => "PRODUCT.XML_ID",
1347 "VALUE" => $arProduct["~XML_ID"]
1348 );
1349
1350 $arFields = array(
1351 "PRODUCT_ID" => $arPrice["PRODUCT_ID"],
1352 "PRODUCT_PRICE_ID" => $PRICE_ID,
1353 "BASE_PRICE" => $arPrice["PRICE"],
1354 "PRICE" => $arPrice["PRICE"],
1355 "DISCOUNT_PRICE" => 0,
1356 "CURRENCY" => $arPrice["CURRENCY"],
1357 "WEIGHT" => $arCatalogProduct["WEIGHT"],
1358 "DIMENSIONS" => serialize(array(
1359 "WIDTH" => $arCatalogProduct["WIDTH"],
1360 "HEIGHT" => $arCatalogProduct["HEIGHT"],
1361 "LENGTH" => $arCatalogProduct["LENGTH"]
1362 )),
1363 "QUANTITY" => ($boolQuantity && $dblQuantity < $QUANTITY ? $dblQuantity : $QUANTITY),
1364 "LID" => SITE_ID,
1365 "DELAY" => "N",
1366 "CAN_BUY" => "Y",
1367 "NAME" => $arProduct["~NAME"],
1368 "MODULE" => "catalog",
1369 "PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider",
1370 "NOTES" => $arPrice["CATALOG_GROUP_NAME"],
1371 "DETAIL_PAGE_URL" => $arProduct["~DETAIL_PAGE_URL"],
1372 "CATALOG_XML_ID" => $strIBlockXmlID,
1373 "PRODUCT_XML_ID" => $arProduct["~XML_ID"],
1374 "PROPS" => $arProps,
1375 "TYPE" => ($arCatalogProduct["TYPE"] == CCatalogProduct::TYPE_SET) ? CCatalogProductSet::TYPE_SET : NULL,
1376 "MEASURE_NAME" => $arCatalogProduct['MEASURE_NAME'],
1377 "MEASURE_CODE" => $arCatalogProduct['MEASURE_CODE'],
1378 'MEASURE' => array(
1379 'ID' => $arCatalogProduct['MEASURE'],
1380 'NAME' => $arCatalogProduct['MEASURE_NAME'],
1381 'CODE' => $arCatalogProduct['MEASURE_CODE']
1382 )
1383 );
1384
1385 if (!empty($arRewriteFields) && is_array($arRewriteFields))
1386 {
1387 $arFields = array_merge($arFields, $arRewriteFields);
1388 }
1389 $result = CSaleBasket::Add($arFields);
1390
1391 if ($result)
1392 {
1393 if (Loader::includeModule("statistic"))
1394 CStatistic::Set_Event("eStore", "add2basket", $arFields["PRODUCT_ID"]);
1395 }
1396
1397 return $result;
1398}
1399
1410function Add2BasketByProductID($productId, $quantity = 1, $rewriteFields = array(), $productParams = false)
1411{
1412 global $APPLICATION;
1413
1414 $result = false;
1415
1416 if (!Loader::includeModule('sale'))
1417 {
1418 return $result;
1419 }
1420
1421 $registry = Sale\Registry::getInstance(Sale\Registry::REGISTRY_TYPE_ORDER);
1422
1423 /* for old use */
1424 if ($productParams === false)
1425 {
1426 $productParams = $rewriteFields;
1427 $rewriteFields = array();
1428 }
1429
1430 $rewrite = (!empty($rewriteFields) && is_array($rewriteFields));
1431 if ($rewrite && isset($rewriteFields['SUBSCRIBE']) && $rewriteFields['SUBSCRIBE'] == 'Y')
1432 return SubscribeProduct($productId, $rewriteFields, $productParams);
1433
1434 $quantity = (empty($quantity) ? 1 : (float)$quantity);
1435 if ($quantity <= 0)
1436 $quantity = 1;
1437
1438 $product = array(
1439 'PRODUCT_ID' => $productId,
1440 'QUANTITY' => $quantity
1441 );
1442 if (!empty($productParams))
1443 $product['PROPS'] = $productParams;
1444
1445 $basketResult = Catalog\Product\Basket::addProduct($product, ($rewrite ? $rewriteFields : array()));
1446 if ($basketResult->isSuccess())
1447 {
1448 $data = $basketResult->getData();
1449 $result = $data['ID'];
1450 unset($data);
1451
1452 if (!empty($rewriteFields['ORDER_ID']) && intval($rewriteFields['ORDER_ID']) > 0)
1453 {
1454 trigger_error("Wrong API usage of adding a product in order", E_USER_WARNING);
1455
1456 $productId = (int)$productId;
1457 if ($productId <= 0)
1458 {
1459 $APPLICATION->ThrowException(
1460 Main\Localization\Loc::getMessage('BX_CATALOG_PRODUCT_BASKET_ERR_NO_PRODUCT')
1461 );
1462 return $result;
1463 }
1464
1465 $module = 'catalog';
1466 if (array_key_exists('MODULE', $rewriteFields))
1467 {
1468 $module = $rewriteFields['MODULE'];
1469 }
1470
1471 $siteId = SITE_ID;
1472 if (!empty($rewriteFields['LID']))
1473 {
1474 $siteId = $rewriteFields['LID'];
1475 }
1477 $basketClassName = $registry->getBasketClassName();
1478
1479 $basket = $basketClassName::loadItemsForFUser(\Bitrix\Sale\Fuser::getId(), $siteId);
1480
1481 $propertyList = array();
1482 if (!empty($product['PROPS']) && is_array($product['PROPS']))
1483 {
1484 $propertyList = $product['PROPS'];
1485 }
1486
1487 $basketItems = $basket->getExistsItems($module, $productId, $propertyList);
1488 foreach ($basketItems as $basketItem)
1489 {
1490 $basketItem->setFieldNoDemand('ORDER_ID', intval($rewriteFields['ORDER_ID']));
1491 }
1492
1493 if ($basketItems)
1494 {
1495 $r = $basket->save();
1496
1498 $orderClass = $registry->getOrderClassName();
1499
1500 $orderId = intval($rewriteFields['ORDER_ID']);
1501 $order = $orderClass::load($orderId);
1502 if ($order)
1503 {
1504 $basket = $order->getBasket();
1505 $basket->refresh();
1506 $r = $order->save();
1507 if (!$r->isSuccess())
1508 {
1509 $APPLICATION->ThrowException(
1510 implode('; ', $r->getErrorMessages())
1511 );
1512 }
1513 }
1514 }
1515 }
1516
1517 }
1518 else
1519 {
1520 $APPLICATION->ThrowException(
1521 implode('; ', $basketResult->getErrorMessages())
1522 );
1523 }
1524 unset($product);
1525 unset($basketResult);
1526
1527 return $result;
1528}
1529
1539function SubscribeProduct($intProductID, $arRewriteFields = array(), $arProductParams = array())
1540{
1541 global $USER, $APPLICATION;
1542
1544 return false;
1545 if (!$USER->IsAuthorized())
1546 return false;
1547 $intUserID = (int)$USER->GetID();
1548
1549 $intProductID = (int)$intProductID;
1550 if ($intProductID <= 0)
1551 {
1552 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_EMPTY_PRODUCT_ID'), "EMPTY_PRODUCT_ID");
1553 return false;
1554 }
1555
1556 if (!Loader::includeModule("sale"))
1557 {
1558 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_SALE_MODULE'), "NO_SALE_MODULE");
1559 return false;
1560 }
1561
1562 if (!Catalog\Product\Basket::isNotCrawler())
1563 {
1564 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_SESS_SEARCHER'));
1565 return false;
1566 }
1567
1568 $rsProducts = CCatalogProduct::GetList(
1569 array(),
1570 array('ID' => $intProductID),
1571 false,
1572 false,
1573 array(
1574 'ID',
1575 'WEIGHT',
1576 'WIDTH',
1577 'HEIGHT',
1578 'LENGTH',
1579 'TYPE',
1580 'MEASURE',
1581 'SUBSCRIBE'
1582 )
1583 );
1584 if (!($arCatalogProduct = $rsProducts->Fetch()))
1585 {
1586 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_PRODUCT'), "NO_PRODUCT");
1587 return false;
1588 }
1589
1590 if ($arCatalogProduct['SUBSCRIBE'] == 'N')
1591 {
1592 $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_SUBSCRIBE'), 'SUBSCRIBE');
1593 return false;
1594 }
1595 $arCatalogProduct['MEASURE'] = (int)$arCatalogProduct['MEASURE'];
1596 $arCatalogProduct['MEASURE_NAME'] = '';
1597 $arCatalogProduct['MEASURE_CODE'] = 0;
1598 if ($arCatalogProduct['MEASURE'] <= 0)
1599 {
1600 $arMeasure = CCatalogMeasure::getDefaultMeasure(true, true);
1601 $arCatalogProduct['MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
1602 $arCatalogProduct['MEASURE_CODE'] = $arMeasure['CODE'];
1603 }
1604 else
1605 {
1606 $rsMeasures = CCatalogMeasure::getList(
1607 array(),
1608 array('ID' => $arCatalogProduct['MEASURE']),
1609 false,
1610 false,
1611 array('ID', 'SYMBOL_RUS', 'CODE')
1612 );
1613 if ($arMeasure = $rsMeasures->GetNext())
1614 {
1615 $arCatalogProduct['MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
1616 $arCatalogProduct['MEASURE_CODE'] = $arMeasure['CODE'];
1617 }
1618 }
1619
1620 $rsItems = CIBlockElement::GetList(
1621 array(),
1622 array(
1623 "ID" => $intProductID,
1624 "ACTIVE" => "Y",
1625 "ACTIVE_DATE" => "Y",
1626 "CHECK_PERMISSIONS" => "Y",
1627 "MIN_PERMISSION" => "R"
1628 ),
1629 false,
1630 false,
1631 array(
1632 'ID',
1633 'IBLOCK_ID',
1634 'NAME',
1635 'XML_ID',
1636 'DETAIL_PAGE_URL'
1637 )
1638 );
1639 if (!($arProduct = $rsItems->GetNext()))
1640 return false;
1641
1642 $arParentSku = CCatalogSku::GetProductInfo($intProductID, $arProduct['IBLOCK_ID']);
1643 if (!empty($arParentSku))
1644 {
1645 if (mb_strpos($arProduct["~XML_ID"], '#') === false)
1646 {
1647 $parentIterator = Iblock\ElementTable::getList(array(
1648 'select' => array('ID', 'XML_ID'),
1649 'filter' => array('ID' => $arParentSku['ID'])
1650 ));
1651 if ($parent = $parentIterator->fetch())
1652 {
1653 $arProduct["~XML_ID"] = $parent['XML_ID'].'#'.$arProduct["~XML_ID"];
1654 }
1655 unset($parent, $parentIterator);
1656 }
1657 }
1658
1659 $arPrice = array(
1660 'BASE_PRICE' => 0,
1661 'PRICE' => 0.0,
1662 'DISCOUNT_PRICE' => 0,
1663 'CURRENCY' => CSaleLang::GetLangCurrency(SITE_ID),
1664 'VAT_RATE' => 0,
1665 'PRODUCT_PRICE_ID' => 0,
1666 'CATALOG_GROUP_NAME' => '',
1667 );
1668 $arBuyerGroups = $USER->GetUserGroupArray();
1669 $arSubscrPrice = CCatalogProduct::GetOptimalPrice($intProductID, 1, $arBuyerGroups, "N", array(), SITE_ID, array());
1670 if (!empty($arSubscrPrice) && is_array($arSubscrPrice))
1671 {
1672 $arPrice['BASE_PRICE'] = $arSubscrPrice['RESULT_PRICE']['BASE_PRICE'];
1673 $arPrice['PRICE'] = $arSubscrPrice['RESULT_PRICE']['DISCOUNT_PRICE'];
1674 $arPrice['DISCOUNT_PRICE'] = $arSubscrPrice['RESULT_PRICE']['DISCOUNT'];
1675 $arPrice['CURRENCY'] = $arSubscrPrice['RESULT_PRICE']['CURRENCY'];
1676 $arPrice['VAT_RATE'] = $arSubscrPrice['RESULT_PRICE']['VAT_RATE'];
1677 $arPrice['PRODUCT_PRICE_ID'] = $arSubscrPrice['PRICE']['ID'];
1678 $arPrice['CATALOG_GROUP_NAME'] = $arSubscrPrice['PRICE']['CATALOG_GROUP_NAME'];
1679 }
1680
1681 $arProps = array();
1682
1683 $strIBlockXmlID = (string)CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'XML_ID');
1684 if ($strIBlockXmlID !== '')
1685 {
1686 $arProps[] = array(
1687 "NAME" => "Catalog XML_ID",
1688 "CODE" => "CATALOG.XML_ID",
1689 "VALUE" => $strIBlockXmlID
1690 );
1691 }
1692
1693 if (!empty($arProductParams) && is_array($arProductParams))
1694 {
1695 foreach ($arProductParams as &$arOneProductParams)
1696 {
1697 $arProps[] = array(
1698 "NAME" => $arOneProductParams["NAME"],
1699 "CODE" => $arOneProductParams["CODE"],
1700 "VALUE" => $arOneProductParams["VALUE"],
1701 "SORT" => $arOneProductParams["SORT"],
1702 );
1703 }
1704 unset($arOneProductParams);
1705 }
1706
1707 $arProps[] = array(
1708 "NAME" => "Product XML_ID",
1709 "CODE" => "PRODUCT.XML_ID",
1710 "VALUE" => $arProduct["XML_ID"]
1711 );
1712
1713 $arFields = array(
1714 "PRODUCT_ID" => $intProductID,
1715 "PRODUCT_PRICE_ID" => $arPrice['PRODUCT_PRICE_ID'],
1716 "BASE_PRICE" => $arPrice['BASE_PRICE'],
1717 "PRICE" => $arPrice['PRICE'],
1718 "DISCOUNT_PRICE" => $arPrice['DISCOUNT_PRICE'],
1719 "CURRENCY" => $arPrice['CURRENCY'],
1720 "VAT_RATE" => $arPrice['VAT_RATE'],
1721 "WEIGHT" => $arCatalogProduct["WEIGHT"],
1722 "DIMENSIONS" => serialize(array(
1723 "WIDTH" => $arCatalogProduct["WIDTH"],
1724 "HEIGHT" => $arCatalogProduct["HEIGHT"],
1725 "LENGTH" => $arCatalogProduct["LENGTH"]
1726 )),
1727 "QUANTITY" => 1,
1728 "LID" => SITE_ID,
1729 "DELAY" => "N",
1730 "CAN_BUY" => "N",
1731 "SUBSCRIBE" => "Y",
1732 "NAME" => $arProduct["~NAME"],
1733 "MODULE" => "catalog",
1734 "PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider",
1735 "NOTES" => $arPrice["CATALOG_GROUP_NAME"],
1736 "DETAIL_PAGE_URL" => $arProduct["~DETAIL_PAGE_URL"],
1737 "CATALOG_XML_ID" => $strIBlockXmlID,
1738 "PRODUCT_XML_ID" => $arProduct["~XML_ID"],
1739 "PROPS" => $arProps,
1740 "TYPE" => ($arCatalogProduct["TYPE"] == CCatalogProduct::TYPE_SET) ? CCatalogProductSet::TYPE_SET : NULL,
1741 "MEASURE_NAME" => $arCatalogProduct['MEASURE_NAME'],
1742 "MEASURE_CODE" => $arCatalogProduct['MEASURE_CODE'],
1743 'IGNORE_CALLBACK_FUNC' => 'Y'
1744 );
1745
1746 if (!empty($arRewriteFields) && is_array($arRewriteFields))
1747 {
1748 if (array_key_exists('SUBSCRIBE', $arRewriteFields))
1749 unset($arRewriteFields['SUBSCRIBE']);
1750 if (array_key_exists('CAN_BUY', $arRewriteFields))
1751 unset($arRewriteFields['CAN_BUY']);
1752 if (array_key_exists('DELAY', $arRewriteFields))
1753 unset($arRewriteFields['DELAY']);
1754 if (!empty($arRewriteFields))
1755 $arFields = array_merge($arFields, $arRewriteFields);
1756 }
1757
1758 $mxBasketID = CSaleBasket::Add($arFields);
1759 if ($mxBasketID)
1760 {
1761 if (!isset($_SESSION['NOTIFY_PRODUCT']))
1762 {
1763 $_SESSION['NOTIFY_PRODUCT'] = array(
1764 $intUserID => array(),
1765 );
1766 }
1767 elseif (!isset($_SESSION['NOTIFY_PRODUCT'][$intUserID]))
1768 {
1769 $_SESSION['NOTIFY_PRODUCT'][$intUserID] = array();
1770 }
1771 $_SESSION["NOTIFY_PRODUCT"][$intUserID][$intProductID] = $intProductID;
1772
1773 if (Loader::includeModule("statistic"))
1774 CStatistic::Set_Event("sale2basket", "subscribe", $intProductID);
1775 }
1776 return $mxBasketID;
1777}
1778
1789function CatalogGetPriceTableEx($ID, $filterQauntity = 0, $arFilterType = array(), $VAT_INCLUDE = 'Y', $arCurrencyParams = array())
1790{
1791 global $USER;
1792
1793 static $arPriceTypes = array();
1794
1795 $ID = (int)$ID;
1796 if ($ID <= 0)
1797 return false;
1798
1799 $filterQauntity = (int)$filterQauntity;
1800
1801 if (!is_array($arFilterType))
1802 $arFilterType = array($arFilterType);
1803
1804 $boolConvert = false;
1805 $strCurrencyID = '';
1806 $arCurrencyList = array();
1807 if (!empty($arCurrencyParams) && is_array($arCurrencyParams) && !empty($arCurrencyParams['CURRENCY_ID']))
1808 {
1809 $boolConvert = true;
1810 $strCurrencyID = $arCurrencyParams['CURRENCY_ID'];
1811 }
1812
1813 $arResult = array();
1814 $arResult["ROWS"] = array();
1815 $arResult["COLS"] = array();
1816 $arResult["MATRIX"] = array();
1817 $arResult["CAN_BUY"] = array();
1818 $arResult["AVAILABLE"] = "N";
1819
1820 $arUserGroups = $USER->GetUserGroupArray();
1822 $strCacheID = 'UG_'.implode('_', $arUserGroups);
1823
1824 if (isset($arPriceTypes[$strCacheID]))
1825 {
1826 $arPriceGroups = $arPriceTypes[$strCacheID];
1827 }
1828 else
1829 {
1830 $arPriceGroups = CCatalogGroup::GetGroupsPerms($arUserGroups, array());
1831 $arPriceTypes[$strCacheID] = $arPriceGroups;
1832 }
1833
1834 if (empty($arPriceGroups["view"]))
1835 return $arResult;
1836
1837 $currentQuantity = -1;
1838 $rowsCnt = -1;
1839
1840 $arFilter = array("PRODUCT_ID" => $ID);
1841 if ($filterQauntity > 0)
1842 {
1843 $arFilter["+<=QUANTITY_FROM"] = $filterQauntity;
1844 $arFilter["+>=QUANTITY_TO"] = $filterQauntity;
1845 }
1846 if (!empty($arFilterType))
1847 {
1848 $arTmp = array();
1849 foreach ($arPriceGroups["view"] as &$intOneGroup)
1850 {
1851 if (in_array($intOneGroup, $arFilterType))
1852 $arTmp[] = $intOneGroup;
1853 }
1854 if (isset($intOneGroup))
1855 unset($intOneGroup);
1856
1857 if (empty($arTmp))
1858 return $arResult;
1859
1860 $arFilter["CATALOG_GROUP_ID"] = $arTmp;
1861 }
1862 else
1863 {
1864 $arFilter["CATALOG_GROUP_ID"] = $arPriceGroups["view"];
1865 }
1866
1868 if ($arVatInfo = $dbRes->Fetch())
1869 {
1870 $fVatRate = floatval($arVatInfo['RATE'] * 0.01);
1871 $bVatIncluded = $arVatInfo['VAT_INCLUDED'] == 'Y';
1872 }
1873 else
1874 {
1875 $fVatRate = 0.00;
1876 $bVatIncluded = false;
1877 }
1878
1879 $rsProducts = CCatalogProduct::GetList(
1880 array(),
1881 array('ID' => $ID),
1882 false,
1883 false,
1884 array(
1885 'ID',
1886 'CAN_BUY_ZERO',
1887 'QUANTITY_TRACE',
1888 'QUANTITY'
1889 )
1890 );
1891 if ($arProduct = $rsProducts->Fetch())
1892 {
1893 $intIBlockID = CIBlockElement::GetIBlockByID($arProduct['ID']);
1894 if (!$intIBlockID)
1895 return false;
1896 $arProduct['IBLOCK_ID'] = $intIBlockID;
1897 }
1898 else
1899 {
1900 return false;
1901 }
1902
1903 $dbPrice = CPrice::GetListEx(
1904 array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC"),
1905 $arFilter,
1906 false,
1907 false,
1908 array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO")
1909 );
1910
1911 while ($arPrice = $dbPrice->Fetch())
1912 {
1913 if ($VAT_INCLUDE == 'N')
1914 {
1915 if ($bVatIncluded)
1916 $arPrice['PRICE'] /= (1 + $fVatRate);
1917 }
1918 else
1919 {
1920 if (!$bVatIncluded)
1921 $arPrice['PRICE'] *= (1 + $fVatRate);
1922 }
1923 $arPrice['CATALOG_GROUP_ID'] = (int)$arPrice['CATALOG_GROUP_ID'];
1924
1925 $arPrice['VAT_RATE'] = $fVatRate;
1926
1928 $arDiscounts = CCatalogDiscount::GetDiscount($ID, $arProduct["IBLOCK_ID"], array($arPrice["CATALOG_GROUP_ID"]), $arUserGroups, "N", SITE_ID, array());
1930
1931 $discountPrice = CCatalogProduct::CountPriceWithDiscount($arPrice["PRICE"], $arPrice["CURRENCY"], $arDiscounts);
1932 $arPrice["DISCOUNT_PRICE"] = $discountPrice;
1933
1934 $arPrice["QUANTITY_FROM"] = doubleval($arPrice["QUANTITY_FROM"]);
1935 if ($currentQuantity != $arPrice["QUANTITY_FROM"])
1936 {
1937 $rowsCnt++;
1938 $arResult["ROWS"][$rowsCnt]["QUANTITY_FROM"] = $arPrice["QUANTITY_FROM"];
1939 $arResult["ROWS"][$rowsCnt]["QUANTITY_TO"] = doubleval($arPrice["QUANTITY_TO"]);
1940 $currentQuantity = $arPrice["QUANTITY_FROM"];
1941 }
1942
1943 if ($boolConvert && $strCurrencyID != $arPrice["CURRENCY"])
1944 {
1945 $price = CCurrencyRates::ConvertCurrency($arPrice["PRICE"], $arPrice["CURRENCY"], $strCurrencyID);
1946 $unroundDiscountPrice = CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT_PRICE"], $arPrice["CURRENCY"], $strCurrencyID);
1947 $discountPrice = Catalog\Product\Price::roundPrice(
1948 $arPrice["CATALOG_GROUP_ID"],
1949 $unroundDiscountPrice,
1950 $strCurrencyID
1951 );
1952 if ($discountPrice > $price)
1953 $price = $discountPrice;
1954 $arResult["MATRIX"][$arPrice["CATALOG_GROUP_ID"]][$rowsCnt] = array(
1955 "ID" => $arPrice["ID"],
1956 "ORIG_PRICE" => $arPrice["PRICE"],
1957 "ORIG_DISCOUNT_PRICE" => $arPrice["DISCOUNT_PRICE"],
1958 "ORIG_CURRENCY" => $arPrice["CURRENCY"],
1959 "ORIG_VAT_RATE" => $arPrice["VAT_RATE"],
1960 'PRICE' => $price,
1961 'DISCOUNT_PRICE' => $discountPrice,
1962 'UNROUND_DISCOUNT_PRICE' => $unroundDiscountPrice,
1963 'CURRENCY' => $strCurrencyID,
1964 'VAT_RATE' => $arPrice["VAT_RATE"],
1965 );
1966 $arCurrencyList[$arPrice['CURRENCY']] = $arPrice['CURRENCY'];
1967 }
1968 else
1969 {
1970 $arPrice['UNROUND_DISCOUNT_PRICE'] = $arPrice['DISCOUNT_PRICE'];
1971 $arPrice['DISCOUNT_PRICE'] = Catalog\Product\Price::roundPrice(
1972 $arPrice["CATALOG_GROUP_ID"],
1973 $arPrice['DISCOUNT_PRICE'],
1974 $arPrice["CURRENCY"]
1975 );
1976 if ($arPrice["DISCOUNT_PRICE"] > $arPrice["PRICE"])
1977 $arPrice["PRICE"] = $arPrice["DISCOUNT_PRICE"];
1978 $arResult["MATRIX"][$arPrice["CATALOG_GROUP_ID"]][$rowsCnt] = array(
1979 "ID" => $arPrice["ID"],
1980 "PRICE" => $arPrice["PRICE"],
1981 "DISCOUNT_PRICE" => $arPrice["DISCOUNT_PRICE"],
1982 "UNROUND_DISCOUNT_PRICE" => $arPrice['UNROUND_DISCOUNT_PRICE'],
1983 "CURRENCY" => $arPrice["CURRENCY"],
1984 "VAT_RATE" => $arPrice["VAT_RATE"]
1985 );
1986 }
1987 }
1988
1989 $arCatalogGroups = CCatalogGroup::GetListArray();
1990 foreach ($arCatalogGroups as $key => $value)
1991 {
1992 if (isset($arResult["MATRIX"][$key]))
1993 $arResult["COLS"][$value["ID"]] = $value;
1994 }
1995
1996 $arResult["CAN_BUY"] = $arPriceGroups["buy"];
1997 $arResult["AVAILABLE"] = (0 >= $arProduct['QUANTITY'] && 'Y' == $arProduct['QUANTITY_TRACE'] && 'N' == $arProduct['CAN_BUY_ZERO'] ? 'N' : 'Y');
1998
1999 if ($boolConvert)
2000 {
2001 if (!empty($arCurrencyList))
2002 $arCurrencyList[$strCurrencyID] = $strCurrencyID;
2003 $arResult['CURRENCY_LIST'] = $arCurrencyList;
2004 }
2005
2006 return $arResult;
2007}
2008
2010{
2011 global $USER;
2012
2013 $ID = (int)$ID;
2014 if ($ID <= 0)
2015 return false;
2016
2017 $arResult = array();
2018
2019 $arPriceGroups = array();
2020 $cacheKey = LANGUAGE_ID."_".($USER->GetGroups());
2021 if (isset($GLOBALS["CATALOG_PRICE_GROUPS_CACHE"])
2022 && is_array($GLOBALS["CATALOG_PRICE_GROUPS_CACHE"])
2023 && isset($GLOBALS["CATALOG_PRICE_GROUPS_CACHE"][$cacheKey])
2024 && is_array($GLOBALS["CATALOG_PRICE_GROUPS_CACHE"][$cacheKey]))
2025 {
2026 $arPriceGroups = $GLOBALS["CATALOG_PRICE_GROUPS_CACHE"][$cacheKey];
2027 }
2028 else
2029 {
2030 $dbPriceGroupsList = CCatalogGroup::GetList(
2031 array("SORT" => "ASC"),
2032 array(
2033 "CAN_ACCESS" => "Y",
2034 "LID" => LANGUAGE_ID
2035 ),
2036 array("ID", "NAME_LANG", "SORT"),
2037 false,
2038 array("ID", "NAME_LANG", "CAN_BUY", "SORT")
2039 );
2040 while ($arPriceGroupsList = $dbPriceGroupsList->Fetch())
2041 {
2042 $arPriceGroups[] = $arPriceGroupsList;
2043 $GLOBALS["CATALOG_PRICE_GROUPS_CACHE"][$cacheKey][] = $arPriceGroupsList;
2044 }
2045 }
2046
2047 if (empty($arPriceGroups))
2048 return false;
2049
2050 $arBorderMap = array();
2051 $bMultiQuantity = False;
2052
2053 $dbPrice = CPrice::GetList(
2054 array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC", "SORT" => "ASC"),
2055 array("PRODUCT_ID" => $ID),
2056 false,
2057 false,
2058 array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO", "ELEMENT_IBLOCK_ID", "SORT")
2059 );
2060 while ($arPrice = $dbPrice->Fetch())
2061 {
2063 $arDiscounts = CCatalogDiscount::GetDiscount($ID, $arPrice["ELEMENT_IBLOCK_ID"], array($arPrice["CATALOG_GROUP_ID"]), $USER->GetUserGroupArray(), "N", SITE_ID, array());
2065
2066 $discountPrice = CCatalogProduct::CountPriceWithDiscount($arPrice["PRICE"], $arPrice["CURRENCY"], $arDiscounts);
2067 $arPrice["DISCOUNT_PRICE"] = $discountPrice;
2068
2069 if (array_key_exists($arPrice["QUANTITY_FROM"]."-".$arPrice["QUANTITY_TO"], $arBorderMap))
2070 $jnd = $arBorderMap[$arPrice["QUANTITY_FROM"]."-".$arPrice["QUANTITY_TO"]];
2071 else
2072 {
2073 $jnd = count($arBorderMap);
2074 $arBorderMap[$arPrice["QUANTITY_FROM"]."-".$arPrice["QUANTITY_TO"]] = $jnd;
2075 }
2076
2077 $arResult[$jnd]["QUANTITY_FROM"] = (float)$arPrice["QUANTITY_FROM"];
2078 $arResult[$jnd]["QUANTITY_TO"] = (float)$arPrice["QUANTITY_TO"];
2079 if ((float)$arPrice["QUANTITY_FROM"] > 0 || (float)$arPrice["QUANTITY_TO"] > 0)
2080 $bMultiQuantity = true;
2081
2082 $arResult[$jnd]["PRICE"][$arPrice["CATALOG_GROUP_ID"]] = $arPrice;
2083 }
2084
2085 $numGroups = count($arPriceGroups);
2086 for ($i = 0; $i < $numGroups; $i++)
2087 {
2088 $bNeedKill = true;
2089 for ($j = 0, $intCount = count($arResult); $j < $intCount; $j++)
2090 {
2091 if (!array_key_exists($arPriceGroups[$i]["ID"], $arResult[$j]["PRICE"]))
2092 $arResult[$j]["PRICE"][$arPriceGroups[$i]["ID"]] = False;
2093
2094 if ($arResult[$j]["PRICE"][$arPriceGroups[$i]["ID"]] != false)
2095 $bNeedKill = False;
2096 }
2097
2098 if ($bNeedKill)
2099 {
2100 for ($j = 0, $intCount = count($arResult); $j < $intCount; $j++)
2101 unset($arResult[$j]["PRICE"][$arPriceGroups[$i]["ID"]]);
2102
2103 unset($arPriceGroups[$i]);
2104 }
2105 }
2106
2107 return array(
2108 "COLS" => $arPriceGroups,
2109 "MATRIX" => $arResult,
2110 "MULTI_QUANTITY" => ($bMultiQuantity ? "Y" : "N")
2111 );
2112}
2113
2115{
2116 list($usec, $sec) = explode(" ", microtime());
2117 return ((float)$usec + (float)$sec);
2118}
2119
2120function __CatalogSetTimeMark($text, $startStop = "")
2121{
2122 global $__catalogTimeMarkTo, $__catalogTimeMarkFrom, $__catalogTimeMarkGlobalFrom;
2123
2124 if (mb_strtoupper($startStop) == "START")
2125 {
2126 $hFile = fopen($_SERVER["DOCUMENT_ROOT"]."/__catalog_debug.txt", "a");
2127 fwrite($hFile, date("H:i:s")." - ".$text."\n");
2128 fclose($hFile);
2129
2130 $__catalogTimeMarkGlobalFrom = __CatalogGetMicroTime();
2131 $__catalogTimeMarkFrom = __CatalogGetMicroTime();
2132 }
2133 elseif (mb_strtoupper($startStop) == "STOP")
2134 {
2135 $__catalogTimeMarkTo = __CatalogGetMicroTime();
2136
2137 $hFile = fopen($_SERVER["DOCUMENT_ROOT"]."/__catalog_debug.txt", "a");
2138 fwrite($hFile, date("H:i:s")." - ".round($__catalogTimeMarkTo - $__catalogTimeMarkFrom, 3)." s - ".$text."\n");
2139 fwrite($hFile, date("H:i:s")." - ".round($__catalogTimeMarkTo - $__catalogTimeMarkGlobalFrom, 3)." s\n\n");
2140 fclose($hFile);
2141 }
2142 else
2143 {
2144 $__catalogTimeMarkTo = __CatalogGetMicroTime();
2145
2146 $hFile = fopen($_SERVER["DOCUMENT_ROOT"]."/__catalog_debug.txt", "a");
2147 fwrite($hFile, date("H:i:s")." - ".round($__catalogTimeMarkTo - $__catalogTimeMarkFrom, 3)." s - ".$text."\n");
2148 fclose($hFile);
2149
2150 $__catalogTimeMarkFrom = __CatalogGetMicroTime();
2151 }
2152}
2153
2154function CatalogGetVATArray($arFilter = array(), $bInsertEmptyLine = false)
2155{
2156 $bInsertEmptyLine = ($bInsertEmptyLine === true);
2157
2158 if (!is_array($arFilter))
2159 $arFilter = array();
2160
2161 $arFilter['ACTIVE'] = 'Y';
2162 $dbResult = CCatalogVat::GetListEx(array(), $arFilter, false, false, array('ID', 'NAME'));
2163
2164 if ($bInsertEmptyLine)
2165 $arList = array('REFERENCE' => array(0 => Loc::getMessage('CAT_VAT_REF_NOT_SELECTED')), 'REFERENCE_ID' => array(0 => ''));
2166 else
2167 $arList = array('REFERENCE' => array(), 'REFERENCE_ID' => array());
2168
2169 $bEmpty = true;
2170 while ($arRes = $dbResult->Fetch())
2171 {
2172 $bEmpty = false;
2173 $arList['REFERENCE'][] = $arRes['NAME'];
2174 $arList['REFERENCE_ID'][] = $arRes['ID'];
2175 }
2176
2177 if ($bEmpty && !$bInsertEmptyLine)
2178 return false;
2179 else
2180 return $arList;
2181}
2182
2184{
2185 global $APPLICATION;
2186 $APPLICATION->ThrowException(Loc::getMessage("CAT_INCLUDE_CURRENCY"), "CAT_DEPENDS_CURRENCY");
2187 return false;
2188}
2189
2191{
2192 foreach (GetModuleEvents("catalog", "OnGenerateCoupon", true) as $arEvent)
2193 {
2194 return ExecuteModuleEventEx($arEvent);
2195 }
2196
2197 $allchars = 'ABCDEFGHIJKLNMOPQRSTUVWXYZ0123456789';
2198 $charsLen = mb_strlen($allchars) - 1;
2199 $string1 = '';
2200 $string2 = '';
2201 for ($i = 0; $i < 5; $i++)
2202 $string1 .= mb_substr($allchars, rand(0, $charsLen), 1);
2203
2204 for ($i = 0; $i < 7; $i++)
2205 $string2 .= mb_substr($allchars, rand(0, $charsLen), 1);
2206
2207 return 'CP-'.$string1.'-'.$string2;
2208}
2209
2210function __GetCatLangMessages($strBefore, $strAfter, $MessID, $strDefMess = false, $arLangList = array())
2211{
2212 $arResult = false;
2213
2214 if (empty($MessID))
2215 return $arResult;
2216 if (!is_array($MessID))
2217 $MessID = array($MessID);
2218 if (!is_array($arLangList))
2219 $arLangList = array($arLangList);
2220
2221 if (empty($arLangList))
2222 {
2223 $rsLangs = CLanguage::GetList("lid", "asc", array("ACTIVE" => "Y"));
2224 while ($arLang = $rsLangs->Fetch())
2225 {
2226 $arLangList[] = $arLang['LID'];
2227 }
2228 }
2229 foreach ($arLangList as &$strLID)
2230 {
2231 $arMess = IncludeModuleLangFile(str_replace('//', '/', $strBefore.$strAfter), $strLID, true);
2232 if (!empty($arMess))
2233 {
2234 foreach ($MessID as &$strMessID)
2235 {
2236 if (empty($strMessID))
2237 continue;
2238 $arResult[$strMessID][$strLID] = $arMess[$strMessID] ?? $strDefMess;
2239 }
2240 if (isset($strMessID))
2241 unset($strMessID);
2242 }
2243 }
2244 if (isset($strLID))
2245 unset($strLID);
2246 return $arResult;
2247}
2248
2257function CatalogClearArray(&$arMap, $boolSort = true)
2258{
2260}
$arParams
Определения access_dialog.php:21
$db_res
Определения options_user_settings.php:8
CatalogGetVATArray($arFilter=array(), $bInsertEmptyLine=false)
Определения include.php:2154
const CATALOG_PATH2EXPORTS_DEF
Определения include.php:13
const CATALOG_VALUE_PRECISION
Определения include.php:109
CatalogGenerateCoupon()
Определения include.php:2190
const YANDEX_SKU_EXPORT_PROP
Определения include.php:21
const CATALOG_PATH2EXPORTS
Определения include.php:12
CatalogViewedProductCallback($productID, $UserID, $strSiteID=SITE_ID)
Определения include.php:370
const CATALOG_DISCOUNT_OLD_VERSION
Определения include.php:44
const CATALOG_CONTAINER_PATH
Определения include.php:10
CurrencyModuleUnInstallCatalog()
Определения include.php:2183
FormatCurrency($fSum, $strCurrency)
Определения include.php:301
CatalogGetPriceTable($ID)
Определения include.php:2009
const CATALOG_VALUE_EPSILON
Определения include.php:108
const YANDEX_SKU_TEMPLATE_OFFERS
Определения include.php:23
CatalogBasketCallback($productID, $quantity=0, $renewal="N", $intUserID=0, $strSiteID=false)
Определения include.php:317
const EXPORT_VERSION_OLD
Определения include.php:26
GetCatalogProductEx($PRODUCT_ID, $boolAllValues=false)
Определения include.php:221
const CATALOG_CACHE_DEFAULT_TIME
Определения include.php:110
const YANDEX_SKU_TEMPLATE_CUSTOM
Определения include.php:24
if(!Loader::includeModule( 'iblock')) if(!Loader::includeModule('currency')) $arTreeDescr
Определения include.php:96
CatalogDeactivateOneTimeCoupons($intOrderID=0)
Определения include.php:561
GetCatalogProductTable($IBLOCK, $SECT_ID=false, $arOrder=array("sort"=>"asc"), $cnt=0)
Определения include.php:288
CatalogPayOrderCallback($productID, $userID, $bPaid, $orderID)
Определения include.php:566
const CONTRACTOR_INDIVIDUAL
Определения include.php:54
const DOC_DEDUCT
Определения include.php:71
if(defined( 'CATALOG_GLOBAL_VARS') &&CATALOG_GLOBAL_VARS=='Y') GetCatalogGroups($by="SORT", $order="ASC")
Определения include.php:170
__GetCatLangMessages($strBefore, $strAfter, $MessID, $strDefMess=false, $arLangList=array())
Определения include.php:2210
const EXPORT_VERSION_NEW
Определения include.php:27
const YANDEX_SKU_EXPORT_ALL
Определения include.php:19
GetCatalogProduct($PRODUCT_ID)
Определения include.php:208
__CatalogGetMicroTime()
Определения include.php:2114
const CATALOG_DISCOUNT_NEW_VERSION
Определения include.php:49
const CATALOG_PATH2IMPORTS
Определения include.php:16
const CATALOG_PAGE_SIZE
Определения include.php:111
global $APPLICATION
Определения include.php:80
CatalogBasketOrderCallback($productID, $quantity, $renewal="N", $intUserID=0, $strSiteID=false)
Определения include.php:343
const DOC_RETURNS
Определения include.php:67
const BX_CATALOG_FILENAME_REG
Определения include.php:51
const DOC_INVENTORY
Определения include.php:75
Add2Basket($PRICE_ID, $QUANTITY=1, $arRewriteFields=array(), $arProductParams=array())
Определения include.php:1106
GetCatalogGroupName($CATALOG_GROUP_ID)
Определения include.php:194
CatalogBasketCancelCallback($PRODUCT_ID, $QUANTITY, $bCancel)
Определения include.php:1082
CatalogGetPriceTableEx($ID, $filterQauntity=0, $arFilterType=array(), $VAT_INCLUDE='Y', $arCurrencyParams=array())
Определения include.php:1789
const DOC_MOVING
Определения include.php:63
const YANDEX_SKU_EXPORT_MIN_PRICE
Определения include.php:20
SubscribeProduct($intProductID, $arRewriteFields=array(), $arProductParams=array())
Определения include.php:1539
CatalogRecurringCallback($productID, $userID)
Определения include.php:849
const DOC_ARRIVAL
Определения include.php:59
CatalogClearArray(&$arMap, $boolSort=true)
Определения include.php:2257
GetCatalogProductPrice($PRODUCT_ID, $CATALOG_GROUP_ID)
Определения include.php:234
GetCatalogProductPriceList($PRODUCT_ID, $by="SORT", $order="ASC")
Определения include.php:258
const YANDEX_SKU_TEMPLATE_PRODUCT
Определения include.php:22
const DISCOUNT_TYPE_SAVE
Определения include.php:38
const CATALOG_DEFAULT_EXPORT_PATH
Определения include.php:14
const CATALOG_PATH2IMPORTS_DEF
Определения include.php:17
__CatalogSetTimeMark($text, $startStop="")
Определения include.php:2120
GetCatalogGroup($CATALOG_GROUP_ID)
Определения include.php:182
const CONTRACTOR_JURIDICAL
Определения include.php:55
const DISCOUNT_TYPE_STANDART
Определения include.php:33
$arResult
Определения generate_coupon.php:16
Определения loader.php:13
static normalizeArrayValuesByInt(&$map, $sorted=true)
Определения collection.php:150
static getInstance($type)
Определения registry.php:183
const TYPE_PERCENT
Определения discount.php:18
const TYPE_SALE
Определения discount.php:20
const TYPE_FIX
Определения discount.php:19
static ClearDiscountUserID()
Определения discount_save.php:55
static Disable()
Определения discount_save.php:38
static SetDiscountUserID($intUserID)
Определения discount_save.php:48
static Enable()
Определения discount_save.php:33
static GetListArray()
Определения cataloggroup.php:291
static GetGroupsPerms($arUserGroups=array(), $arCatalogGroupsFilter=array())
Определения cataloggroup.php:167
static GetByID($ID, $lang=LANGUAGE_ID)
Определения cataloggroup.php:327
static GetByID($ID)
Определения catalog.php:281
static IsUserExists()
Определения catalog.php:1812
static GetByIDEx($ID, $boolAllValues=false)
Определения product.php:659
const TIME_PERIOD_SEMIYEAR
Определения product.php:59
static GetNearestQuantityPrice($productID, $quantity=1, $arUserGroups=array())
Определения product.php:851
static GetByID($ID)
Определения product.php:625
const TYPE_SET
Определения product.php:18
const TIME_PERIOD_DOUBLE_YEAR
Определения product.php:67
const TIME_PERIOD_HOUR
Определения product.php:39
const TIME_PERIOD_WEEK
Определения product.php:47
const TIME_PERIOD_YEAR
Определения product.php:63
const TIME_PERIOD_DAY
Определения product.php:43
static GetOptimalPrice($intProductID, $quantity=1, $arUserGroups=array(), $renewal="N", $priceList=array(), $siteID=false, $arDiscountCoupons=false)
Определения product.php:973
const TIME_PERIOD_QUART
Определения product.php:55
const TIME_PERIOD_MONTH
Определения product.php:51
static QuantityTracer($ProductID, $DeltaQuantity)
Определения product.php:784
static CountPriceWithDiscount($price, $currency, $discounts)
Определения product.php:1863
static GetTimePeriodTypes($boolFull=false)
Определения product.php:2094
static ConvertCurrency($valSum, $curFrom, $curTo, $valDate="")
Определения currency_rate.php:393
static GetList($by="sort", $order="asc", $arFilter=[])
Определения language.php:12
const FIELDS_PRICE
Определения csv_settings.php:9
static getDefaultSettings($type, $extFormat=false)
Определения csv_settings.php:335
const FIELDS_CURRENCY
Определения csv_settings.php:12
static getSettingsFields($type, $extFormat=false)
Определения csv_settings.php:14
const FIELDS_PRICE_EXT
Определения csv_settings.php:10
const FIELDS_ELEMENT
Определения csv_settings.php:7
const FIELDS_CATALOG
Определения csv_settings.php:8
const FIELDS_SECTION
Определения csv_settings.php:11
static CouponOneOrderDisable($intOrderID=0)
Определения discount_coupon.php:452
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения cataloggroup.php:218
static GetListEx($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения cataloggroup.php:360
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения product_group.php:30
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения product.php:23
static GetVATInfo($PRODUCT_ID)
Определения product.php:185
static GetProductData($arParams)
Определения product_provider.php:59
static OrderProduct($arParams)
Определения product_provider.php:530
const TYPE_SET
Определения product_set.php:9
static getAllSetsByProduct($intProductID, $intSetType)
Определения product_set.php:341
static GetListEx($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения vat.php:7
static RegisterExt($name, $arPaths)
Определения jscore.php:28
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения price.php:20
static GetListEx($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения price.php:178
static GetLangCurrency($siteId)
Определения settings.php:52
$arFields
Определения dblapprove.php:5
$data['IS_AVAILABLE']
Определения .description.php:13
$orderId
Определения payment.php:5
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
if($ajaxMode) $ID
Определения get_user.php:27
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $arCatalogAvailPriceFields
Определения cron_frame.php:84
global $defCatalogAvailValueFields
Определения cron_frame.php:97
global $arCatalogAvailQuantityFields
Определения cron_frame.php:88
global $defCatalogAvailProdFields
Определения cron_frame.php:93
global $DB
Определения cron_frame.php:29
global $defCatalogAvailQuantityFields
Определения cron_frame.php:99
global $arCatalogAvailProdFields
Определения cron_frame.php:82
global $defCatalogAvailCurrencies
Определения cron_frame.php:103
global $arCatalogAvailGroupFields
Определения cron_frame.php:90
global $arCatalogAvailValueFields
Определения cron_frame.php:86
global $defCatalogAvailPriceFields
Определения cron_frame.php:95
global $defCatalogAvailGroupFields
Определения cron_frame.php:101
global $USER
Определения csv_new_run.php:40
$siteId
Определения ajax.php:8
ExecuteModuleEventEx($arEvent, $arParams=[])
Определения tools.php:5214
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
Определения tools.php:5177
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
Определения basket.php:2
$order
Определения payment.php:8
if(intval($iTestTransaction) > 0) $arTmp
Определения payment.php:22
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
$text
Определения template_pdf.php:79
$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
if( $arBasket=$dbBasket->Fetch()) if($vat > 0) $rowsCnt
Определения html.php:430
$orderID
Определения result.php:9
$arRes
Определения options.php:104
const SITE_ID
Определения sonet_set_content_view.php:12
$GLOBALS['_____370096793']
Определения update_client.php:1
$dbResult
Определения updtr957.php:3
$arFilter
Определения user_search.php:106
if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_CATALOG_EXPORT_EDIT)) if((!isset($_REQUEST['IBLOCK_ID']))||($_REQUEST['IBLOCK_ID']=='')) $intIBlockID
Определения yandex_detail.php:44
$dbRes
Определения yandex_detail.php:168
$iterator
Определения yandex_run.php:610
$arCatalog
Определения yandex_run.php:674