1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
conditionschecker.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Catalog\Store\EnableWizard;
4
5
use Bitrix\Catalog\ProductTable;
6
use Bitrix\Catalog\StoreDocumentTable;
7
use Bitrix\Catalog\v2\Integration\Landing\ShopManager;
8
use Bitrix\Main\Application;
9
use Bitrix\Main\DB\SqlExpression;
10
use Bitrix\Main\Type\Collection;
11
12
class
ConditionsChecker
13
{
14
public
static
function
hasConductedDocumentsOrQuantities
(): bool
15
{
16
return
(
17
self::doesProductWithQuantityExist()
18
|| self::doesConductedDocumentExist()
19
);
20
}
21
22
public
static
function
areTherePublishedShops
(): bool
23
{
24
return
(
new
ShopManager
())->areTherePublishedShops();
25
}
26
27
public
static
function
areThereActiveProducts
(): bool
28
{
29
$iblockIds =
ProductDisabler::getIblocksForDisabling
();
30
Collection::normalizeArrayValuesByInt($iblockIds);
31
if
(empty($iblockIds))
32
{
33
return
false
;
34
}
35
36
$iblockIds = implode(
', '
, $iblockIds);
37
38
return
(
bool
)Application::getConnection()->query(
"
39
SELECT ie.ACTIVE
40
FROM b_catalog_product cp
41
JOIN b_iblock_element ie on ie.ID = cp.ID
42
WHERE ie.ACTIVE = 'Y'
43
AND ie.IBLOCK_ID in ($iblockIds)
44
LIMIT 1
45
"
)->fetch();
46
}
47
48
public
static
function
doesProductWithQuantityExist
(): bool
49
{
50
$connection
= Application::getConnection();
51
52
$productTypes =
new
SqlExpression
(
'(?i, ?i)'
,
ProductTable::TYPE_PRODUCT
,
ProductTable::TYPE_OFFER
);
53
$query
=
$connection
->query(
"
54
select ID from b_catalog_product cp
55
where TYPE in {$productTypes} and (QUANTITY != 0 or QUANTITY_RESERVED != 0)
56
limit 1
57
"
);
58
59
if
(
$query
->fetch())
60
{
61
return
true
;
62
}
63
64
$query
=
$connection
->query(
"
65
select ID from b_catalog_store_product csp
66
where AMOUNT != 0 or QUANTITY_RESERVED != 0
67
limit 1
68
"
);
69
70
if
(
$query
->fetch())
71
{
72
return
true
;
73
}
74
75
return
false
;
76
}
77
78
public
static
function
doesConductedDocumentExist
(): bool
79
{
80
$iterator
=
StoreDocumentTable::getList
([
81
'select'
=> [
82
'ID'
,
83
],
84
'filter'
=> [
85
'=STATUS'
=>
'Y'
,
86
],
87
'limit'
=> 1,
88
]);
89
$row =
$iterator
->fetch();
90
unset(
$iterator
);
91
92
return
!empty($row);
93
}
94
}
$connection
$connection
Определения
actionsdefinitions.php:38
Bitrix\Catalog\ProductTable\TYPE_OFFER
const TYPE_OFFER
Определения
product.php:73
Bitrix\Catalog\ProductTable\TYPE_PRODUCT
const TYPE_PRODUCT
Определения
product.php:70
Bitrix\Catalog\Store\EnableWizard\ConditionsChecker
Определения
conditionschecker.php:13
Bitrix\Catalog\Store\EnableWizard\ConditionsChecker\doesConductedDocumentExist
static doesConductedDocumentExist()
Определения
conditionschecker.php:78
Bitrix\Catalog\Store\EnableWizard\ConditionsChecker\areThereActiveProducts
static areThereActiveProducts()
Определения
conditionschecker.php:27
Bitrix\Catalog\Store\EnableWizard\ConditionsChecker\doesProductWithQuantityExist
static doesProductWithQuantityExist()
Определения
conditionschecker.php:48
Bitrix\Catalog\Store\EnableWizard\ConditionsChecker\hasConductedDocumentsOrQuantities
static hasConductedDocumentsOrQuantities()
Определения
conditionschecker.php:14
Bitrix\Catalog\Store\EnableWizard\ConditionsChecker\areTherePublishedShops
static areTherePublishedShops()
Определения
conditionschecker.php:22
Bitrix\Catalog\Store\EnableWizard\ProductDisabler\getIblocksForDisabling
static getIblocksForDisabling()
Определения
productdisabler.php:12
Bitrix\Catalog\v2\Integration\Landing\ShopManager
Определения
ShopManager.php:12
Bitrix\Main\DB\SqlExpression
Определения
sqlexpression.php:21
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
$query
$query
Определения
get_search.php:11
$iterator
$iterator
Определения
yandex_run.php:610
bitrix
modules
catalog
lib
store
enablewizard
conditionschecker.php
Создано системой
1.14.0