Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
store.php
1<?php
2
4
10
11Loc::loadMessages(__FILE__);
12
13class 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}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
getEditControl($prefix="", $value=false)
Definition store.php:88
getAdminDefaultControl($name="", $value=false)
Definition store.php:73
static getStoresIdsFromParams(array $params)
Definition store.php:132
static getAdminParamsControl($name, array $params, $currency="")
Definition store.php:60
static getStoresList($nameOnly=true, $siteId="")
Definition store.php:15