1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
ShopManager.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Catalog\v2\Integration\Landing
;
4
5
use
Bitrix\Landing\Internals\SiteTable
;
6
use
Bitrix\Landing\Site
;
7
use
Bitrix\Main\Error
;
8
use
Bitrix\Main\Loader
;
9
use
Bitrix\Main\Result
;
10
11
final
class
ShopManager
12
{
13
private
bool
$isLandingIncluded;
14
private
const
EXCLUDED_SITES = [
15
'store-chats-dark'
,
16
'store-chats-light'
,
17
'store-chats'
,
18
];
19
20
public
function
__construct
()
21
{
22
$this->isLandingIncluded = Loader::includeModule(
'landing'
);
23
}
24
25
public
function
areTherePublishedShops
(): bool
26
{
27
return
!empty($this->getPublishedShopsIds());
28
}
29
30
private
function
getPublishedShopsIds():
array
31
{
32
if
(!$this->isLandingIncluded)
33
{
34
return
[];
35
}
36
37
$result
= [];
38
39
$activeShopsList =
SiteTable::getList
([
40
'select'
=> [
41
'ID'
,
42
'TYPE'
,
43
'ACTIVE'
,
44
'TPL_CODE'
,
45
],
46
'filter'
=> [
47
'=TYPE'
=>
'STORE'
,
48
'=ACTIVE'
=>
'Y'
,
49
],
50
]);
51
52
while
(
$site
= $activeShopsList->fetch())
53
{
54
if
(in_array(
$site
[
'TPL_CODE'
], self::EXCLUDED_SITES,
true
))
55
{
56
continue
;
57
}
58
59
$result
[] = (int)
$site
[
'ID'
];
60
}
61
62
return
$result
;
63
}
64
65
public
function
unpublishShops
():
Result
66
{
67
$result
=
new
Result
();
68
69
if
(!$this->isLandingIncluded)
70
{
71
$result
->addError(
new
Error
(
'The landing module is not installed'
));
72
73
return
$result
;
74
}
75
76
$publishedShopsIds = $this->getPublishedShopsIds();
77
foreach
($publishedShopsIds as $publishedShopsId)
78
{
79
$siteResult = Site::unpublic((
int
)$publishedShopsId);
80
if
(!$siteResult->isSuccess())
81
{
82
$result
->addErrors($siteResult->getErrors());
83
}
84
}
85
86
return
$result
;
87
}
88
}
Bitrix\Catalog\v2\Integration\Landing\ShopManager
Определения
ShopManager.php:12
Bitrix\Catalog\v2\Integration\Landing\ShopManager\__construct
__construct()
Определения
ShopManager.php:20
Bitrix\Catalog\v2\Integration\Landing\ShopManager\areTherePublishedShops
areTherePublishedShops()
Определения
ShopManager.php:25
Bitrix\Catalog\v2\Integration\Landing\ShopManager\unpublishShops
unpublishShops()
Определения
ShopManager.php:65
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Main\Loader
Определения
loader.php:13
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
Bitrix\Main\ORM\Data\Result
Определения
result.php:16
Bitrix\Main\SiteTable
Определения
site.php:31
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
Bitrix\Catalog\v2\Integration\Landing
Определения
ShopManager.php:3
Bitrix\Landing\Site
Определения
cookies.php:2
$site
$site
Определения
yandex_run.php:614
bitrix
modules
catalog
lib
v2
Integration
Landing
ShopManager.php
Создано системой
1.14.0