1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
conditionschecker.php
См. документацию.
1<?php
2
3namespace Bitrix\Catalog\Store\EnableWizard;
4
5use Bitrix\Catalog\ProductTable;
6use Bitrix\Catalog\StoreDocumentTable;
7use Bitrix\Catalog\v2\Integration\Landing\ShopManager;
8use Bitrix\Main\Application;
9use Bitrix\Main\DB\SqlExpression;
10use Bitrix\Main\Type\Collection;
11
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 {
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
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 {
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
Определения actionsdefinitions.php:38
const TYPE_OFFER
Определения product.php:73
const TYPE_PRODUCT
Определения product.php:70
static getList(array $parameters=array())
Определения datamanager.php:431
$query
Определения get_search.php:11
$iterator
Определения yandex_run.php:610