Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
store.php
1
<?php
2
3
namespace
Bitrix\Sale\Delivery\ExtraServices
;
4
5
use
Bitrix\Main\ArgumentNullException
;
6
use
Bitrix\Main\Error
;
7
use
Bitrix\Sale\Internals\Input
;
8
use
Bitrix\Main\Localization\Loc
;
9
use
Bitrix\Sale\Result
;
10
11
Loc::loadMessages
(__FILE__);
12
13
class
Store
extends
Base
14
{
15
protected
static
function
getStoresList
($nameOnly =
true
, $siteId =
""
)
16
{
17
if
(!\
Bitrix
\Main\Loader::includeModule(
'catalog'
))
18
return
array();
19
20
$filter = array(
"ACTIVE"
=>
"Y"
,
"ISSUING_CENTER"
=>
"Y"
);
21
22
if
($siteId <>
''
)
23
$filter[
"+SITE_ID"
] = $siteId;
24
25
$result = array();
26
$dbList = \CCatalogStore::GetList(
27
array(
"SORT"
=>
"ASC"
,
"TITLE"
=>
"ASC"
),
28
$filter,
29
false
,
30
false
,
31
array(
"ID"
,
"SITE_ID"
,
"TITLE"
,
"ADDRESS"
,
"DESCRIPTION"
,
"IMAGE_ID"
,
"PHONE"
,
"SCHEDULE"
,
"LOCATION_ID"
,
"GPS_N"
,
"GPS_S"
)
32
);
33
34
while
($store = $dbList->Fetch())
35
{
36
if
($nameOnly)
37
$result[$store[
"ID"
]] = $store[
"TITLE"
].($store[
"SITE_ID"
] <>
''
?
" ["
.$store[
"SITE_ID"
].
"]"
:
""
);
38
else
39
$result[$store[
"ID"
]] = $store;
40
}
41
42
return
$result;
43
}
44
45
public
static
function
getClassTitle
()
46
{
47
return
Loc::getMessage
(
"DELIVERY_EXTRA_SERVICE_STORE_TITLE"
);
48
}
49
50
public
function
getCost
()
51
{
52
return
false
;
53
}
54
55
public
static
function
getAdminParamsName
()
56
{
57
return
Loc::getMessage
(
"DELIVERY_EXTRA_SERVICE_STORE_TITLE"
);
58
}
59
60
public
static
function
getAdminParamsControl
($name, array $params, $currency =
""
)
61
{
62
return
Input\Manager::getEditHtml(
63
$name.
"[PARAMS][STORES]"
,
64
[
65
"TYPE"
=>
"ENUM"
,
66
"MULTIPLE"
=>
"Y"
,
67
"OPTIONS"
=> self::getStoresList(),
68
],
69
$params[
"PARAMS"
][
"STORES"
] ??
null
70
);
71
}
72
73
public
function
getAdminDefaultControl
($name =
""
, $value =
false
)
74
{
75
if
($name ==
''
)
76
throw
new
ArgumentNullException
(
new
Error
(
'name'
));
77
78
return
Input\Manager::getEditHtml(
79
$name,
80
array(
81
"TYPE"
=>
"ENUM"
,
82
"OPTIONS"
=> self::getStoresList()
83
),
84
$value
85
);
86
}
87
88
public
function
getEditControl
($prefix =
""
, $value =
false
)
89
{
90
global $APPLICATION;
91
92
if
(!$value)
93
$value = $this->value;
94
95
$result =
'<div class="view_map">'
;
96
$siteId = SITE_ID <>
''
? SITE_ID :
""
;
97
98
ob_start();
99
$APPLICATION->IncludeComponent(
100
"bitrix:sale.store.choose"
,
101
".default"
,
102
Array(
103
"INPUT_NAME"
=> $prefix,
104
"DELIVERY_ID"
=> $this->deliveryId,
105
"SELECTED_STORE"
=> $value,
106
"STORES_LIST"
=> self::getStoresList(
false
, $siteId)
107
));
108
109
$result .= ob_get_contents();
110
ob_end_clean();
111
112
$result .=
'</div>'
;
113
return
$result;
114
}
115
116
public
function
getViewControl
()
117
{
118
return
Input\Manager::getViewHtml(
119
array(
120
"TYPE"
=>
"ENUM"
,
121
"OPTIONS"
=> self::getStoresList(
true
, SITE_ID <>
''
? SITE_ID :
""
)
122
),
123
$this->value
124
);
125
}
126
127
public
static
function
isInner
()
128
{
129
return
true
;
130
}
131
132
public
static
function
getStoresIdsFromParams
(array $params)
133
{
134
return
$params[
"STORES"
];
135
}
136
}
Bitrix\Main\ArgumentNullException
Definition
exception.php:54
Bitrix\Main\DB\Result
Definition
result.php:19
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main\Localization\Loc
Definition
loc.php:11
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\ExtraServices\Store
Definition
store.php:14
Bitrix\Sale\Delivery\ExtraServices\Store\getEditControl
getEditControl($prefix="", $value=false)
Definition
store.php:88
Bitrix\Sale\Delivery\ExtraServices\Store\getAdminDefaultControl
getAdminDefaultControl($name="", $value=false)
Definition
store.php:73
Bitrix\Sale\Delivery\ExtraServices\Store\getStoresIdsFromParams
static getStoresIdsFromParams(array $params)
Definition
store.php:132
Bitrix\Sale\Delivery\ExtraServices\Store\getCost
getCost()
Definition
store.php:50
Bitrix\Sale\Delivery\ExtraServices\Store\isInner
static isInner()
Definition
store.php:127
Bitrix\Sale\Delivery\ExtraServices\Store\getClassTitle
static getClassTitle()
Definition
store.php:45
Bitrix\Sale\Delivery\ExtraServices\Store\getAdminParamsControl
static getAdminParamsControl($name, array $params, $currency="")
Definition
store.php:60
Bitrix\Sale\Delivery\ExtraServices\Store\getAdminParamsName
static getAdminParamsName()
Definition
store.php:55
Bitrix\Sale\Delivery\ExtraServices\Store\getViewControl
getViewControl()
Definition
store.php:116
Bitrix\Sale\Delivery\ExtraServices\Store\getStoresList
static getStoresList($nameOnly=true, $siteId="")
Definition
store.php:15
Bitrix\Sale\Delivery\ExtraServices
Definition
base.php:3
Bitrix\Sale\Internals\Input
Definition
input.php:3
Bitrix
modules
sale
lib
delivery
extra_services
store.php
Создано системой
1.10.0