1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
elementsku.php
См. документацию.
1
<?php
7
namespace
Bitrix\Iblock\Template\Entity;
8
9
class
ElementSku
extends
Base
10
{
11
protected
$elementFields
=
null
;
12
protected
$skuIblockId
=
null
;
13
protected
$skuList
=
null
;
14
protected
$property
=
null
;
15
protected
$price
=
null
;
19
public
function
__construct
($id)
20
{
21
parent::__construct($id);
22
$this->fieldMap =
array
(
23
"name"
=>
"NAME"
,
24
"previewtext"
=>
"PREVIEW_TEXT"
,
25
"detailtext"
=>
"DETAIL_TEXT"
,
26
"code"
=>
"CODE"
,
27
//not accessible from template engine
28
"ID"
=>
"ID"
,
29
"IBLOCK_ID"
=>
"IBLOCK_ID"
,
30
"IBLOCK_SECTION_ID"
=>
"IBLOCK_SECTION_ID"
,
31
);
32
}
33
41
public
function
resolve
(
$entity
)
42
{
43
if
(
$entity
===
"property"
)
44
{
45
if
(!$this->property && $this->
loadFromDatabase
())
46
{
47
if
($this->skuIblockId && $this->skuList)
48
{
49
$this->
property
=
ElementSkuProperty::getInstance
($this->fields[
"ID"
]);
50
$this->
property
->setIblockId($this->skuIblockId);
51
}
52
}
53
54
if
($this->property)
55
return
$this->property
;
56
}
57
elseif
(
$entity
===
"price"
)
58
{
59
if
(!$this->price && $this->
loadFromDatabase
())
60
{
61
if
($this->skuIblockId && $this->skuList)
62
{
63
$this->price =
ElementSkuPrice::getInstance
($this->fields[
"ID"
]);
64
}
65
}
66
67
if
($this->price)
68
return
$this->price
;
69
}
70
return
parent::resolve(
$entity
);
71
}
72
79
public
function
loadFromDatabase
()
80
{
81
if
(!isset($this->fields))
82
{
83
$this->fields =
array
();
84
$select
= array_values($this->fieldMap);
85
86
$elementList =
\Bitrix\Iblock\ElementTable::getList
(
array
(
87
"select"
=>
$select
,
88
"filter"
=>
array
(
"=ID"
=> $this->
id
),
89
));
90
$this->elementFields = $elementList->fetch();
91
if
($this->elementFields)
92
{
93
$catalog
= \CCatalogSKU::getInfoByProductIBlock($this->elementFields[
"IBLOCK_ID"
]);
94
if
(!empty(
$catalog
))
95
{
96
$this->skuIblockId =
$catalog
[
"IBLOCK_ID"
];
97
$skuList
= \CIBlockElement::getList(
array
(),
array
(
98
"IBLOCK_ID"
=>
$catalog
[
"IBLOCK_ID"
],
99
"=PROPERTY_"
.
$catalog
[
"SKU_PROPERTY_ID"
] => $this->
id
,
100
),
false
,
false
,
$select
);
101
while
($sku =
$skuList
->fetch())
102
{
103
$this->skuList[] = $sku;
104
foreach
($sku as $fieldName => $fieldValue)
105
{
106
$this->fields[$fieldName][] = $fieldValue;
107
}
108
}
109
}
110
}
111
}
112
113
return
is_array($this->fields);
114
}
115
}
Bitrix\Iblock\Template\Entity\ElementSku
Определения
elementsku.php:10
Bitrix\Iblock\Template\Entity\ElementSku\$elementFields
$elementFields
Определения
elementsku.php:11
Bitrix\Iblock\Template\Entity\ElementSku\__construct
__construct($id)
Определения
elementsku.php:19
Bitrix\Iblock\Template\Entity\ElementSku\loadFromDatabase
loadFromDatabase()
Определения
elementsku.php:79
Bitrix\Iblock\Template\Entity\ElementSku\$price
$price
Определения
elementsku.php:15
Bitrix\Iblock\Template\Entity\ElementSku\resolve
resolve($entity)
Определения
elementsku.php:41
Bitrix\Iblock\Template\Entity\ElementSku\$skuList
$skuList
Определения
elementsku.php:13
Bitrix\Iblock\Template\Entity\ElementSku\$skuIblockId
$skuIblockId
Определения
elementsku.php:12
Bitrix\Iblock\Template\Entity\ElementSku\$property
$property
Определения
elementsku.php:14
Bitrix\Iblock\Template\Entity\ElementSkuPrice\getInstance
static getInstance($id)
Определения
elementskuprice.php:16
Bitrix\Iblock\Template\Entity\ElementSkuProperty\getInstance
static getInstance($id)
Определения
elementskuproperty.php:18
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$entity
$entity
Определения
group_bizproc_workflow_delete.php:17
$catalog
$catalog
Определения
iblock_catalog_edit.php:135
$select
$select
Определения
iblock_catalog_list.php:194
Bitrix\Sale\Services\Base
Определения
concreteproductrestriction.php:3
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
iblock
lib
template
entity
elementsku.php
Создано системой
1.14.0