1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
product.php
См. документацию.
1
<?php
2
3
4
namespace
Bitrix\Sale\Rest\Synchronization\Loader;
5
6
use Bitrix\Main\ArgumentException;
7
use Bitrix\Main\Entity\DataManager;
8
use Bitrix\Main\Loader;
9
use Bitrix\Sale\Registry;
10
11
class
Product
extends
Entity
12
{
13
public
function
getFieldsByExternalId
(
$code
)
14
{
15
$result
=
array
();
16
17
Loader::includeModule(
'iblock'
);
18
Loader::includeModule(
'catalog'
);
19
20
$iblockIds = [];
21
$row =
\Bitrix\Catalog\CatalogIblockTable::getList
([
22
'select'
=> [
'IBLOCK_ID'
],
23
'filter'
=> [
'=IBLOCK.ACTIVE'
=>
'Y'
]
24
]);
25
while
(
$res
= $row->fetch())
26
$iblockIds[] =
$res
[
'IBLOCK_ID'
];
27
28
//TODO: необходимо переделать на вызов метода каталога, который на вход полчучает произвольный product_xml_id и возвращает продукт каталога.
29
if
(empty($iblockIds))
30
{
31
// nothing here
32
}
33
else
34
{
35
$r = \CIBlockElement::GetList(
array
(),
36
array
(
"=XML_ID"
=>
$code
,
"ACTIVE"
=>
"Y"
,
"CHECK_PERMISSIONS"
=>
"Y"
,
"IBLOCK_ID"
=>$iblockIds),
37
false
,
38
false
,
39
array
(
"ID"
,
"IBLOCK_ID"
,
"XML_ID"
,
"NAME"
,
"DETAIL_PAGE_URL"
)
40
);
41
if
(
$ar
= $r->GetNext())
42
{
43
$result
=
$ar
;
44
$product =
\CCatalogProduct::GetByID
(
$ar
[
"ID"
]);
45
46
$result
[
"WEIGHT"
] = $product[
"WEIGHT"
];
47
$result
[
"CATALOG_GROUP_NAME"
] = $product[
"CATALOG_GROUP_NAME"
];
48
49
$productIBlock = static::getIBlockProduct(
$ar
[
"IBLOCK_ID"
]);
50
$result
[
"IBLOCK_XML_ID"
] = $productIBlock[
$ar
[
"IBLOCK_ID"
]][
"XML_ID"
];
51
}
52
}
53
54
return
$result
;
55
}
56
57
public
function
getCodeAfterDelimiter
(
$code
)
58
{
59
$result
=
''
;
60
61
if
(mb_strpos(
$code
,
'#'
) !==
false
)
62
{
63
$code
= explode(
'#'
,
$code
);
64
$result
=
$code
[1];
65
}
66
return
$result
;
67
}
68
69
private
static
function
getIBlockProduct(
$iblockId
)
70
{
71
static
$iblock_fields =
null
;
72
73
if
($iblock_fields[
$iblockId
] ==
null
)
74
{
75
$r = \CIBlock::GetList(
array
(),
array
(
"ID"
=>
$iblockId
));
76
if
(
$ar
= $r->Fetch())
77
$iblock_fields[
$iblockId
] =
$ar
;
78
}
79
return
$iblock_fields;
80
}
81
}
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
Bitrix\Sale\Rest\Synchronization\Loader\Entity
Определения
entity.php:11
Bitrix\Sale\Rest\Synchronization\Loader\Product
Определения
product.php:12
Bitrix\Sale\Rest\Synchronization\Loader\Product\getFieldsByExternalId
getFieldsByExternalId($code)
Определения
product.php:13
Bitrix\Sale\Rest\Synchronization\Loader\Product\getCodeAfterDelimiter
getCodeAfterDelimiter($code)
Определения
product.php:57
CAllCatalogProduct\GetByID
static GetByID($ID)
Определения
product.php:625
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$res
$res
Определения
filter_act.php:7
$result
$result
Определения
get_property_values.php:14
$iblockId
$iblockId
Определения
iblock_catalog_edit.php:30
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
$ar
$ar
Определения
options.php:199
bitrix
modules
sale
lib
rest
synchronization
loader
product.php
Создано системой
1.14.0