1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
price.php
См. документацию.
1
<?php
2
namespace
Bitrix\Catalog;
3
4
use Bitrix\Main,
5
Bitrix\Main\Localization\Loc;
6
Loc::loadMessages(__FILE__);
7
41
42
class
PriceTable
extends
Main\ORM\Data\DataManager
43
{
49
public
static
function
getTableName
()
50
{
51
return
'b_catalog_price'
;
52
}
53
59
public
static
function
getMap
()
60
{
61
return
array
(
62
'ID'
=>
new
Main
\
Entity
\
IntegerField
(
'ID'
,
array
(
63
'primary'
=>
true
,
64
'autocomplete'
=>
true
,
65
'title'
=> Loc::getMessage(
'PRICE_ENTITY_ID_FIELD'
)
66
)),
67
'PRODUCT_ID'
=>
new
Main
\
Entity
\
IntegerField
(
'PRODUCT_ID'
,
array
(
68
'required'
=>
true
,
69
'title'
=> Loc::getMessage(
'PRICE_ENTITY_PRODUCT_ID_FIELD'
)
70
)),
71
'EXTRA_ID'
=>
new
Main
\
Entity
\
IntegerField
(
'EXTRA_ID'
,
array
(
72
'title'
=> Loc::getMessage(
'PRICE_ENTITY_EXTRA_ID_FIELD'
)
73
)),
74
'CATALOG_GROUP_ID'
=>
new
Main
\
Entity
\
IntegerField
(
'CATALOG_GROUP_ID'
,
array
(
75
'required'
=>
true
,
76
'title'
=> Loc::getMessage(
'PRICE_ENTITY_CATALOG_GROUP_ID_FIELD'
)
77
)),
78
'PRICE'
=>
new
Main
\
Entity
\
FloatField
(
'PRICE'
,
array
(
79
'required'
=>
true
,
80
'title'
=> Loc::getMessage(
'PRICE_ENTITY_PRICE_FIELD'
)
81
)),
82
'CURRENCY'
=>
new
Main
\
Entity
\
StringField
(
'CURRENCY'
,
array
(
83
'required'
=>
true
,
84
'validation'
=>
array
(__CLASS__,
'validateCurrency'
),
85
'title'
=> Loc::getMessage(
'PRICE_ENTITY_CURRENCY_FIELD'
)
86
)),
87
'TIMESTAMP_X'
=>
new
Main
\
Entity
\
DatetimeField
(
'TIMESTAMP_X'
,
array
(
88
'default_value'
=>
function
(){
return
new
Main\Type\DateTime
(); },
89
'title'
=> Loc::getMessage(
'PRICE_ENTITY_TIMESTAMP_X_FIELD'
)
90
)),
91
'QUANTITY_FROM'
=>
new
Main\Entity\IntegerField(
'QUANTITY_FROM'
,
array
(
92
'title'
=> Loc::getMessage(
'PRICE_ENTITY_QUANTITY_FROM_FIELD'
)
93
)),
94
'QUANTITY_TO'
=>
new
Main\Entity\IntegerField(
'QUANTITY_TO'
,
array
(
95
'title'
=> Loc::getMessage(
'PRICE_ENTITY_QUANTITY_TO_FIELD'
)
96
)),
97
'TMP_ID'
=>
new
Main\Entity\StringField(
'TMP_ID'
,
array
(
98
'validation'
=>
array
(__CLASS__,
'validateTmpId'
),
99
'title'
=> Loc::getMessage(
'PRICE_ENTITY_TMP_ID_FIELD'
)
100
)),
101
'PRICE_SCALE'
=>
new
Main\Entity\FloatField(
'PRICE_SCALE'
,
array
(
102
'required'
=>
true
,
103
'title'
=> Loc::getMessage(
'PRICE_ENTITY_PRICE_SCALE_FIELD'
)
104
)),
105
'CATALOG_GROUP'
=>
new
Main\Entity\ReferenceField(
106
'CATALOG_GROUP'
,
107
'\Bitrix\Catalog\Group'
,
108
array
(
'=this.CATALOG_GROUP_ID'
=>
'ref.ID'
)
109
),
110
'ELEMENT'
=>
new
Main\Entity\ReferenceField(
111
'ELEMENT'
,
112
'\Bitrix\Iblock\Element'
,
113
array
(
'=this.PRODUCT_ID'
=>
'ref.ID'
),
114
array
(
'join_type'
=>
'LEFT'
)
115
),
116
'PRODUCT'
=>
new
Main\Entity\ReferenceField(
117
'PRODUCT'
,
118
'\Bitrix\Catalog\Product'
,
119
array
(
'=this.PRODUCT_ID'
=>
'ref.ID'
),
120
array
(
'join_type'
=>
'LEFT'
)
121
),
122
);
123
}
124
129
public
static
function
validateCurrency
()
130
{
131
return
array
(
132
new
Main
\
Entity
\
Validator
\Length(
null
, 3),
133
);
134
}
135
140
public
static
function
validateTmpId
()
141
{
142
return
array
(
143
new
Main
\
Entity
\
Validator
\Length(
null
, 40),
144
);
145
}
146
154
public
static
function
deleteByProduct
($id)
155
{
156
$id = (int)$id;
157
if
($id <= 0)
158
return
;
159
160
$conn =
Main\Application::getConnection
();
161
$helper = $conn->getSqlHelper();
162
$conn->queryExecute(
163
'delete from '
.$helper->quote(self::getTableName()).
' where '
.$helper->quote(
'PRODUCT_ID'
).
' = '
.$id
164
);
165
unset($helper, $conn);
166
}
167
}
Bitrix\Catalog\PriceTable
Определения
price.php:43
Bitrix\Catalog\PriceTable\getMap
static getMap()
Определения
price.php:59
Bitrix\Catalog\PriceTable\deleteByProduct
static deleteByProduct($id)
Определения
price.php:154
Bitrix\Catalog\PriceTable\validateCurrency
static validateCurrency()
Определения
price.php:129
Bitrix\Catalog\PriceTable\validateTmpId
static validateTmpId()
Определения
price.php:140
Bitrix\Catalog\PriceTable\getTableName
static getTableName()
Определения
price.php:49
Bitrix\Main\Application\getConnection
static getConnection($name="")
Определения
application.php:638
Bitrix\Main\ORM\Data\DataManager
Определения
datamanager.php:35
Bitrix\Main\ORM\Fields\DatetimeField
Определения
datetimefield.php:22
Bitrix\Main\ORM\Fields\FloatField
Определения
floatfield.php:20
Bitrix\Main\ORM\Fields\IntegerField
Определения
integerfield.php:20
Bitrix\Main\ORM\Fields\StringField
Определения
stringfield.php:20
Bitrix\Main\ORM\Fields\Validators\Validator
Определения
validator.php:18
Bitrix\Main\Type\DateTime
Определения
datetime.php:9
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Main
bitrix
modules
catalog
lib
price.php
Создано системой
1.14.0