Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
bysite.php
1
<?php
2
namespace
Bitrix\Sale\Delivery\Restrictions
;
3
4
use
Bitrix\Sale\Delivery\Restrictions\Base
;
5
use \Bitrix\Main\Localization\Loc;
6
use
Bitrix\Sale\Internals\CollectableEntity
;
7
use
Bitrix\Sale\Internals\Entity
;
8
use
Bitrix\Sale\Order
;
9
10
Loc::loadMessages
(__FILE__);
11
17
class
BySite
extends
Base
18
{
19
public
static
function
getClassTitle
()
20
{
21
return
Loc::getMessage
(
"SALE_DLVR_RSTR_BY_SITE_NAME"
);
22
}
23
24
public
static
function
getClassDescription
()
25
{
26
return
Loc::getMessage
(
"SALE_DLVR_RSTR_BY_SITE_DESCRIPT"
);
27
}
28
public
static
function
check
($siteId, array $restrictionParams, $deliveryId = 0)
29
{
30
if
(empty($restrictionParams))
31
return
true
;
32
33
$result =
true
;
34
35
if
($siteId <>
''
&& isset($restrictionParams[
"SITE_ID"
]) && is_array($restrictionParams[
"SITE_ID"
]))
36
$result = in_array($siteId, $restrictionParams[
"SITE_ID"
]);
37
38
return
$result;
39
}
40
41
protected
static
function
extractParams(
Entity
$entity)
42
{
43
if
($entity instanceof
CollectableEntity
)
44
{
46
$collection = $entity->getCollection();
47
49
$order = $collection->getOrder();
50
}
51
elseif ($entity instanceof
Order
)
52
{
54
$order = $entity;
55
}
56
57
if
(!$order)
58
return
false
;
59
60
return
$order->getSiteId();
61
}
62
63
public
static
function
getParamsStructure
($entityId = 0)
64
{
65
$siteList = array();
66
67
$rsSite = \Bitrix\Main\SiteTable::getList();
68
69
while
($site = $rsSite->fetch())
70
$siteList[$site[
"LID"
]] = $site[
"NAME"
].
" ("
.$site[
"LID"
].
")"
;
71
72
return
array(
73
"SITE_ID"
=> array(
74
"TYPE"
=>
"ENUM"
,
75
'MULTIPLE'
=>
'Y'
,
76
"DEFAULT"
=> SITE_ID,
77
"LABEL"
=>
Loc::getMessage
(
"SALE_DLVR_RSTR_BY_SITE_SITE_ID"
),
78
"OPTIONS"
=> $siteList
79
)
80
);
81
}
82
83
public
static
function
getSeverity
($mode)
84
{
85
if
($mode ==
Manager::MODE_MANAGER
)
86
return
Manager::SEVERITY_STRICT
;
87
88
return
parent::getSeverity($mode);
89
}
90
94
public
static
function
isAvailable
()
95
{
96
return
IsModuleInstalled(
'bitrix24'
) ? false :
true
;
97
}
98
}
Bitrix\Catalog\Model\Entity
Definition
entity.php:12
Bitrix\Catalog\Product\Store\DistributionStrategy\Base
Definition
base.php:21
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Sale\Delivery\ExtraServices\Base
Definition
base.php:10
Bitrix\Sale\Delivery\Restrictions\BySite
Definition
bysite.php:18
Bitrix\Sale\Delivery\Restrictions\BySite\getClassTitle
static getClassTitle()
Definition
bysite.php:19
Bitrix\Sale\Delivery\Restrictions\BySite\isAvailable
static isAvailable()
Definition
bysite.php:94
Bitrix\Sale\Delivery\Restrictions\BySite\getClassDescription
static getClassDescription()
Definition
bysite.php:24
Bitrix\Sale\Delivery\Restrictions\BySite\getParamsStructure
static getParamsStructure($entityId=0)
Definition
bysite.php:63
Bitrix\Sale\Delivery\Restrictions\BySite\check
static check($siteId, array $restrictionParams, $deliveryId=0)
Definition
bysite.php:28
Bitrix\Sale\Delivery\Restrictions\BySite\getSeverity
static getSeverity($mode)
Definition
bysite.php:83
Bitrix\Sale\Helpers\Order
Definition
order.php:10
Bitrix\Sale\Internals\CollectableEntity
Definition
collectableentity.php:14
Bitrix\Sale\Services\Base\RestrictionManager\MODE_MANAGER
const MODE_MANAGER
Definition
restrictionmanager.php:27
Bitrix\Sale\Services\Base\RestrictionManager\SEVERITY_STRICT
const SEVERITY_STRICT
Definition
restrictionmanager.php:31
Bitrix\Sale\Delivery\Restrictions
Definition
base.php:2
modules
sale
lib
delivery
restrictions
bysite.php
Создано системой
1.10.0