1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
product_settings.php
См. документацию.
1<?php
4const STOP_STATISTICS = true;
5const NO_AGENT_CHECK = true;
6const PUBLIC_AJAX_MODE = true;
7
13
14require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_before.php';
15
16Loc::loadMessages(__FILE__);
17
18if (!Loader::includeModule('catalog'))
19{
20 ShowError(Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_REINDEX_ERRORS_MODULE_CATALOG_ABSENT'));
21 die();
22}
23
24if (!AccessController::getCurrent()->check(ActionDictionary::ACTION_CATALOG_SETTINGS_ACCESS))
25{
26 ShowError(Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_ACCESS_DENIED'));
27 die();
28}
29
31{
32 ShowError(Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_ERRORS_INCORRECT_SESSION'));
33 die();
34}
35
36$request = Main\Context::getCurrent()->getRequest();
37
39 'default_quantity_trace',
40 'default_can_buy_zero',
41 'default_subscribe',
42];
44foreach ($settingIds as $id)
45{
46 $settings[$id] = Main\Config\Option::get('catalog', $id);
47}
48unset($id);
49
50if (
51 $request->getRequestMethod() === 'GET'
52 && $request->get('operation') === 'Y'
53)
54{
55 $params = [
56 'sessID' => $request['ajaxSessionID'],
57 'maxExecutionTime' => $request['maxExecutionTime'],
58 'maxOperationCounter' => $request['maxOperationCounter'],
59 'counter' => $request['counter'],
60 'operationCounter' => $request['operationCounter'],
61 'lastID' => $request['lastID'],
62 'IBLOCK_ID' => $request['iblockId']
63 ];
64
65 $productSettings = new CCatalogProductSettings(
66 $params['sessID'],
67 $params['maxExecutionTime'],
68 $params['maxOperationCounter']
69 );
70 $productSettings->initStep($params['counter'], $params['operationCounter'], $params['lastID']);
71 $productSettings->setParams($params);
72 $productSettings->run();
73 $result = $productSettings->saveStep();
74 unset($productSettings);
75
76 header('Content-Type: application/x-javascript; charset='.LANG_CHARSET);
77 echo CUtil::PhpToJSObject($result, false, true);
78 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin_after.php');
79}
80elseif (
81 $request->getRequestMethod() == 'GET'
82 && $request['changeSettings'] == 'Y'
83)
84{
85 $result = array();
86
87 $newSettings = $settings;
88 foreach ($settingIds as $id)
89 {
90 $newValue = (string)$request[$id];
91 if ($newValue == 'Y' || $newValue == 'N')
92 {
93 $newSettings[$id] = $newValue;
94 }
95 unset($newValue);
96 }
97 unset($id);
98
99 foreach ($newSettings as $id => $value)
100 {
101 Main\Config\Option::set('catalog', $id, $value, '');
102
103 if ($id === 'default_can_buy_zero')
104 Main\Config\Option::set('catalog', 'allow_negative_amount', $value, '');
105 }
106 unset($id, $value);
107
108 $result['success'] = 'Y';
109
110 header('Content-Type: application/x-javascript; charset='.LANG_CHARSET);
111 echo CUtil::PhpToJSObject($result, false, true);
112 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin_after.php');
113}
114elseif (
115 $request->getRequestMethod() == 'GET'
116 && $request['getIblock'] == 'Y'
117)
118{
120 header('Content-Type: application/x-javascript; charset='.LANG_CHARSET);
121 echo CUtil::PhpToJSObject($result, false, true);
122 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin_after.php');
123}
124elseif (
125 $request->getRequestMethod() == 'GET'
126 && $request['finalRequest'] == 'Y'
127)
128{
129 $iblockList = $request['iblockList'];
130 if (!empty($iblockList) && is_array($iblockList))
131 {
132 foreach ($iblockList as $iblock)
134 unset($iblock);
135 }
136 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin_after.php');
137}
138else
139{
140 $APPLICATION->SetTitle(Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_PAGE_TITLE'));
141
143
144 $publicMode = $request->get('public_mode') === 'Y';
145
146 if ($publicMode)
147 {
148 require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_popup_admin.php");
149 }
150 else
151 {
152 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_admin_after.php');
153 }
154
156 [
157 'DIV' => 'productSettingsTab01',
158 'TAB' => Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_TAB'),
159 'ICON' => 'sale',
160 'TITLE' => Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_TAB_TITLE'),
161 ],
162 ];
163 $tabControl = new CAdminTabControl('productSettings', $tabList, true, true);
164 if ($publicMode)
165 {
166 $tabControl->SetPublicMode();
167 }
168 Main\Page\Asset::getInstance()->addJs('/bitrix/js/catalog/step_operations.js');
169
170 ?><div id="product_settings_error_div" style="margin:0; display: none;">
171 <div class="adm-info-message-wrap adm-info-message-red">
172 <div class="adm-info-message">
173 <div class="adm-info-message-title"><?= Loc::getMessage('SALE_DISCOUNT_REINDEX_ERRORS_TITLE'); ?></div>
174 <div id="product_settings_error_cont"></div>
175 <div class="adm-info-message-icon"></div>
176 </div>
177 </div>
178 </div>
179 <form name="product_settings_form" id="product_settings_form" action="<?= $APPLICATION->GetCurPage(); ?>" method="GET"><?php
180 $tabControl->Begin();
181 $tabControl->BeginNextTab();
182 ?><tr>
183 <td width="40%"><label for="default_quantity_trace"><?= Loc::getMessage("BX_CATALOG_PRODUCT_SETTINGS_ENABLE_QUANTITY_TRACE"); ?></label></td>
184 <td width="60%">
185 <input type="checkbox" name="default_quantity_trace" id="quantity_trace" value="Y"<?= ($settings['default_quantity_trace'] === 'Y' ? ' checked' : ''); ?>>
186 </td>
187 </tr>
188 <tr>
189 <td width="40%"><label for="default_can_buy_zero"><?= Loc::getMessage("BX_CATALOG_PRODUCT_SETTINGS_ALLOW_CAN_BUY_ZERO"); ?></label></td>
190 <td width="60%">
191 <input type="checkbox" name="default_can_buy_zero" id="can_buy_zero" value="Y"<?= ($settings['default_can_buy_zero'] === 'Y' ? ' checked' : ''); ?>>
192 </td>
193 </tr>
194 <tr>
195 <td width="40%"><label for="default_subscribe"><?= Loc::getMessage("BX_CATALOG_PRODUCT_SETTINGS_PRODUCT_SUBSCRIBE"); ?></label></td>
196 <td width="60%">
197 <input type="checkbox" name="default_subscribe" id="subscribe" value="Y"<?= ($settings['default_subscribe'] === 'Y' ? ' checked' : ''); ?>>
198 </td>
199 </tr>
200 <tr>
201 <td width="40%"><?= Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_MAX_EXECUTION_TIME'); ?></td>
202 <td width="60%"><input type="text" name="max_execution_time" id="max_execution_time" size="3" value="<?= $oneStepTime; ?>"></td>
203 </tr>
204 <?php
205 $tabControl->Buttons();
206 ?>
207 <input type="button" id="product_settings_start_button" value="<?= Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_UPDATE_BTN'); ?>">
208 <input type="button" id="product_settings_stop_button" value="<?= Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_STOP_BTN'); ?>" disabled>
209 <div id="reindexReport" style="display: none;"></div>
210 <?php
211 $tabControl->End();
212 ?></form>
213 <?php
215 'url' => $APPLICATION->GetCurPage(),
216 'options' => [
217 'ajaxSessionID' => 'productSettings',
218 'maxExecutionTime' => $oneStepTime,
219 'maxOperationCounter' => 10,
220 'counter' => 0,
221 ],
222 'visual' => [
223 'startBtnID' => 'product_settings_start_button',
224 'stopBtnID' => 'product_settings_stop_button',
225 'timeFieldID' => 'max_execution_time',
226 'reportID' => 'reindexReport',
227 'prefix' => 'catalog_reindex_iblock_',
228 'resultContID' => 'catalog_reindex_result_div_',
229 'errorContID' => 'catalog_reindex_error_cont_',
230 'errorDivID' => 'catalog_reindex_error_div_',
231 ],
232 'ajaxParams' => [
233 'operation' => 'Y',
234 ],
235 'checkboxList' => [
236 'quantity_trace',
237 'can_buy_zero',
238 'subscribe',
239 ],
240 'messages' => [
241 'status_yes' => Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_STATUS_YES'),
242 'status_no' => Loc::getMessage('BX_CATALOG_PRODUCT_SETTINGS_STATUS_NO'),
243 ],
244 ];
245 ?>
246 <script>
247 var jsProductSettings = new BX.Catalog.ProductSettings(<?= CUtil::PhpToJSObject($jsParams, false, true); ?>);
248 </script>
249 <?php
250 if (!$publicMode)
251 {
252 require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin.php');
253 }
254}
global $APPLICATION
Определения include.php:80
const PUBLIC_AJAX_MODE
Определения catalog_reindex.php:6
$jsParams
Определения catalog_reindex.php:168
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
$tabList
Определения catalog_reindex.php:107
$oneStepTime
Определения catalog_reindex.php:103
static get($moduleId, $name, $default="", $siteId=false)
Определения option.php:30
static set($moduleId, $name, $value="", $siteId="")
Определения option.php:261
Определения loader.php:13
static clearIblockTagCache($iblock_id)
Определения iblock.php:4599
static getCatalogList()
Определения step_operations.php:1501
static getDefaultExecutionTime()
Определения step_operations.php:162
static PhpToJSObject($arData, $bWS=false, $bSkipTilda=false, $bExtType=false)
Определения util.php:66
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
Определения file_new.php:677
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Form FILTER_ACTION disabled
Определения options.php:358
const STOP_STATISTICS
Определения froogle_util.php:2
$result
Определения get_property_values.php:14
if(! $catalogEdit->isSuccess()) $iblock
Определения iblock_catalog_edit.php:38
$iblockList
Определения iblock_catalog_list.php:271
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
const NO_AGENT_CHECK
Определения cron_frame.php:17
$tabControl
Определения csv_new_setup.php:244
const LANG_CHARSET
Определения include.php:65
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
ShowError($strError, $cls="errortext")
Определения tools.php:4499
$settingIds
Определения product_settings.php:38
$publicMode
Определения product_settings.php:144
$settings
Определения product_settings.php:43
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
die
Определения quickway.php:367
font style
Определения invoice.php:442
font size
Определения invoice.php:442
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799