1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
options.php
См. документацию.
1<?php
6$module_id = 'catalog';
7
12use Bitrix\Main;
15use Bitrix\Sale;
18
20
21Loader::includeModule('catalog');
22
23$accessController = AccessController::getCurrent();
24$bReadOnly = !$accessController->check(ActionDictionary::ACTION_CATALOG_SETTINGS_ACCESS);
25if (!$accessController->check(ActionDictionary::ACTION_CATALOG_READ) && $bReadOnly)
26{
27 return;
28}
29
30Loc::loadMessages(__FILE__);
31
33$saleIsInstalled = ModuleManager::isModuleInstalled('sale');
35{
36 $useSaleDiscountOnly = Option::get('sale', 'use_sale_discount_only') == 'Y';
37}
38
39$crmInstalled = ModuleManager::isModuleInstalled('crm');
40
42
43$saleSettingsUrl = 'settings.php?lang='.LANGUAGE_ID.'&mid=sale&mid_menu=1';
44
47
48if ($_SERVER['REQUEST_METHOD'] == 'GET' && !empty($_REQUEST['RestoreDefaults']) && !$bReadOnly && check_bitrix_sessid())
49{
50 $strValTmp = '';
51 if (!$USER->IsAdmin())
52 $strValTmp = Option::get('catalog', 'avail_content_groups');
53
54 Option::delete('catalog', array());
55 $z = CGroup::GetList('id', 'asc', array("ACTIVE" => "Y", "ADMIN" => "N"));
56 while($zr = $z->Fetch())
57 $APPLICATION->DelGroupRight($module_id, array($zr["ID"]));
58
59 if (!$USER->IsAdmin())
60 Option::set('catalog', 'avail_content_groups', $strValTmp, '');
61}
62
64 array("export_default_path", Loc::getMessage("CAT_EXPORT_DEFAULT_PATH"), "/bitrix/catalog_export/", array("text", 30)),
65 array("default_catalog_1c", Loc::getMessage("CAT_DEF_IBLOCK"), "", array("text", 30)),
66 array("deactivate_1c_no_price", Loc::getMessage("CAT_DEACT_NOPRICE"), "N", array("checkbox")),
67);
68
70{
71 $arAllOptions[] = array("yandex_xml_period", Loc::getMessage("CAT_YANDEX_MARKET_XML_PERIOD"), "24", array("text", 5));
72}
73
75$strOK = "";
76if ($_SERVER['REQUEST_METHOD'] == "POST" && !empty($_POST['Update']) && !$bReadOnly && check_bitrix_sessid())
77{
78 for ($i = 0, $cnt = count($arAllOptions); $i < $cnt; $i++)
79 {
81 $val = (isset($_POST[$name]) ? trim($_POST[$name]) : '');
82 if ($arAllOptions[$i][3][0]=="checkbox" && $val!="Y")
83 $val = "N";
84 if ($val == '')
85 $val = $arAllOptions[$i][2];
86 if ($name == 'export_default_path')
87 {
88 $boolExpPath = true;
89 if (empty($val))
90 {
91 $boolExpPath = false;
92 }
93 if ($boolExpPath)
94 {
95 $val = str_replace('//','/',Rel2Abs('/', $val.'/'));
96 if (preg_match(BX_CATALOG_FILENAME_REG, $val))
97 $boolExpPath = false;
98 }
99 if ($boolExpPath)
100 {
101 if (empty($val) || '/' == $val)
102 $boolExpPath = false;
103 }
104 if ($boolExpPath)
105 {
106 if (!file_exists($_SERVER['DOCUMENT_ROOT'].$val) || !is_dir($_SERVER['DOCUMENT_ROOT'].$val))
107 $boolExpPath = false;
108 }
109 if ($boolExpPath)
110 {
111 if ($APPLICATION->GetFileAccessPermission($val) < 'W')
112 $boolExpPath = false;
113 }
114
115 if ($boolExpPath)
116 {
117 Option::set('catalog', $name, $val, '');
118 }
119 else
120 {
121 $strWarning .= Loc::getMessage('CAT_PATH_ERR_EXPORT_FOLDER_BAD').'<br />';
122 }
123 }
124 else
125 {
126 Option::set('catalog', $name, $val, '');
127 }
128 }
129
130 $default_outfile_action = (string)($_REQUEST['default_outfile_action'] ?? '');
132 {
134 }
135 Option::set('catalog', 'default_outfile_action', $default_outfile_action, '');
136
137 $strYandexAgent = '';
138 $strYandexAgent = trim($_POST['yandex_agent_file']);
139 if (!empty($strYandexAgent))
140 {
141 $strYandexAgent = Rel2Abs('/', $strYandexAgent);
142 if (preg_match(BX_CATALOG_FILENAME_REG, $strYandexAgent) || (!file_exists($_SERVER['DOCUMENT_ROOT'].$strYandexAgent) || !is_file($_SERVER['DOCUMENT_ROOT'].$strYandexAgent)))
143 {
144 $strWarning .= Loc::getMessage('CAT_YANDEX_CUSTOM_AGENT_FILE_NOT_FOUND').'<br />';
145 $strYandexAgent = '';
146 }
147 }
148 Option::set('catalog', 'yandex_agent_file', $strYandexAgent, '');
149
150 $num_catalog_levels = (isset($_POST['num_catalog_levels']) ? (int)$_POST['num_catalog_levels'] : 3);
151 if ($num_catalog_levels <= 0)
152 $num_catalog_levels = 3;
153 Option::set('catalog', 'num_catalog_levels', $num_catalog_levels, '');
154
155 $serialSelectFields = array(
156 'allowed_product_fields',
157 'allowed_price_fields',
158 'allowed_group_fields',
159 'allowed_currencies'
160 );
161 foreach ($serialSelectFields as $oneSelect)
162 {
163 $fieldsClear = array();
164 $fieldsRaw = ($_POST[$oneSelect] ?? []);
165 if (!is_array($fieldsRaw))
166 {
167 $fieldsRaw = array($fieldsRaw);
168 }
169 if (!empty($fieldsRaw))
170 {
171 foreach ($fieldsRaw as &$oneValue)
172 {
173 $oneValue = trim($oneValue);
174 if ('' !== $oneValue)
175 {
176 $fieldsClear[] = $oneValue;
177 }
178 }
179 unset($oneValue);
180 }
181 Option::set('catalog', $oneSelect, implode(',', $fieldsClear), '');
182 }
183 unset($oneSelect);
184
185 $updateViewedProductSettings = (isset($_POST['enable_viewed_products'])
186 && ($_POST['enable_viewed_products'] === 'Y' || $_POST['enable_viewed_products'] === 'N')
187 );
188 if ($updateViewedProductSettings)
189 {
190 $enableViewedProducts = $_POST['enable_viewed_products'];
191 $oldEnableViewedProducts = Option::get('catalog', 'enable_viewed_products');
192 $viewedProductChange = $enableViewedProducts !== $oldEnableViewedProducts;
193 Option::set('catalog', 'enable_viewed_products', $enableViewedProducts, '');
194 if ($enableViewedProducts === 'Y')
195 {
196 $viewedPeriodChange = false;
197 $viewedTimeChange = false;
198 if (isset($_POST['viewed_period']) && is_string($_POST['viewed_period']))
199 {
200 $viewedPeriod = (int)$_POST['viewed_period'];
201 if ($viewedPeriod > 0)
202 {
203 $oldViewedPeriod = (int)Option::get('catalog', 'viewed_period');
204 $viewedPeriodChange = ($viewedPeriod !== $oldViewedPeriod);
205 Option::set('catalog', 'viewed_period', $viewedPeriod);
206 }
207 }
208
209 if (isset($_POST['viewed_time']) && is_string($_POST['viewed_time']))
210 {
211 $viewedTime = (int)$_POST['viewed_time'];
212 if ($viewedTime > 0)
213 {
214 $oldViewedTime = (int)Option::get('catalog', 'viewed_time');
215 $viewedTimeChange = ($viewedTime !== $oldViewedTime);
216 Option::set('catalog', 'viewed_time', $viewedTime);
217 }
218 }
219
220 if ($viewedProductChange || $viewedPeriodChange || $viewedTimeChange)
221 {
222 CAgent::RemoveAgent(
223 '\Bitrix\Catalog\CatalogViewedProductTable::clearAgent();',
224 'catalog'
225 );
226 CAgent::AddAgent(
227 '\Bitrix\Catalog\CatalogViewedProductTable::clearAgent();',
228 'catalog',
229 'N',
230 (int)Option::get('catalog', 'viewed_period') * 86400
231 );
232 }
233
234 if (isset($_POST['viewed_count']) && is_string($_POST['viewed_count']))
235 {
236 $viewedCount = (int)$_POST['viewed_count'];
237 if ($viewedCount >= 0)
238 {
239 Option::set('catalog', 'viewed_count', $viewedCount);
240 }
241 }
242 }
243 else
244 {
245 CAgent::RemoveAgent(
246 '\Bitrix\Catalog\CatalogViewedProductTable::clearAgent();',
247 'catalog'
248 );
249 }
250 }
251
252 if ($USER->IsAdmin() && CBXFeatures::IsFeatureEnabled('SaleRecurring'))
253 {
254 $arOldAvailContentGroups = array();
255 $oldAvailContentGroups = Option::get('catalog', 'avail_content_groups');
256 if ($oldAvailContentGroups != '')
257 $arOldAvailContentGroups = explode(",", $oldAvailContentGroups);
258 if (!empty($arOldAvailContentGroups))
259 $arOldAvailContentGroups = array_fill_keys($arOldAvailContentGroups, true);
260
261 $fieldsClear = array();
262 if (isset($_POST['AVAIL_CONTENT_GROUPS']) && is_array($_POST['AVAIL_CONTENT_GROUPS']))
263 {
264 $fieldsClear = $_POST['AVAIL_CONTENT_GROUPS'];
266 if (!empty($fieldsClear))
267 {
268 foreach ($fieldsClear as $oneValue)
269 {
270 if (isset($arOldAvailContentGroups[$oneValue]))
271 unset($arOldAvailContentGroups[$oneValue]);
272 }
273 unset($oneValue);
274 }
275 }
276 Option::set('catalog', 'avail_content_groups', implode(',', $fieldsClear), '');
277 if (!empty($arOldAvailContentGroups))
278 {
279 $arOldAvailContentGroups = array_keys($arOldAvailContentGroups);
280 foreach ($arOldAvailContentGroups as $oneValue)
282 unset($oneValue);
283 }
284 }
285
286 $oldSimpleSearch = Option::get('catalog', 'product_form_simple_search');
287 $newSimpleSearch = $oldSimpleSearch;
288 $oldProcessingEvents = Option::get('catalog', 'enable_processing_deprecated_events');
289 $newProcessingEvents = $oldProcessingEvents;
290 $checkboxFields = array(
291 'save_product_without_price',
292 'save_product_with_empty_price_range',
293 'show_catalog_tab_with_offers',
294 'use_offer_marking_code_group',
295 'default_product_vat_included',
296 'product_form_show_offers_iblock',
297 'product_form_simple_search',
298 'product_form_show_offer_name',
299 'enable_processing_deprecated_events',
300 );
302 {
303 $checkboxFields[] = 'product_card_slider_enabled';
304 }
305 if (!$crmInstalled)
306 {
307 $checkboxFields[] = 'show_store_shipping_center';
308 }
309
310 foreach ($checkboxFields as $oneCheckbox)
311 {
312 $value = (string)($_POST[$oneCheckbox] ?? '');
313 if ($value !== 'Y' && $value !== 'N')
314 continue;
315 Option::set('catalog', $oneCheckbox, $value, '');
316
317 if ($oneCheckbox === 'product_form_simple_search')
318 $newSimpleSearch = $value;
319 elseif ($oneCheckbox === 'enable_processing_deprecated_events')
320 $newProcessingEvents = $value;
321 }
322 unset($value, $oneCheckbox);
323
324 if ($oldSimpleSearch != $newSimpleSearch)
325 {
326 if ($newSimpleSearch == 'Y')
327 UnRegisterModuleDependences('search', 'BeforeIndex', 'catalog', '\Bitrix\Catalog\Product\Search', 'onBeforeIndex');
328 else
329 RegisterModuleDependences('search', 'BeforeIndex', 'catalog', '\Bitrix\Catalog\Product\Search', 'onBeforeIndex');
330 }
331 unset($oldSimpleSearch, $newSimpleSearch);
332
333 if ($oldProcessingEvents != $newProcessingEvents)
334 {
335 if ($newProcessingEvents == 'Y')
337 else
339 }
340 unset($oldProcessingEvents, $newProcessingEvents);
341
342 $strUseStoreControlBeforeSubmit = Option::get('catalog', 'default_use_store_control');
343 $strUseStoreControl = (isset($_POST['use_store_control']) && (string)$_POST['use_store_control'] === 'Y' ? 'Y' : 'N');
344
345 if ($strUseStoreControlBeforeSubmit != $strUseStoreControl)
346 {
347 if ($strUseStoreControl == 'Y')
348 {
349 $countStores = (int)CCatalogStore::GetList(array(), array("ACTIVE" => 'Y'), array());
350 if ($countStores <= 0)
351 {
352 $arStoreFields = array("TITLE" => Loc::getMessage("CAT_STORE_NAME"), "ADDRESS" => " ");
353 $newStoreId = CCatalogStore::Add($arStoreFields);
354 if ($newStoreId)
355 {
356 CCatalogDocs::synchronizeStockQuantity($newStoreId);
357 }
358 else
359 {
360 $strWarning .= Loc::getMessage("CAT_STORE_ACTIVE_ERROR");
362 }
363 }
364 else
365 {
366 $strWarning .= Loc::getMessage("CAT_STORE_SYNCHRONIZE_WARNING_1");
367 }
368 }
369 else
370 {
371 $strWarning .= Loc::getMessage("CAT_STORE_DEACTIVATE_NOTICE_1");
372 }
373 }
374
375 Option::set('catalog', 'default_use_store_control', $strUseStoreControl, '');
376
377 if ($strUseStoreControl == 'Y')
379 else
380 $strEnableReservation = (isset($_POST['enable_reservation']) && (string)$_POST['enable_reservation'] === 'Y' ? 'Y' : 'N');
381
382 Option::set('catalog', 'enable_reservation', $strEnableReservation, '');
383
384 CAgent::RemoveAgent('CSaleOrder::ClearProductReservedQuantity();', 'sale');
386 {
387 CAgent::AddAgent("CSaleOrder::ClearProductReservedQuantity();", "sale", "N", 86400, "", "Y");
388 }
389
391 {
392 if (Catalog\Config\Feature::isCumulativeDiscountsEnabled())
393 {
394 $strDiscSaveApply = '';
395 if (isset($_REQUEST['discsave_apply']))
396 $strDiscSaveApply = (string)$_REQUEST['discsave_apply'];
397 if ($strDiscSaveApply != '' && isset($applyDiscSaveModeList[$strDiscSaveApply]))
398 {
399 Option::set('catalog', 'discsave_apply', $strDiscSaveApply, '');
400 }
401 }
402 if (!$saleIsInstalled)
403 {
404 $discountPercent = '';
405 if (isset($_REQUEST['get_discount_percent_from_base_price']))
406 $discountPercent = (string)$_REQUEST['get_discount_percent_from_base_price'];
407 if ($discountPercent == 'Y' || $discountPercent == 'N')
408 Option::set('catalog', 'get_discount_percent_from_base_price', $discountPercent, '');
409 unset($discountPercent);
410 }
411 }
412
413 $bNeedAgent = false;
414
415 $boolFlag = true;
416 $arCurrentIBlocks = array();
417 $arNewIBlocksList = array();
418 $rsIBlocks = CIBlock::GetList(array());
419 while ($iblock = $rsIBlocks->Fetch())
420 {
421 // Current info
422 $iblock['ID'] = (int)$iblock['ID'];
423 $arIBlockItem = array();
425 $rsIBlockSites = CIBlock::GetSite($iblock['ID']);
426 while ($arIBlockSite = $rsIBlockSites->Fetch())
427 {
428 $arIBlockSitesList[] = htmlspecialcharsbx($arIBlockSite['SITE_ID']);
429 }
430
431 $strInfo = '['.$iblock['IBLOCK_TYPE_ID'].'] '.htmlspecialcharsbx($iblock['NAME']).' ('.implode(' ',$arIBlockSitesList).')';
432
433 $arIBlockItem = array(
434 'INFO' => $strInfo,
435 'ID' => $iblock['ID'],
436 'NAME' => $iblock['NAME'],
437 'SITE_ID' => $arIBlockSitesList,
438 'IBLOCK_TYPE_ID' => $iblock['IBLOCK_TYPE_ID'],
439 'CATALOG' => 'N',
440 'PRODUCT_IBLOCK_ID' => 0,
441 'SKU_PROPERTY_ID' => 0,
442 'OFFERS_IBLOCK_ID' => 0,
443 'OFFERS_PROPERTY_ID' => 0,
444 );
445 $arCurrentIBlocks[$iblock['ID']] = $arIBlockItem;
446 }
447 unset($iblock, $rsIBlocks);
449 $catalogIterator = Catalog\CatalogIblockTable::getList(array(
450 'select' => array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID', 'SKU_PROPERTY_ID', 'SUBSCRIPTION', 'YANDEX_EXPORT', 'VAT_ID')
451 ));
452 while ($arCatalog = $catalogIterator->fetch())
453 {
454 $arCatalog['IBLOCK_ID'] = (int)$arCatalog['IBLOCK_ID'];
455 if (!isset($arCurrentIBlocks[$arCatalog['IBLOCK_ID']]))
456 continue;
457 $arCatalog['PRODUCT_IBLOCK_ID'] = (int)$arCatalog['PRODUCT_IBLOCK_ID'];
458 $arCatalog['SKU_PROPERTY_ID'] = (int)$arCatalog['SKU_PROPERTY_ID'];
459 $arCatalog['VAT_ID'] = (int)$arCatalog['VAT_ID'];
460
461 $arCatalogList[$arCatalog['IBLOCK_ID']] = $arCatalog;
462
463 $arCurrentIBlocks[$arCatalog['IBLOCK_ID']]['CATALOG'] = 'Y';
464 $arCurrentIBlocks[$arCatalog['IBLOCK_ID']]['PRODUCT_IBLOCK_ID'] = $arCatalog['PRODUCT_IBLOCK_ID'];
465 $arCurrentIBlocks[$arCatalog['IBLOCK_ID']]['SKU_PROPERTY_ID'] = $arCatalog['SKU_PROPERTY_ID'];
466 if (0 < $arCatalog['PRODUCT_IBLOCK_ID'])
467 {
468 $arCurrentIBlocks[$arCatalog['PRODUCT_IBLOCK_ID']]['OFFERS_IBLOCK_ID'] = $arCatalog['IBLOCK_ID'];
469 $arCurrentIBlocks[$arCatalog['PRODUCT_IBLOCK_ID']]['OFFERS_PROPERTY_ID'] = $arCatalog['SKU_PROPERTY_ID'];
470 }
471 }
473
474 foreach ($arCurrentIBlocks as $iblock)
475 {
476 $iblockId = $iblock['ID'];
477 // From form
478 $is_cat = (
479 isset($_POST['IS_CATALOG_'.$iblockId]) && $_POST['IS_CATALOG_'.$iblockId] === 'Y'
480 ? 'Y'
481 : 'N'
482 );
483 $is_cont = (
484 isset($_POST['IS_CONTENT_'.$iblockId]) && $_POST['IS_CONTENT_'.$iblockId] === 'Y'
485 ? 'Y'
486 : 'N'
487 );
488 $yan_exp = (
489 isset($_POST['YANDEX_EXPORT_'.$iblockId]) && $_POST['YANDEX_EXPORT_'.$iblockId] === 'Y'
490 ? 'Y'
491 : 'N'
492 );
493 $cat_vat = (
494 isset($_POST['VAT_ID_'.$iblockId]) && is_string($_POST['VAT_ID_'.$iblockId])
495 ? (int)$_POST['VAT_ID_'.$iblockId]
496 : 0
497 );
498 if ($cat_vat < 0)
499 {
500 $cat_vat = 0;
501 }
502
503 $offer_name = (
504 isset($_POST['OFFERS_NAME_'.$iblockId]) && is_string($_POST['OFFERS_NAME_'.$iblockId])
505 ? trim($_POST['OFFERS_NAME_'.$iblockId])
506 : ''
507 );
508 $offer_type = (
509 isset($_POST['OFFERS_TYPE_'.$iblockId]) && is_string($_POST['OFFERS_TYPE_'.$iblockId])
510 ? trim($_POST['OFFERS_TYPE_'.$iblockId])
511 : ''
512 );
513 $offer_new_type = (
514 isset($_POST['OFFERS_NEWTYPE_'.$iblockId]) && is_string($_POST['OFFERS_NEWTYPE_'.$iblockId])
515 ? trim($_POST['OFFERS_NEWTYPE_'.$iblockId])
516 : ''
517 );
518 $flag_new_type = (
519 isset($_POST['CREATE_OFFERS_TYPE_'.$iblockId]) && $_POST['CREATE_OFFERS_TYPE_'.$iblockId] === 'Y'
520 ? 'Y'
521 : 'N'
522 );
523
524 $offers_iblock_id = (
525 isset($_POST['OFFERS_IBLOCK_ID_'.$iblockId]) && is_string($_POST['OFFERS_IBLOCK_ID_'.$iblockId])
526 ? (int)$_POST['OFFERS_IBLOCK_ID_'.$iblockId]
527 : 0
528 );
529 if ($offers_iblock_id !== CATALOG_NEW_OFFERS_IBLOCK_NEED && $offers_iblock_id < 0)
530 {
531 $offers_iblock_id = 0;
532 }
533
534 $arNewIBlockItem = array(
535 'ID' => $iblock['ID'],
536 'CATALOG' => $is_cat,
537 'SUBSCRIPTION' => $is_cont,
538 'YANDEX_EXPORT' => $yan_exp,
539 'VAT_ID' => $cat_vat,
540 'OFFERS_IBLOCK_ID' => $offers_iblock_id,
541 'OFFERS_NAME' => $offer_name,
542 'OFFERS_TYPE' => $offer_type,
543 'OFFERS_NEW_TYPE' => $offer_new_type,
544 'CREATE_OFFERS_NEW_TYPE' => $flag_new_type,
545 'NEED_IS_REQUIRED' => 'N',
546 'NEED_UPDATE' => 'N',
547 'NEED_LINK' => 'N',
548 'OFFERS_PROP' => 0,
549 );
550 $arNewIBlocksList[$iblock['ID']] = $arNewIBlockItem;
551 }
552 unset($iblockId, $iblock);
553
554 // check for offers is catalog
555 foreach ($arCurrentIBlocks as $intIBlockID => $arIBlockInfo)
556 {
557 if ((0 < $arIBlockInfo['PRODUCT_IBLOCK_ID']) && ('Y' != $arNewIBlocksList[$intIBlockID]['CATALOG']))
558 $arNewIBlocksList[$intIBlockID]['CATALOG'] = 'Y';
559 }
560 // check for double using iblock and selfmade
561 $arOffersIBlocks = array();
562 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
563 {
564 if (0 < $arIBlockInfo['OFFERS_IBLOCK_ID'])
565 {
566 // double
567 if (isset($arOffersIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]))
568 {
569 $boolFlag = false;
570 $strWarning .= Loc::getMessage(
571 'CAT_IBLOCK_OFFERS_ERR_TOO_MANY_PRODUCT_IBLOCK',
572 array('#OFFER#' => $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['INFO'])
573 ).'<br />';
574 }
575 else
576 {
577 $arOffersIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']] = true;
578 }
579 // selfmade
580 if ($arIBlockInfo['OFFERS_IBLOCK_ID'] == $intIBlockID)
581 {
582 $boolFlag = false;
583 $strWarning .= Loc::getMessage(
584 'CAT_IBLOCK_OFFERS_ERR_SELF_MADE',
585 array('#PRODUCT#' => $arCurrentIBlocks[$intIBlockID]['INFO'])
586 ).'<br />';
587 }
588 }
589 }
590 unset($arOffersIBlocks);
591 // check for rights
592 if ($boolFlag)
593 {
594 if (!$USER->IsAdmin())
595 {
596 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
597 {
598 if (CATALOG_NEW_OFFERS_IBLOCK_NEED == $arIBlockInfo['OFFERS_IBLOCK_ID'])
599 {
600 $boolFlag = false;
601 $strWarning .= Loc::getMessage(
602 'CAT_IBLOCK_OFFERS_ERR_CANNOT_CREATE_IBLOCK',
603 array('#PRODUCT#' => $arCurrentIBlocks[$intIBlockID]['INFO'])
604 ).'<br />';
605 }
606 }
607 }
608 }
609 // check for offers next offers
610 if ($boolFlag)
611 {
612 foreach ($arCurrentIBlocks as $intIBlockID => $arIBlockInfo)
613 {
614 if (0 < $arIBlockInfo['PRODUCT_IBLOCK_ID'] && 0 != $arNewIBlocksList[$intIBlockID]['OFFERS_IBLOCK_ID'])
615 {
616 $boolFlag = false;
617 $strWarning .= Loc::getMessage(
618 'CAT_IBLOCK_OFFERS_ERR_PRODUCT_AND_OFFERS',
619 array('#PRODUCT#' => $arIBlockInfo['INFO'])
620 ).'<br />';
621 }
622 }
623 }
624 // check for product as offer
625 if ($boolFlag)
626 {
627 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
628 {
629 if (0 < $arIBlockInfo['OFFERS_IBLOCK_ID'] && 0 < $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['OFFERS_IBLOCK_ID'])
630 {
631 $boolFlag = false;
632 $strWarning .= Loc::getMessage(
633 'CAT_IBLOCK_OFFERS_ERR_PRODUCT_AND_OFFERS',
634 array('#PRODUCT#' => $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['INFO'])
635 ).'<br />';
636 }
637 }
638 }
639 if ($boolFlag)
640 {
641 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
642 {
643 if (0 < $arIBlockInfo['OFFERS_IBLOCK_ID'] && 0 < $arNewIBlocksList[$arIBlockInfo['OFFERS_IBLOCK_ID']]['OFFERS_IBLOCK_ID'])
644 {
645 $boolFlag = false;
646 $strWarning .= Loc::getMessage(
647 'CAT_IBLOCK_OFFERS_ERR_PRODUCT_AND_OFFERS',
648 array('#PRODUCT#' => $arNewIBlocksList[$arIBlockInfo['OFFERS_IBLOCK_ID']]['INFO'])
649 ).'<br />';
650 }
651 }
652 }
653 if ($boolFlag)
654 {
655 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
656 {
657 if (0 < $arIBlockInfo['OFFERS_IBLOCK_ID'] && CATALOG_NEW_OFFERS_IBLOCK_NEED == $arNewIBlocksList[$arIBlockInfo['OFFERS_IBLOCK_ID']]['OFFERS_IBLOCK_ID'])
658 {
659 $boolFlag = false;
660 $strWarning .= Loc::getMessage(
661 'CAT_IBLOCK_OFFERS_ERR_PRODUCT_AND_OFFERS',
662 array('#PRODUCT#' => $arNewIBlocksList[$arIBlockInfo['OFFERS_IBLOCK_ID']]['INFO'])
663 ).'<br />';
664 }
665 }
666 }
667
668 // check name and new iblock_type
669 if ($boolFlag)
670 {
671 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
672 {
673 if (CATALOG_NEW_OFFERS_IBLOCK_NEED == $arIBlockInfo['OFFERS_IBLOCK_ID'])
674 {
675 if ('' == trim($arIBlockInfo['OFFERS_NAME']))
676 {
677 $arNewIBlocksList[$intIBlockID]['OFFERS_NAME'] = Loc::getMessage(
678 'CAT_IBLOCK_OFFERS_NAME_TEPLATE',
679 array('#PRODUCT#' => $arCurrentIBlocks[$intIBlockID]['NAME'])
680 );
681 }
682 if ('Y' == $arIBlockInfo['CREATE_OFFERS_NEW_TYPE'] && '' == trim($arIBlockInfo['OFFERS_NEW_TYPE']))
683 {
684 $arNewIBlocksList[$intIBlockID]['CREATE_OFFERS_NEW_TYPE'] = 'N';
685 $arNewIBlocksList[$intIBlockID]['OFFERS_TYPE'] = $arCurrentIBlocks[$intIBlockID]['IBLOCK_TYPE_ID'];
686 }
687 if ('N' == $arIBlockInfo['CREATE_OFFERS_NEW_TYPE'] && '' == trim($arIBlockInfo['OFFERS_TYPE']))
688 {
689 $arNewIBlocksList[$intIBlockID]['CREATE_OFFERS_NEW_TYPE'] = 'N';
690 $arNewIBlocksList[$intIBlockID]['OFFERS_TYPE'] = $arCurrentIBlocks[$intIBlockID]['IBLOCK_TYPE_ID'];
691 }
692 }
693 }
694 }
695 // check for sites
696 if ($boolFlag)
697 {
698 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
699 {
700 if (0 < $arIBlockInfo['OFFERS_IBLOCK_ID'])
701 {
702 $arDiffParent = array();
703 $arDiffParent = array_diff($arCurrentIBlocks[$intIBlockID]['SITE_ID'],$arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['SITE_ID']);
704 $arDiffOffer = array();
705 $arDiffOffer = array_diff($arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['SITE_ID'],$arCurrentIBlocks[$intIBlockID]['SITE_ID']);
706 if (!empty($arDiffParent) || !empty($arDiffOffer))
707 {
708 $boolFlag = false;
709 $strWarning .= Loc::getMessage(
710 'CAT_IBLOCK_OFFERS_ERR_SITELIST_DEFFERENT',
711 array(
712 '#PRODUCT#' => $arCurrentIBlocks[$intIBlockID]['INFO'],
713 '#OFFERS#' => $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['INFO']
714 )
715 ).'<br />';
716 }
717 }
718 }
719 }
720 // check properties
721 if ($boolFlag)
722 {
723 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
724 {
725 if (0 < $arIBlockInfo['OFFERS_IBLOCK_ID'])
726 {
727 // search properties
728 $intCountProp = 0;
729 $arLastProp = false;
730 $rsProps = CIBlockProperty::GetList(array(),array('IBLOCK_ID' => $arIBlockInfo['OFFERS_IBLOCK_ID'],'PROPERTY_TYPE' => 'E','LINK_IBLOCK_ID' => $intIBlockID,'ACTIVE' => 'Y','USER_TYPE' => 'SKU'));
731 if ($arProp = $rsProps->Fetch())
732 {
733 $intCountProp++;
734 $arLastProp = $arProp;
735 while ($arProp = $rsProps->Fetch())
736 {
737 if (false !== $arProp)
738 {
739 $arLastProp = $arProp;
740 $intCountProp++;
741 }
742 }
743 }
744 if (1 < $intCountProp)
745 {
746 // too many links for catalog
747 $boolFlag = false;
748 $strWarning .= Loc::getMessage(
749 'CAT_IBLOCK_OFFERS_ERR_TOO_MANY_LINKS',
750 array(
751 '#OFFER#' => $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['INFO'],
752 '#PRODUCT#' => $arCurrentIBlocks[$intIBlockID]['INFO']
753 )
754 ).'<br />';
755 }
756 elseif (1 == $intCountProp)
757 {
758 if ('Y' == $arLastProp['MULTIPLE'])
759 {
760 // link must single property
761 $boolFlag = false;
762 $strWarning .= Loc::getMessage(
763 'CAT_IBLOCK_OFFERS_ERR_LINKS_MULTIPLE',
764 array(
765 '#OFFER#' => $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['INFO'],
766 '#PRODUCT#' => $arCurrentIBlocks[$intIBlockID]['INFO']
767 )
768 ).'<br />';
769 }
770 elseif (('SKU' != $arLastProp['USER_TYPE']) || ('CML2_LINK' != $arLastProp['XML_ID']))
771 {
772 // link must is updated
773 $arNewIBlocksList[$intIBlockID]['NEED_UPDATE'] = 'Y';
774 $arNewIBlocksList[$intIBlockID]['OFFERS_PROP'] = $arLastProp['ID'];
775 }
776 else
777 {
778 $arNewIBlocksList[$intIBlockID]['OFFERS_PROP'] = $arLastProp['ID'];
779 }
780 }
781 elseif (0 == $intCountProp)
782 {
783 // create offers iblock
784 $arNewIBlocksList[$intIBlockID]['NEED_IS_REQUIRED'] = 'N';
785 $arNewIBlocksList[$intIBlockID]['NEED_UPDATE'] = 'Y';
786 $arNewIBlocksList[$intIBlockID]['NEED_LINK'] = 'Y';
787 }
788 }
789 }
790 }
791 // create iblock
792 $arNewOffers = array();
793 if ($boolFlag)
794 {
795 $DB->StartTransaction();
796 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
797 {
798 if (CATALOG_NEW_OFFERS_IBLOCK_NEED == $arIBlockInfo['OFFERS_IBLOCK_ID'])
799 {
800 // need new offers
801 $arResultNewCatalogItem = array();
802 if ('Y' == $arIBlockInfo['CREATE_OFFERS_NEW_TYPE'])
803 {
804 $rsIBlockTypes = CIBlockType::GetByID($arIBlockInfo['OFFERS_NEW_TYPE']);
805 if ($arIBlockType = $rsIBlockTypes->Fetch())
806 {
807 $arIBlockInfo['OFFERS_TYPE'] = $arIBlockInfo['OFFERS_NEW_TYPE'];
808 }
809 else
810 {
812 'ID' => $arIBlockInfo['OFFERS_NEW_TYPE'],
813 'SECTIONS' => 'N',
814 'IN_RSS' => 'N',
815 'SORT' => 500,
816 );
817
818 $languageIterator = Main\Localization\LanguageTable::getList(array(
819 'select' => array('ID', 'SORT'),
820 'filter' => array('=ACTIVE' => 'Y'),
821 'order' => array('SORT' => 'ASC')
822 ));
823 while ($language = $languageIterator->fetch())
824 {
825 $arFields['LANG'][$language['ID']]['NAME'] = $arIBlockInfo['OFFERS_NEW_TYPE'];
826 }
827 unset($language, $languageIterator);
828
829 $obIBlockType = new CIBlockType();
830 $mxOffersType = $obIBlockType->Add($arFields);
831 if (!$mxOffersType)
832 {
833 $boolFlag = false;
834 $strWarning .= Loc::getMessage(
835 'CAT_IBLOCK_OFFERS_ERR_NEW_IBLOCK_TYPE_NOT_ADD',
836 array(
837 '#PRODUCT#' => $arCurrentIBlocks[$intIBlockID]['INFO'],
838 '#ERROR#' => $obIBlockType->LAST_ERROR
839 )
840 ).'<br />';
841 }
842 else
843 {
844 $arIBlockInfo['OFFERS_TYPE'] = $arIBlockInfo['OFFERS_NEW_TYPE'];
845 }
846 }
847 }
848 if ($boolFlag)
849 {
850 $arParentRights = CIBlock::GetGroupPermissions($intIBlockID);
851 foreach ($arParentRights as $keyRight => $valueRight)
852 {
853 if ('U' == $valueRight)
854 {
855 $arParentRights[$keyRight] = 'W';
856 }
857 }
859 'SITE_ID' => $arCurrentIBlocks[$intIBlockID]['SITE_ID'],
860 'IBLOCK_TYPE_ID' => $arIBlockInfo['OFFERS_TYPE'],
861 'NAME' => $arIBlockInfo['OFFERS_NAME'],
862 'ACTIVE' => 'Y',
863 'GROUP_ID' => $arParentRights,
864 'WORKFLOW' => 'N',
865 'BIZPROC' => 'N',
866 "LIST_PAGE_URL" => '',
867 "SECTION_PAGE_URL" => '',
868 "DETAIL_PAGE_URL" => '#PRODUCT_URL#',
869 "INDEX_SECTION" => "N",
870 );
871 $obIBlock = new CIBlock();
872 $mxOffersID = $obIBlock->Add($arFields);
873 if ($mxOffersID === false)
874 {
875 $boolFlag = false;
876 $strWarning .= Loc::getMessage(
877 'CAT_IBLOCK_OFFERS_ERR_IBLOCK_ADD',
878 array(
879 '#PRODUCT#' => $arCurrentIBlocks[$intIBlockID]['INFO'],
880 '#ERR#' => $obIBlock->LAST_ERROR
881 )
882 ).'<br />';
883 }
884 else
885 {
886 $arResultNewCatalogItem = array(
887 'INFO' => '['.$arFields['IBLOCK_TYPE_ID'].'] '.htmlspecialcharsbx($arFields['NAME']).' ('.implode(' ',$arCurrentIBlocks[$intIBlockID]['SITE_ID']).')',
888 'SITE_ID' => $arCurrentIBlocks[$intIBlockID]['SITE_ID'],
889 'IBLOCK_TYPE_ID' => $arFields['IBLOCK_TYPE_ID'],
890 'ID' => $mxOffersID,
891 'NAME' => $arFields['NAME'],
892 'CATALOG' => 'Y',
893 'IS_CONTENT' => 'N',
894 'YANDEX_EXPORT' => 'N',
895 'VAT_ID' => 0,
896 'PRODUCT_IBLOCK_ID' => $intIBlockID,
897 'SKU_PROPERTY_ID' => 0,
898 'NEED_IS_REQUIRED' => 'N',
899 'NEED_UPDATE' => 'Y',
900 'LINK_PROP' => false,
901 'NEED_LINK' => 'Y',
902 );
904 'IBLOCK_ID' => $mxOffersID,
905 'NAME' => Loc::getMessage('CAT_IBLOCK_OFFERS_TITLE_LINK_NAME'),
906 'ACTIVE' => 'Y',
907 'PROPERTY_TYPE' => 'E',
908 'MULTIPLE' => 'N',
909 'LINK_IBLOCK_ID' => $intIBlockID,
910 'CODE' => 'CML2_LINK',
911 'XML_ID' => 'CML2_LINK',
912 "FILTRABLE" => "Y",
913 'USER_TYPE' => 'SKU',
914 );
915 $obProp = new CIBlockProperty();
916 $mxPropID = $obProp->Add($arFields);
917 if (!$mxPropID)
918 {
919 $boolFlag = false;
920 $strWarning .= Loc::getMessage(
921 'CAT_IBLOCK_OFFERS_ERR_CANNOT_CREATE_LINK',
922 array(
923 '#OFFERS#' => $arResultNewCatalogItem['INFO'],
924 '#ERR#' => $obProp->LAST_ERROR
925 )
926 ).'<br />';
927 }
928 else
929 {
930 $arResultNewCatalogItem['SKU_PROPERTY_ID'] = $mxPropID;
931 $arResultNewCatalogItem['NEED_IS_REQUIRED'] = 'N';
932 $arResultNewCatalogItem['NEED_UPDATE'] = 'N';
933 $arResultNewCatalogItem['NEED_LINK'] = 'N';
934 }
935 }
936 }
937 if ($boolFlag)
938 {
939 $arNewOffers[$mxOffersID] = $arResultNewCatalogItem;
940 }
941 else
942 {
943 break;
944 }
945 }
946 }
947 if (!$boolFlag)
948 {
949 $DB->Rollback();
950 }
951 else
952 {
953 $DB->Commit();
954 }
955 }
956 // create properties
957 if ($boolFlag)
958 {
959 $DB->StartTransaction();
960 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
961 {
962 if (0 < $arIBlockInfo['OFFERS_IBLOCK_ID'])
963 {
964 if ('Y' == $arIBlockInfo['NEED_LINK'])
965 {
967 'IBLOCK_ID' => $arIBlockInfo['OFFERS_IBLOCK_ID'],
968 'NAME' => Loc::getMessage('CAT_IBLOCK_OFFERS_TITLE_LINK_NAME'),
969 'ACTIVE' => 'Y',
970 'PROPERTY_TYPE' => 'E',
971 'MULTIPLE' => 'N',
972 'LINK_IBLOCK_ID' => $intIBlockID,
973 'CODE' => 'CML2_LINK',
974 'XML_ID' => 'CML2_LINK',
975 "FILTRABLE" => "Y",
976 'USER_TYPE' => 'SKU',
977 );
978 $obProp = new CIBlockProperty();
979 $mxPropID = $obProp->Add($arFields);
980 if (!$mxPropID)
981 {
982 $boolFlag = false;
983 $strWarning .= Loc::getMessage(
984 'CAT_IBLOCK_OFFERS_ERR_CANNOT_CREATE_LINK',
985 array(
986 '#OFFERS#' => $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['INFO'],
987 '#ERR#' => $obProp->LAST_ERROR
988 )
989 ).'<br />';
990 }
991 else
992 {
993 $arNewIBlocksList[$intIBlockID]['OFFERS_PROP'] = $mxPropID;
994 $arNewIBlocksList[$intIBlockID]['NEED_IS_REQUIRED'] = 'N';
995 $arNewIBlocksList[$intIBlockID]['NEED_UPDATE'] = 'N';
996 $arNewIBlocksList[$intIBlockID]['NEED_LINK'] = 'N';
997 }
998 }
999 elseif (0 < $arIBlockInfo['OFFERS_PROP'])
1000 {
1001 if ('Y' == $arIBlockInfo['NEED_UPDATE'])
1002 {
1003 $arPropFields = array(
1004 'USER_TYPE' => 'SKU',
1005 'XML_ID' => 'CML2_LINK',
1006 );
1007 $obProp = new CIBlockProperty();
1008 $mxPropID = $obProp->Update($arIBlockInfo['OFFERS_PROP'],$arPropFields);
1009 if (!$mxPropID)
1010 {
1011 $boolFlag = false;
1012 $strWarning .= Loc::getMessage(
1013 'CAT_IBLOCK_OFFERS_ERR_MODIFY_PROP_IS_REQ',
1014 array(
1015 '#OFFERS#' => $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['INFO'],
1016 '#ERR#' => $obProp->LAST_ERROR
1017 )
1018 ).'<br />';
1019 break;
1020 }
1021 }
1022 }
1023 }
1024 }
1025 if (!$boolFlag)
1026 {
1027 $DB->Rollback();
1028 }
1029 else
1030 {
1031 $DB->Commit();
1032 }
1033 }
1034 // reverse array
1035 if ($boolFlag)
1036 {
1037 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
1038 {
1039 $arCurrentIBlocks[$intIBlockID]['CATALOG'] = $arIBlockInfo['CATALOG'];
1040 $arCurrentIBlocks[$intIBlockID]['SUBSCRIPTION'] = $arIBlockInfo['SUBSCRIPTION'];
1041 $arCurrentIBlocks[$intIBlockID]['YANDEX_EXPORT'] = $arIBlockInfo['YANDEX_EXPORT'];
1042 $arCurrentIBlocks[$intIBlockID]['VAT_ID'] = $arIBlockInfo['VAT_ID'];
1043 }
1044 foreach ($arNewIBlocksList as $intIBlockID => $arIBlockInfo)
1045 {
1046 if (0 < $arIBlockInfo['OFFERS_IBLOCK_ID'])
1047 {
1048 $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['CATALOG'] = 'Y';
1049 $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['PRODUCT_IBLOCK_ID'] = $intIBlockID;
1050 $arCurrentIBlocks[$arIBlockInfo['OFFERS_IBLOCK_ID']]['SKU_PROPERTY_ID'] = $arIBlockInfo['OFFERS_PROP'];
1051 }
1052 }
1053 }
1054 // check old offers
1055 if ($boolFlag)
1056 {
1057 foreach ($arCurrentIBlocks as $intIBlockID => $arIBlockInfo)
1058 {
1059 if (0 < $arIBlockInfo['PRODUCT_IBLOCK_ID'])
1060 {
1061 if ($intIBlockID != $arNewIBlocksList[$arIBlockInfo['PRODUCT_IBLOCK_ID']]['OFFERS_IBLOCK_ID'])
1062 {
1063 $arCurrentIBlocks[$intIBlockID]['UNLINK'] = 'Y';
1064 }
1065 }
1066 }
1067 }
1068 // go exist iblock
1069 $boolCatalogUpdate = false;
1070 if ($boolFlag)
1071 {
1072 $DB->StartTransaction();
1073 $obCatalog = new CCatalog();
1074 foreach ($arCurrentIBlocks as $intIBlockID => $arIBlockInfo)
1075 {
1076 $boolAttr = true;
1077 if (isset($arIBlockInfo['UNLINK']) && 'Y' == $arIBlockInfo['UNLINK'])
1078 {
1079 $boolFlag = $obCatalog->UnLinkSKUIBlock($arIBlockInfo['PRODUCT_IBLOCK_ID']);
1080 if ($boolFlag)
1081 {
1082 $arIBlockInfo['PRODUCT_IBLOCK_ID'] = 0;
1083 $arIBlockInfo['SKU_PROPERTY_ID'] = 0;
1084 $boolCatalogUpdate = true;
1085 }
1086 else
1087 {
1088 $boolFlag = false;
1089 $ex = $APPLICATION->GetException();
1090 $strError = $ex->GetString();
1091 $strWarning .= Loc::getMessage(
1092 'CAT_IBLOCK_OFFERS_ERR_UNLINK_SKU',
1093 array(
1094 '#PRODUCT#' => $arIBlockInfo['INFO'],
1095 '#ERROR#' => $strError
1096 )
1097 ).'<br />';
1098 }
1099 }
1100 if ($boolFlag)
1101 {
1102 $boolExists = isset($arCatalogList[$intIBlockID]);
1103 $arCurValues = ($boolExists ? $arCatalogList[$intIBlockID] : array());
1104
1105 if ($boolExists && ('Y' == $arIBlockInfo['CATALOG'] || 'Y' == $arIBlockInfo['SUBSCRIPTION'] || 0 < $arIBlockInfo['PRODUCT_IBLOCK_ID']))
1106 {
1107 $boolAttr = $obCatalog->Update(
1109 array(
1110 'IBLOCK_ID' => $arIBlockInfo['ID'],
1111 'YANDEX_EXPORT' => $arIBlockInfo['YANDEX_EXPORT'],
1112 'SUBSCRIPTION' => $arIBlockInfo['SUBSCRIPTION'],
1113 'VAT_ID' => $arIBlockInfo['VAT_ID'],
1114 'PRODUCT_IBLOCK_ID' => $arIBlockInfo['PRODUCT_IBLOCK_ID'],
1115 'SKU_PROPERTY_ID' => $arIBlockInfo['SKU_PROPERTY_ID']
1116 )
1117 );
1118 if (!$boolAttr)
1119 {
1120 $ex = $APPLICATION->GetException();
1121 $strError = $ex->GetString();
1122 $strWarning .= Loc::getMessage(
1123 'CAT_IBLOCK_OFFERS_ERR_CAT_UPDATE',
1124 array(
1125 '#PRODUCT#' => $arIBlockInfo['INFO'],
1126 '#ERROR#' => $strError
1127 )
1128 ).'<br />';
1129 $boolFlag = false;
1130 }
1131 else
1132 {
1133 if (
1134 $arCurValues['SUBSCRIPTION'] != $arIBlockInfo['SUBSCRIPTION']
1135 || $arCurValues['PRODUCT_IBLOCK_ID'] != $arIBlockInfo['PRODUCT_IBLOCK_ID']
1136 || $arCurValues['YANDEX_EXPORT'] != $arIBlockInfo['YANDEX_EXPORT']
1137 || $arCurValues['VAT_ID'] != $arIBlockInfo['VAT_ID']
1138 )
1139 {
1140 $boolCatalogUpdate = true;
1141 }
1142 if ($arIBlockInfo['YANDEX_EXPORT']=="Y")
1143 $bNeedAgent = true;
1144 }
1145 }
1146 elseif ($boolExists && $arIBlockInfo['CATALOG']!="Y" && $arIBlockInfo['SUBSCRIPTION']!="Y" && 0 == $arIBlockInfo['PRODUCT_IBLOCK_ID'])
1147 {
1148 if (!CCatalog::Delete($arIBlockInfo['ID']))
1149 {
1150 $boolFlag = false;
1151 $strWarning .= Loc::getMessage("CAT_DEL_CATALOG1").' '.$arIBlockInfo['INFO'].' '.Loc::getMessage("CAT_DEL_CATALOG2").".<br />";
1152 }
1153 else
1154 {
1155 $boolCatalogUpdate = true;
1156 }
1157 }
1158 elseif ($arIBlockInfo['CATALOG']=="Y" || $arIBlockInfo['SUBSCRIPTION']=="Y" || 0 < $arIBlockInfo['PRODUCT_IBLOCK_ID'])
1159 {
1160 $boolAttr = $obCatalog->Add(array(
1161 'IBLOCK_ID' => $arIBlockInfo['ID'],
1162 'YANDEX_EXPORT' => $arIBlockInfo['YANDEX_EXPORT'],
1163 'SUBSCRIPTION' => $arIBlockInfo['SUBSCRIPTION'],
1164 'VAT_ID' => $arIBlockInfo['VAT_ID'],
1165 'PRODUCT_IBLOCK_ID' => $arIBlockInfo['PRODUCT_IBLOCK_ID'],
1166 'SKU_PROPERTY_ID' => $arIBlockInfo['SKU_PROPERTY_ID']
1167 ));
1168 if (!$boolAttr)
1169 {
1170 $ex = $APPLICATION->GetException();
1171 $strError = $ex->GetString();
1172 $strWarning .= str_replace(
1173 array('#PRODUCT#', '#ERROR#'),
1174 array($arIBlockInfo['INFO'], $strError),
1175 Loc::getMessage('CAT_IBLOCK_OFFERS_ERR_CAT_ADD')
1176 ).'<br />';
1177 $strWarning .= Loc::getMessage(
1178 'CAT_IBLOCK_OFFERS_ERR_CAT_ADD',
1179 array(
1180 '#PRODUCT#' => $arIBlockInfo['INFO'],
1181 '#ERROR#' => $strError
1182 )
1183 ).'<br />';
1184 $boolFlag = false;
1185 }
1186 else
1187 {
1188 if ($arIBlockInfo['YANDEX_EXPORT']=="Y") $bNeedAgent = true;
1189 $boolCatalogUpdate = true;
1190 }
1191 }
1192 }
1193 if (!$boolFlag)
1194 break;
1195 }
1196 if (!$boolFlag)
1197 {
1198 $DB->Rollback();
1199 }
1200 else
1201 {
1202 $DB->Commit();
1203 }
1204 }
1205 if ($boolFlag)
1206 {
1207 if (!empty($arNewOffers))
1208 {
1209 $DB->StartTransaction();
1210 foreach ($arNewOffers as $IntIBlockID => $arIBlockInfo)
1211 {
1212 $boolAttr = $obCatalog->Add(array('IBLOCK_ID' => $arIBlockInfo['ID'], "YANDEX_EXPORT" => $arIBlockInfo['YANDEX_EXPORT'], "SUBSCRIPTION" => $arIBlockInfo['SUBSCRIPTION'], "VAT_ID" => $arIBlockInfo['VAT_ID'], "PRODUCT_IBLOCK_ID" => $arIBlockInfo['PRODUCT_IBLOCK_ID'], 'SKU_PROPERTY_ID' => $arIBlockInfo['SKU_PROPERTY_ID']));
1213 if (!$boolAttr)
1214 {
1215 $ex = $APPLICATION->GetException();
1216 $strError = $ex->GetString();
1217 $strWarning .= Loc::getMessage(
1218 'CAT_IBLOCK_OFFERS_ERR_CAT_ADD',
1219 array(
1220 '#PRODUCT#' => $arIBlockInfo['INFO'],
1221 '#ERROR#' => $strError
1222 )
1223 ).'<br />';
1224 $boolFlag = false;
1225 break;
1226 }
1227 else
1228 {
1229 if ($arIBlockInfo['YANDEX_EXPORT']=="Y") $bNeedAgent = true;
1230 $boolCatalogUpdate = true;
1231 }
1232 }
1233 if (!$boolFlag)
1234 {
1235 $DB->Rollback();
1236 }
1237 else
1238 {
1239 $DB->Commit();
1240 }
1241 }
1242 }
1243
1244 if ($boolFlag && $boolCatalogUpdate)
1245 {
1246 $strOK .= Loc::getMessage('CAT_IBLOCK_CATALOG_SUCCESSFULLY_UPDATE').'<br />';
1247 }
1248
1249 CAgent::RemoveAgent('CCatalog::PreGenerateXML("yandex");', 'catalog');
1250 if ($bNeedAgent)
1251 {
1252 CAgent::AddAgent('CCatalog::PreGenerateXML("yandex");', 'catalog', 'N', (int)Option::get('catalog', 'yandex_xml_period')*3600);
1253 }
1254
1255 if(isset($_POST['catalog_subscribe_repeated_notify']))
1256 {
1257 $postValue = (string)$_POST['catalog_subscribe_repeated_notify'];
1258 if($postValue === 'Y' || $postValue === 'N')
1259 {
1260 Option::set('catalog', 'subscribe_repeated_notify', $postValue);
1261 }
1262 }
1263}
1264
1265if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['agent_start']) && !$bReadOnly && check_bitrix_sessid())
1266{
1267 CAgent::RemoveAgent('CCatalog::PreGenerateXML("yandex");', 'catalog');
1268 $intCount = (int)CCatalog::GetList(array(), array('YANDEX_EXPORT' => 'Y'), array());
1269 if ($intCount > 0)
1270 {
1271 CAgent::AddAgent('CCatalog::PreGenerateXML("yandex");', 'catalog', 'N', (int)Option::get('catalog', 'yandex_xml_period') * 3600);
1272 $strOK .= Loc::getMessage('CAT_YANDEX_AGENT_ADD_SUCCESS').'. ';
1273 }
1274 else
1275 {
1276 $strWarning .= Loc::getMessage('CAT_YANDEX_AGENT_ADD_NO_EXPORT').'. ';
1277 }
1278}
1279
1280if (!empty($strWarning))
1282
1283if (!empty($strOK))
1285
1287 array("DIV" => "edit5", "TAB" => Loc::getMessage("CO_TAB_5"), "ICON" => "catalog_settings", "TITLE" => Loc::getMessage("CO_TAB_5_TITLE")),
1288 array("DIV" => "edit1", "TAB" => Loc::getMessage("CO_TAB_1"), "ICON" => "catalog_settings", "TITLE" => Loc::getMessage("CO_TAB_1_TITLE")),
1289 array("DIV" => "edit2", "TAB" => Loc::getMessage("CO_TAB_2"), "ICON" => "catalog_settings", "TITLE" => Loc::getMessage("CO_TAB_2_TITLE"))
1290);
1291
1292if ($USER->IsAdmin())
1293{
1294 if (CBXFeatures::IsFeatureEnabled('SaleRecurring'))
1295 $aTabs[] = array("DIV" => "edit3", "TAB" => Loc::getMessage("CO_TAB_3"), "ICON" => "catalog_settings", "TITLE" => Loc::getMessage("CO_SALE_GROUPS"));
1296 $aTabs[] = array("DIV" => "edit4", "TAB" => Loc::getMessage("CO_TAB_RIGHTS"), "ICON" => "catalog_settings", "TITLE" => Loc::getMessage("CO_TAB_RIGHTS_TITLE"));
1297}
1298
1299$tabControl = new CAdminTabControl("tabControl", $aTabs, true, true);
1300
1302$currentSettings['discsave_apply'] = Option::get('catalog', 'discsave_apply');
1303$currentSettings['get_discount_percent_from_base_price'] = Option::get(($saleIsInstalled ? 'sale' : 'catalog'), 'get_discount_percent_from_base_price');
1304$currentSettings['save_product_with_empty_price_range'] = Option::get('catalog', 'save_product_with_empty_price_range');
1305$currentSettings['use_offer_marking_code_group'] = Option::get('catalog', 'use_offer_marking_code_group');
1306$currentSettings['default_product_vat_included'] = Option::get('catalog', 'default_product_vat_included');
1307$currentSettings['enable_processing_deprecated_events'] = Option::get('catalog', 'enable_processing_deprecated_events');
1308$currentSettings['product_card_slider_enabled'] = Option::get('catalog', 'product_card_slider_enabled');
1309$currentSettings['show_store_shipping_center'] = Option::get('catalog', 'show_store_shipping_center');
1310
1311$strShowCatalogTab = Option::get('catalog', 'show_catalog_tab_with_offers');
1312$strSaveProductWithoutPrice = Option::get('catalog', 'save_product_without_price');
1313
1314$strQuantityTrace = Option::get('catalog', 'default_quantity_trace');
1315$strAllowCanBuyZero = Option::get('catalog', 'default_can_buy_zero');
1316$strSubscribe = Option::get('catalog', 'default_subscribe');
1317
1318$strEnableReservation = Option::get('catalog', 'enable_reservation');
1319$strUseStoreControl = Option::get('catalog', 'default_use_store_control');
1320
1321$strShowOffersIBlock = Option::get('catalog', 'product_form_show_offers_iblock');
1322$strSimpleSearch = Option::get('catalog', 'product_form_simple_search');
1323$searchShowOfferName = Option::get('catalog', 'product_form_show_offer_name');
1324
1325$tabControl->Begin();
1326?>
1327<script>
1328function showReservation(show)
1329{
1330 var obRowReservationPeriod = BX('tr_reservation_period'),
1331 obReservationType = BX('td_reservation_type'),
1332 titleQuantityDecrease = '<?= CUtil::JSEscape(Loc::getMessage("CAT_PRODUCT_QUANTITY_DECREASE")); ?>',
1333 titleProductReserved = '<?= CUtil::JSEscape(Loc::getMessage("CAT_PRODUCT_RESERVED")); ?>';
1334
1335 show = !!show;
1336 if (!!obRowReservationPeriod)
1337 BX.style(obRowReservationPeriod, 'display', (show ? 'table-row' : 'none'));
1338 obRowReservationPeriod = null;
1339 if (!!obReservationType)
1340 obReservationType.innerHTML = (show ? titleProductReserved : titleQuantityDecrease);
1341 obReservationType = null;
1342}
1343
1344function onClickReservation(el)
1345{
1346 showReservation(el.checked);
1347}
1348
1349function onClickStoreControl(el)
1350{
1351 var obEnableReservation = BX('enable_reservation_y'),
1352 oldValue = '';
1353
1354 if (!obEnableReservation)
1355 {
1356 return;
1357 }
1358
1359 if (el.checked)
1360 {
1361 obEnableReservation.checked = true;
1362 }
1363 else
1364 {
1365 if (obEnableReservation.hasAttribute('data-oldvalue'))
1366 {
1367 oldValue = obEnableReservation.getAttribute('data-oldvalue');
1368 obEnableReservation.checked = (oldValue === 'Y');
1369 }
1370 }
1371 showReservation(obEnableReservation.checked);
1372 obEnableReservation.disabled = el.checked;
1373}
1374
1375function RestoreDefaults()
1376{
1377 if (confirm('<?= CUtil::JSEscape(Loc::getMessage("CAT_OPTIONS_BTN_HINT_RESTORE_DEFAULT_WARNING")); ?>'))
1378 window.location = "<?= $APPLICATION->GetCurPage(); ?>?RestoreDefaults=Y&lang=<?= LANGUAGE_ID; ?>&mid=<?= urlencode($mid); ?>&<?= bitrix_sessid_get(); ?>";
1379}
1380</script>
1381<form method="POST" action="<?= $APPLICATION->GetCurPage(); ?>?lang=<?= LANGUAGE_ID; ?>&mid=<?= htmlspecialcharsbx($mid); ?>&mid_menu=1" name="ara">
1382<?php
1383 echo bitrix_sessid_post();
1384 $tabControl->BeginNextTab();
1385 ?>
1386<tr class="heading">
1387 <td colspan="2"><?=Loc::getMessage("BX_CAT_SYSTEM_SETTINGS"); ?></td>
1388</tr>
1389<tr>
1390 <td style="width: 40%;"><label for="enable_processing_deprecated_events_y"><?=Loc::getMessage("BX_CAT_ENABLE_PROCESSING_DEPRECATED_EVENTS"); ?></label></td>
1391 <td>
1392 <input type="hidden" name="enable_processing_deprecated_events" id="enable_processing_deprecated_events_n" value="N">
1393 <input type="checkbox" name="enable_processing_deprecated_events" id="enable_processing_deprecated_events_y" value="Y"<?=($currentSettings['enable_processing_deprecated_events'] == 'Y' ? ' checked' : ''); ?>>
1394 </td>
1395</tr>
1396<tr class="heading">
1397 <td colspan="2"><?= Loc::getMessage("CAT_PRODUCT_CARD"); ?></td>
1398</tr>
1399<?php
1401{
1402 ?>
1403 <tr>
1404 <td style="width: 40%;"><label for="product_card_slider_enabled"><?= Loc::getMessage("CAT_PRODUCT_CARD_SLIDER_ENABLED"); ?></label></td>
1405 <td>
1406 <input type="hidden" name="product_card_slider_enabled" id="product_card_slider_enabled_n" value="N">
1407 <input type="checkbox" name="product_card_slider_enabled" id="product_card_slider_enabled_y" value="Y"<?=($currentSettings['product_card_slider_enabled'] == 'Y') ? ' checked' : ''?>>
1408 </td>
1409 </tr>
1410 <?php
1411}
1412?>
1413<tr>
1414 <td style="width: 40%;"><label for="save_product_without_price_y"><?= Loc::getMessage("CAT_SAVE_PRODUCTS_WITHOUT_PRICE"); ?></label></td>
1415 <td>
1416 <input type="hidden" name="save_product_without_price" id="save_product_without_price_n" value="N">
1417 <input type="checkbox" name="save_product_without_price" id="save_product_without_price_y" value="Y"<?= ($strSaveProductWithoutPrice === 'Y' ? ' checked' : ''); ?>>
1418 </td>
1419</tr>
1420<tr>
1421 <td style="width: 40%;"><label for="save_product_with_empty_price_range_y"><?= Loc::getMessage("CAT_SAVE_PRODUCT_WITH_EMPTY_PRICE_RANGE"); ?></label></td>
1422 <td>
1423 <input type="hidden" name="save_product_with_empty_price_range" id="save_product_with_empty_price_range_n" value="N">
1424 <input type="checkbox" name="save_product_with_empty_price_range" id="save_product_with_empty_price_range_y" value="Y"<?= ($currentSettings['save_product_with_empty_price_range'] === 'Y' ? ' checked' : ''); ?>>
1425 </td>
1426</tr>
1427<tr>
1428 <td style="width: 40%;">
1429 <span id="hint_show_catalog_tab_with_offers"></span> <label for="show_catalog_tab_with_offers"><?= Loc::getMessage("CAT_SHOW_CATALOG_TAB"); ?></label>
1430 </td>
1431 <td>
1432 <input type="hidden" name="show_catalog_tab_with_offers" id="show_catalog_tab_with_offers_n" value="N">
1433 <input type="checkbox" name="show_catalog_tab_with_offers" id="show_catalog_tab_with_offers_y" value="Y"<?= ($strShowCatalogTab === 'Y' ? ' checked' : ''); ?>>
1434 </td>
1435</tr>
1436<?php
1437if (Catalog\Product\SystemField\MarkingCodeGroup::isAllowed()):
1438 $check = ($currentSettings['use_offer_marking_code_group'] === 'Y' ? ' checked' : '');
1439 ?>
1440 <tr>
1441 <td style="width: 40%;">
1442 <span id="hint_use_offer_marking_code_group"></span> <label for="use_offer_marking_code_group"><?= Loc::getMessage('CAT_USE_OFFER_MARKING_CODE_GROUP'); ?></label>
1443 </td>
1444 <td>
1445 <input type="hidden" name="use_offer_marking_code_group" id="use_offer_marking_code_group_n" value="N">
1446 <input type="checkbox" name="use_offer_marking_code_group" id="use_offer_marking_code_group_y" value="Y"<?= $check; ?>>
1447 </td>
1448 </tr>
1449 <?php
1451?>
1452<tr>
1453 <td style="width: 40%;"><label for="default_product_vat_included"><?= Loc::getMessage("CAT_PRODUCT_DEFAULT_VAT_INCLUDED"); ?></label></td>
1454 <td>
1455 <input type="hidden" name="default_product_vat_included" id="default_product_vat_included_n" value="N">
1456 <input type="checkbox" name="default_product_vat_included" id="default_product_vat_included_y" value="Y"<?= ($currentSettings['default_product_vat_included'] === 'Y' ? ' checked' : ''); ?>>
1457 </td>
1458</tr>
1459<tr class="heading">
1460 <td colspan="2"><?= Loc::getMessage('CAT_PRODUCT_CARD_DEFAULT_VALUES'); ?></td>
1461</tr>
1462<tr>
1463 <td style="width: 40%;"><?= Loc::getMessage("CAT_ENABLE_QUANTITY_TRACE"); ?></td>
1464 <td>
1465 <span id="default_quantity_trace"><?= ($strQuantityTrace === 'Y' ? Loc::getMessage('CAT_PRODUCT_SETTINGS_STATUS_YES') : Loc::getMessage('CAT_PRODUCT_SETTINGS_STATUS_NO')); ?></span>
1466 </td>
1467</tr>
1468<tr>
1469 <td style="width: 40%;"><?= Loc::getMessage("CAT_ALLOW_CAN_BUY_ZERO_EXT"); ?></td>
1470 <td>
1471 <span id="default_can_buy_zero"><?= ($strAllowCanBuyZero === 'Y' ? Loc::getMessage('CAT_PRODUCT_SETTINGS_STATUS_YES') : Loc::getMessage('CAT_PRODUCT_SETTINGS_STATUS_NO')); ?></span>
1472 </td>
1473</tr>
1474<tr>
1475 <td style="width: 40%;"><?= Loc::getMessage("CAT_PRODUCT_SUBSCRIBE"); ?></td>
1476 <td>
1477 <span id="default_subscribe"><?= ($strSubscribe == 'Y' ? Loc::getMessage('CAT_PRODUCT_SETTINGS_STATUS_YES') : Loc::getMessage('CAT_PRODUCT_SETTINGS_STATUS_NO')); ?></span>
1478 </td>
1479</tr>
1480<?php
1481if (!$bReadOnly)
1482{
1483?>
1484<tr>
1485 <td style="width: 40%;">&nbsp;</td>
1486 <td>
1487 <input class="adm-btn-save" type="button" id="product_settings" value="<?= Loc::getMessage('CAT_PRODUCT_SETTINGS_CHANGE'); ?>">
1488 </td>
1489</tr>
1490<?php
1491}
1492?>
1493<tr class="heading">
1494 <td colspan="2"><?= Loc::getMessage("CAT_STORE_1"); ?></td>
1495</tr>
1496<tr id='cat_store_tr'>
1497 <td style="width: 40%;"><label for="use_store_control_y"><?= Loc::getMessage("CAT_USE_STORE_CONTROL_1"); ?></label></td>
1498 <td>
1499 <input type="hidden" name="use_store_control" id="use_store_control_n" value="N">
1500 <input type="checkbox" onclick="onClickStoreControl(this);" name="use_store_control" id="use_store_control_y" value="Y"<?= ($strUseStoreControl === 'Y' ? ' checked' : ''); ?>>
1501 </td>
1502</tr>
1503<tr>
1504 <td style="width: 40%;">
1505 <span id="hint_reservation"></span>&nbsp;<label for="enable_reservation"><?= Loc::getMessage("CAT_ENABLE_RESERVATION"); ?></label></td>
1506 <td>
1507 <input type="hidden" name="enable_reservation" id="enable_reservation_n" value="N">
1508 <input type="checkbox" onclick="onClickReservation(this);" name="enable_reservation" id="enable_reservation_y" value="Y" data-oldvalue="<?= $strEnableReservation; ?>"<?= ($strEnableReservation === 'Y' || $strUseStoreControl === 'Y' ? ' checked' : ''); ?><?= ($strUseStoreControl === 'Y' ? ' disabled' : ''); ?>>
1509 </td>
1510</tr>
1511<?php
1512if ($saleIsInstalled && Loader::includeModule('sale'))
1513{
1514 if (!(Loader::includeModule('crm') && !CCrmSaleHelper::isWithOrdersMode()))
1515 {
1516 ?>
1517 <tr>
1518 <td id="td_reservation_type"><?php
1519 echo Loc::getMessage(($strUseStoreControl == 'Y' || $strEnableReservation == 'Y' ? 'CAT_PRODUCT_RESERVED' : 'CAT_PRODUCT_QUANTITY_DECREASE'));
1520 ?></td>
1521 <td>
1522 <?php
1523 $currentReserveCondition = Sale\Configuration::getProductReservationCondition();
1524 $reserveConditions = Sale\Configuration::getReservationConditionList(true);
1525 if (isset($reserveConditions[$currentReserveCondition]))
1526 {
1527 echo htmlspecialcharsex($reserveConditions[$currentReserveCondition]);
1528 }
1529 else
1530 {
1531 echo Loc::getMessage('BX_CAT_RESERVE_CONDITION_EMPTY');
1532 }
1533 unset($reserveConditions, $currentReserveCondition);
1534 ?>&nbsp;<a href="<?= $saleSettingsUrl; ?>#section_reservation"><?= Loc::getMessage('CAT_DISCOUNT_PERCENT_FROM_BASE_SALE'); ?></a>
1535 </td>
1536 </tr>
1537 <tr id="tr_reservation_period" style="display: <?= ($strUseStoreControl === 'Y' || $strEnableReservation === 'Y' ? 'table-row' : 'none'); ?>;">
1538 <td>
1539 <?= Loc::getMessage("CAT_RESERVATION_CLEAR_PERIOD"); ?>
1540 </td>
1541 <td>
1543 </td>
1544 </tr>
1545 <?php
1546 }
1547}
1548if (!$crmInstalled)
1549{
1550 $checked = ($currentSettings['show_store_shipping_center'] === 'Y' ? ' checked' : '');
1551 ?>
1552 <td style="width: 40%;">
1553 <span id="hint_show_store_shipping_center"></span> <label for="show_store_shipping_center"><?= Loc::getMessage('CAT_SHOW_STORE_SHIPPING_CENTER'); ?></label>
1554 </td>
1555 <td>
1556 <input type="hidden" name="show_store_shipping_center" id="show_store_shipping_center_n" value="N">
1557 <input type="checkbox" name="show_store_shipping_center" id="show_store_shipping_center_y" value="Y"<?= $checked; ?>>
1558 </td>
1559 <?php
1560}
1562{
1563 if (Catalog\Config\Feature::isCumulativeDiscountsEnabled())
1564 {
1565 ?>
1566<tr class="heading">
1567 <td colspan="2"><?= Loc::getMessage("CAT_DISCOUNT"); ?></td>
1568</tr>
1569<tr>
1570 <td style="width: 40%;"><label for="discsave_apply"><?= Loc::getMessage("CAT_DISCSAVE_APPLY"); ?></label></td>
1571 <td>
1572 <select name="discsave_apply" id="discsave_apply"><?php
1573 foreach ($applyDiscSaveModeList as $applyMode => $applyTitle)
1574 {
1575 ?><option value="<?= $applyMode; ?>" <?= ($applyMode == $currentSettings['discsave_apply'] ? 'selected' : ''); ?>><?= $applyTitle; ?></option><?php
1576 }
1577 ?>
1578 </select>
1579 </td>
1580</tr>
1581<?php
1582 }
1583?>
1584<tr>
1585 <td style="width: 40%;"><?= Loc::getMessage('CAT_DISCOUNT_PERCENT_FROM_BASE_PRICE'); ?></td>
1586 <td><?php
1587 if ($saleIsInstalled)
1588 {
1589 echo (
1590 $currentSettings['get_discount_percent_from_base_price'] == 'Y'
1591 ? Loc::getMessage('CAT_DISCOUNT_PERCENT_FROM_BASE_PRICE_YES')
1592 : Loc::getMessage('CAT_DISCOUNT_PERCENT_FROM_BASE_PRICE_NO')
1593 );?>&nbsp;<a href="<?= $saleSettingsUrl; ?>#section_discount"><?= Loc::getMessage('CAT_DISCOUNT_PERCENT_FROM_BASE_SALE'); ?></a><?php
1594 }
1595 else
1596 {
1597 ?>
1598 <input type="hidden" name="get_discount_percent_from_base_price" id="get_discount_percent_from_base_price_N" value="N">
1599 <input type="checkbox" name="get_discount_percent_from_base_price" id="get_discount_percent_from_base_price_Y" value="Y"<?= ($currentSettings['get_discount_percent_from_base_price'] === 'Y' ? ' checked' : ''); ?>>
1600 <?php
1601 }
1602 ?></td>
1603
1604</tr>
1605<?php
1606}
1607$enableViewedProducts = Option::get('catalog', 'enable_viewed_products');
1608$viewedTime = (int)Option::get('catalog', 'viewed_time');
1609$viewedCount = (int)Option::get('catalog', 'viewed_count');
1610$viewedPeriod = (int)Option::get('catalog', 'viewed_period');
1611$styleViewed = ($enableViewedProducts == 'Y' ? 'table-row' : 'none');
1612?>
1613<tr class="heading">
1614 <td colspan="2"><?= Loc::getMessage("CAT_VIEWED_PRODUCTS_TITLE"); ?></td>
1615</tr>
1616<tr>
1617 <td style="width: 40%"><?= Loc::getMessage('CAT_ENABLE_VIEWED_PRODUCTS'); ?></td>
1618 <td>
1619 <input type="hidden" name="enable_viewed_products" id="enable_viewed_products_n" value="N">
1620 <input type="checkbox" name="enable_viewed_products" id="enable_viewed_products_y" value="Y" <?= ($enableViewedProducts === 'Y' ? ' checked' : ''); ?>>
1621 </td>
1622</tr>
1623<tr id="tr_viewed_time" style="display: <?=$styleViewed; ?>;">
1624 <td style="width: 40%;"><label for="viewed_time"><?= Loc::getMessage("CAT_VIEWED_TIME"); ?></label></td>
1625 <td>
1626 <input type="text" name="viewed_time" id="viewed_time" value="<?=$viewedTime; ?>" size="10">
1627 </td>
1628</tr>
1629<tr id="tr_viewed_count" style="display: <?=$styleViewed; ?>;">
1630 <td style="width: 40%;"><label for="viewed_count"><?= Loc::getMessage("CAT_VIEWED_COUNT"); ?></label></td>
1631 <td>
1632 <input type="text" name="viewed_count" id="viewed_count" value="<?=$viewedCount; ?>" size="10">
1633 </td>
1634</tr>
1635<tr id="tr_viewed_period" style="display: <?=$styleViewed; ?>;">
1636 <td style="width: 40%;"><label for="viewed_period"><?= Loc::getMessage("CAT_VIEWED_PERIOD"); ?></label></td>
1637 <td>
1638 <input type="text" name="viewed_period" id="viewed_period" value="<?=$viewedPeriod; ?>" size="10">
1639 </td>
1640</tr>
1641<tr class="heading">
1642 <td colspan="2"><?= Loc::getMessage("CAT_PRODUCT_FORM_SETTINGS"); ?></td>
1643</tr>
1644<tr>
1645 <td style="width: 40%;"><?= Loc::getMessage('CAT_SHOW_OFFERS_IBLOCK'); ?></td>
1646 <td>
1647 <input type="hidden" name="product_form_show_offers_iblock" id="product_form_show_offers_iblock_n" value="N">
1648 <input type="checkbox" name="product_form_show_offers_iblock" id="product_form_show_offers_iblock_y" value="Y" <?= ($strShowOffersIBlock === 'Y' ? ' checked' : ''); ?>>
1649 </td>
1650</tr>
1651<tr>
1652 <td style="width: 40%;"><?= Loc::getMessage('CAT_SIMPLE_SEARCH'); ?></td>
1653 <td>
1654 <input type="hidden" name="product_form_simple_search" id="product_form_simple_search_n" value="N">
1655 <input type="checkbox" name="product_form_simple_search" id="product_form_simple_search_y" value="Y" <?= ($strSimpleSearch === 'Y' ? ' checked' : ''); ?>>
1656 </td>
1657</tr>
1658<tr>
1659 <td style="width: 40%;"><?= Loc::getMessage('CAT_SHOW_OFFERS_NAME'); ?></td>
1660 <td>
1661 <input type="hidden" name="product_form_show_offer_name" id="product_form_show_offer_name_n" value="N">
1662 <input type="checkbox" name="product_form_show_offer_name" id="product_form_show_offer_name_y" value="Y" <?= ($searchShowOfferName === 'Y' ? ' checked' : ''); ?>>
1663 </td>
1664</tr>
1665<tr class="heading">
1666 <td colspan="2"><?= Loc::getMessage("CAT_PRODUCT_SUBSCRIBE_TITLE"); ?></td>
1667</tr>
1668<tr>
1669 <td style="width: 40%;"><?= Loc::getMessage('CAT_PRODUCT_SUBSCRIBE_LABLE_REPEATED_NOTIFY'); ?></td>
1670 <td>
1671 <input type="hidden" name="catalog_subscribe_repeated_notify" value="N">
1672 <input type="checkbox" name="catalog_subscribe_repeated_notify" value="Y"
1673 <?= (Option::get('catalog', 'subscribe_repeated_notify') === 'Y' ? ' checked' : ''); ?>>
1674 </td>
1675</tr>
1676<?php
1677 $tabControl->BeginNextTab();
1678?>
1679<tr class="heading">
1680 <td colspan="2"><?= Loc::getMessage("CAT_COMMON_EXPIMP_SETTINGS"); ?></td>
1681</tr><?php
1682for ($i = 0, $intCount = count($arAllOptions); $i < $intCount; $i++)
1683{
1685 $val = Option::get('catalog', $Option[0], $Option[2]);
1686 $type = $Option[3];
1687 ?>
1688 <tr>
1689 <td style="width: 40%;"><?= ($type[0] === 'checkbox' ? '<label for="'.htmlspecialcharsbx($Option[0]).'">'.$Option[1].'</label>' : $Option[1]); ?></td>
1690 <td>
1691 <?php
1692 if ($Option[0] == 'export_default_path')
1693 {
1695 (
1696 array(
1697 "event" => "BtnClickExpPath",
1698 "arResultDest" => array("FORM_NAME" => "ara", "FORM_ELEMENT_NAME" => $Option[0]),
1699 "arPath" => array("PATH" => GetDirPath($val)),
1700 "select" => 'D',// F - file only, D - folder only
1701 "operation" => 'O',// O - open, S - save
1702 "showUploadTab" => false,
1703 "showAddToMenuTab" => false,
1704 "fileFilter" => '',
1705 "allowAllFiles" => true,
1706 "SaveConfig" => true,
1707 )
1708 );
1709 ?><input type="text" name="<?= htmlspecialcharsbx($Option[0]); ?>" size="50" maxlength="255" value="<?= htmlspecialcharsbx($val); ?>">&nbsp;<input type="button" name="browseExpPath" value="..." onClick="BtnClickExpPath()"><?php
1710 }
1711 else
1712 {
1713 if ($type[0] === 'checkbox'):
1714 ?>
1715 <input type="checkbox" name="<?= htmlspecialcharsbx($Option[0]); ?>" id="<?= htmlspecialcharsbx($Option[0]);?>" value="Y"<?= ($val === 'Y' ? ' checked' : ''); ?>>
1716 <?php
1717 elseif ($type[0] === 'text'):
1718 ?>
1719 <input type="text" size="<?= $type[1]; ?>" maxlength="255" value="<?= htmlspecialcharsbx($val); ?>" name="<?= htmlspecialcharsbx($Option[0]); ?>">
1720 <?php
1721 elseif ($type[0] === 'textarea'):
1722 ?>
1723 <textarea rows="<?= $type[1]; ?>" cols="<?= $type[2]; ?>" name="<?= htmlspecialcharsbx($Option[0]); ?>"><?= htmlspecialcharsbx($val); ?></textarea>
1724 <?php
1725 endif;
1726 }
1727 ?>
1728 </td>
1729 </tr>
1730<?php
1731}
1732?>
1733<tr>
1734 <td style="width: 40%;"><?=Loc::getMessage("CAT_DEF_OUTFILE")?></td>
1735 <td>
1736 <?php
1737 $default_outfile_action = Option::get('catalog', 'default_outfile_action');
1738 ?>
1739 <select name="default_outfile_action">
1740 <option value="D"<?= ($default_outfile_action === 'D' || $default_outfile_action === '' ? ' selected' : ''); ?>><?= Loc::getMessage("CAT_DEF_OUTFILE_D") ?></option>
1741 <option value="H"<?= ($default_outfile_action === 'H' ? ' selected' : ''); ?>><?=Loc::getMessage("CAT_DEF_OUTFILE_H")?></option>
1742 <option value="F"<?= ($default_outfile_action === 'F' ? ' selected' : ''); ?>><?= Loc::getMessage("CAT_DEF_OUTFILE_F"); ?></option>
1743 </select>
1744 </td>
1745</tr>
1746
1747<?php
1749{
1750 ?>
1751 <tr>
1752 <td style="width: 40%;">
1753 <?php
1754 $yandex_agent_file = Option::get('catalog', 'yandex_agent_file');
1756 (
1757 Array(
1758 "event" => "BtnClick",
1759 "arResultDest" => array("FORM_NAME" => "ara", "FORM_ELEMENT_NAME" => "yandex_agent_file"),
1760 "arPath" => array("PATH" => GetDirPath($yandex_agent_file)),
1761 "select" => 'F',// F - file only, D - folder only
1762 "operation" => 'O',// O - open, S - save
1763 "showUploadTab" => true,
1764 "showAddToMenuTab" => false,
1765 "fileFilter" => 'php',
1766 "allowAllFiles" => true,
1767 "SaveConfig" => true,
1768 )
1769 );
1770
1771 echo Loc::getMessage("CAT_YANDEX_CUSTOM_AGENT_FILE")?></td>
1772 <td><input type="text" name="yandex_agent_file" size="50" maxlength="255" value="<?= $yandex_agent_file; ?>">&nbsp;<input type="button" name="browse" value="..." onClick="BtnClick()"></td>
1773 </tr>
1774 <?php
1775}
1776?>
1777
1778<tr class="heading">
1779 <td colspan="2"><?= Loc::getMessage("CO_PAR_IE_CSV"); ?></td>
1780</tr>
1781<tr>
1782 <td style="width: 40%; vertical-align: top;"><?= Loc::getMessage("CO_PAR_DPP_CSV"); ?></td>
1783 <td style="vertical-align: top;">
1784<?php
1786$strVal = Option::get('catalog', 'allowed_product_fields');
1787if ($strVal != '')
1788{
1789 $arVal = array_fill_keys(explode(',', $strVal), true);
1790}
1791$productFields = array_merge(
1794);
1795?><select name="allowed_product_fields[]" multiple size="8"><?php
1796foreach ($productFields as &$oneField)
1797{
1798 ?><option value="<?= htmlspecialcharsbx($oneField['value']); ?>"<?= (isset($arVal[$oneField['value']]) ? ' selected' : ''); ?>><?= htmlspecialcharsex($oneField['name']); ?></option><?php
1799}
1800if (isset($oneField))
1801 unset($oneField);
1802unset($productFields);
1803?></select>
1804 </td>
1805</tr>
1806<tr>
1807 <td style="width: 40%; vertical-align: top;"><?= Loc::getMessage("CO_AVAIL_PRICE_FIELDS"); ?></td>
1808 <td style="vertical-align: top;">
1809<?php
1810$arVal = array();
1811$strVal = Option::get('catalog', 'allowed_price_fields');
1812if ($strVal != '')
1813{
1814 $arVal = array_fill_keys(explode(',', $strVal), true);
1815}
1816?><select name="allowed_price_fields[]" multiple size="5"><?php
1818foreach ($priceFields as $oneField)
1819{
1820 ?><option value="<?=htmlspecialcharsbx($oneField['value']); ?>"<?=(isset($arVal[$oneField['value']]) ? ' selected' : ''); ?>><?=htmlspecialcharsex($oneField['name']); ?></option><?php
1821}
1823foreach ($priceFields as $oneField)
1824{
1825 ?><option value="<?=htmlspecialcharsbx($oneField['value']); ?>"<?=(isset($arVal[$oneField['value']]) ? ' selected' : ''); ?>><?=htmlspecialcharsex($oneField['name']); ?></option><?php
1826}
1827unset($oneField, $priceFields);
1828?></select>
1829 </td>
1830</tr>
1831<tr>
1832 <td style="width: 40%;"><?= Loc::getMessage("CAT_NUM_CATALOG_LEVELS"); ?></td>
1833 <td><?php
1834 $strVal = (int)Option::get('catalog', 'num_catalog_levels');
1835 ?><input type="text" size="5" maxlength="5" value="<?= $strVal; ?>" name="num_catalog_levels">
1836 </td>
1837</tr>
1838<tr>
1839 <td style="width: 40%; vertical-align: top;"><?= Loc::getMessage("CO_PAR_DPG_CSV"); ?></td>
1840 <td>
1841<?php
1842$arVal = array();
1843$strVal = Option::get('catalog', 'allowed_group_fields');
1844if ($strVal != '')
1845{
1846 $arVal = array_fill_keys(explode(',', $strVal), true);
1847}
1849?><select name="allowed_group_fields[]" multiple size="9"><?php
1850foreach ($sectionFields as $oneField)
1851{
1852 ?><option value="<?= htmlspecialcharsbx($oneField['value']); ?>"<?= (isset($arVal[$oneField['value']]) ? ' selected' : ''); ?>><?= htmlspecialcharsex($oneField['name']); ?></option><?php
1853}
1854if (isset($oneField))
1855 unset($oneField);
1856unset($sectionFields);
1857?></select>
1858 </td>
1859</tr>
1860<tr>
1861 <td style="width: 40%; vertical-align: top;"><?= Loc::getMessage("CO_PAR_DV1_CSV"); ?></td>
1862 <td style="vertical-align: top;">
1863<?php
1864$arVal = array();
1865$strVal = Option::get('catalog', 'allowed_currencies');
1866if ($strVal != '')
1867{
1868 $arVal = array_fill_keys(explode(',', $strVal), true);
1869}
1870?><select name="allowed_currencies[]" multiple size="5"><?php
1871foreach (Currency\CurrencyManager::getCurrencyList() as $currencyId => $currencyName)
1872{
1873 ?><option value="<?=htmlspecialcharsbx($currencyId); ?>"<?=(isset($arVal[$currencyId]) ? ' selected' : ''); ?>><?php
1874 echo htmlspecialcharsbx($currencyName);
1875 ?></option><?php
1876}
1877?></select>
1878 </td>
1879</tr>
1880<?php
1881$tabControl->BeginNextTab();
1883
1886
1888
1891
1892$rsIBlocks = CIBlock::GetList(array('IBLOCK_TYPE' => 'ASC','ID' => 'ASC'));
1893while ($arIBlock = $rsIBlocks->Fetch())
1894{
1895 $arIBlock['ID'] = (int)$arIBlock['ID'];
1896 if (!isset($arIBlockSitesList[$arIBlock['ID']]))
1897 {
1898 $arLIDList = array();
1899 $arWithLinks = array();
1900 $arWithoutLinks = array();
1901 $rsIBlockSites = CIBlock::GetSite($arIBlock['ID']);
1902 while ($arIBlockSite = $rsIBlockSites->Fetch())
1903 {
1904 $arLIDList[] = $arIBlockSite['LID'];
1905 $arWithLinks[] = '<a href="/bitrix/admin/site_edit.php?LID='.urlencode($arIBlockSite['LID']).'&lang='.LANGUAGE_ID.'" title="'.Loc::getMessage("CO_SITE_ALT").'">'.htmlspecialcharsbx($arIBlockSite["LID"]).'</a>';
1906 $arWithoutLinks[] = htmlspecialcharsbx($arIBlockSite['LID']);
1907 }
1909 'SITE_ID' => $arLIDList,
1910 'WITH_LINKS' => implode('&nbsp;',$arWithLinks),
1911 'WITHOUT_LINKS' => implode(' ',$arWithoutLinks),
1912 );
1913 }
1914 $arIBlockItem = array(
1915 'ID' => $arIBlock['ID'],
1916 'IBLOCK_TYPE_ID' => $arIBlock['IBLOCK_TYPE_ID'],
1917 'SITE_ID' => $arIBlockSitesList[$arIBlock['ID']]['SITE_ID'],
1918 'NAME' => htmlspecialcharsbx($arIBlock['NAME']),
1919 'ACTIVE' => $arIBlock['ACTIVE'],
1920 'FULL_NAME' => '['.$arIBlock['IBLOCK_TYPE_ID'].'] '.htmlspecialcharsbx($arIBlock['NAME']).' ('.$arIBlockSitesList[$arIBlock['ID']]['WITHOUT_LINKS'].')',
1921 'IS_CATALOG' => 'N',
1922 'IS_CONTENT' => 'N',
1923 'YANDEX_EXPORT' => 'N',
1924 'VAT_ID' => 0,
1925 'PRODUCT_IBLOCK_ID' => 0,
1926 'SKU_PROPERTY_ID' => 0,
1927 'OFFERS_IBLOCK_ID' => 0,
1928 'IS_OFFERS' => 'N',
1929 'OFFERS_PROPERTY_ID' => 0
1930 );
1931 $arIBlockFullInfo[$arIBlock['ID']] = $arIBlockItem;
1932}
1933
1934$catalogIterator = Catalog\CatalogIblockTable::getList(array(
1935 'select' => array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID', 'SKU_PROPERTY_ID', 'SUBSCRIPTION', 'YANDEX_EXPORT', 'VAT_ID')
1936));
1937while ($arOneCatalog = $catalogIterator->fetch())
1938{
1939 $arOneCatalog['IBLOCK_ID'] = (int)$arOneCatalog['IBLOCK_ID'];
1940 if (!isset($arIBlockFullInfo[$arOneCatalog['IBLOCK_ID']]))
1941 continue;
1942
1943 $arOneCatalog['VAT_ID'] = (int)$arOneCatalog['VAT_ID'];
1944 $arOneCatalog['PRODUCT_IBLOCK_ID'] = (int)$arOneCatalog['PRODUCT_IBLOCK_ID'];
1945 $arOneCatalog['SKU_PROPERTY_ID'] = (int)$arOneCatalog['SKU_PROPERTY_ID'];
1946
1947 if (!CBXFeatures::IsFeatureEnabled('SaleRecurring') && 'Y' == $arOneCatalog['SUBSCRIPTION'])
1948 {
1949 $arRecurring[] = '['.$arIBlockItem['ID'].'] '.$arIBlockItem['NAME'];
1950 $arRecurringKey[$arIBlockItem['ID']] = true;
1951 }
1952
1953 $arIBlock = $arIBlockFullInfo[$arOneCatalog['IBLOCK_ID']];
1954 $arIBlock['IS_CATALOG'] = 'Y';
1955 $arIBlock['IS_CONTENT'] = (CBXFeatures::IsFeatureEnabled('SaleRecurring') ? $arOneCatalog['SUBSCRIPTION'] : 'N');
1956 $arIBlock['YANDEX_EXPORT'] = $arOneCatalog['YANDEX_EXPORT'];
1957 $arIBlock['VAT_ID'] = $arOneCatalog['VAT_ID'];
1958 $arIBlock['PRODUCT_IBLOCK_ID'] = $arOneCatalog['PRODUCT_IBLOCK_ID'];
1959 $arIBlock['SKU_PROPERTY_ID'] = $arOneCatalog['SKU_PROPERTY_ID'];
1960 if (0 < $arOneCatalog['PRODUCT_IBLOCK_ID'])
1961 {
1962 $arIBlock['IS_OFFERS'] = 'Y';
1963 $arOwnBlock = $arIBlockFullInfo[$arOneCatalog['PRODUCT_IBLOCK_ID']];
1964 $arOwnBlock['OFFERS_IBLOCK_ID'] = $arOneCatalog['IBLOCK_ID'];
1965 $arOwnBlock['OFFERS_PROPERTY_ID'] = $arOneCatalog['SKU_PROPERTY_ID'];
1966 $arIBlockFullInfo[$arOneCatalog['PRODUCT_IBLOCK_ID']] = $arOwnBlock;
1967 unset($arOwnBlock);
1968 }
1969 $arIBlockFullInfo[$arOneCatalog['IBLOCK_ID']] = $arIBlock;
1970 if ('Y' == $arIBlock['IS_CATALOG'])
1971 $arCatalogList[$arOneCatalog['IBLOCK_ID']] = $arIBlock;
1972 unset($arIBlock);
1973}
1975
1978$rsIBlockTypes = CIBlockType::GetList(array("sort"=>"asc"), array("ACTIVE"=>"Y"));
1979while ($arIBlockType = $rsIBlockTypes->Fetch())
1980{
1981 if ($ar = CIBlockType::GetByIDLang($arIBlockType["ID"], LANGUAGE_ID, true))
1982 {
1983 $arIBlockTypeIDList[] = htmlspecialcharsbx($arIBlockType["ID"]);
1984 $arIBlockTypeNameList[] = htmlspecialcharsbx('['.$arIBlockType["ID"].'] '.$ar["~NAME"]);
1985 }
1986}
1987
1989?>
1990<tr><td><?php
1991if (!empty($arRecurring))
1992{
1993 $strRecurring = Loc::getMessage('SMALL_BUSINESS_RECURRING_ERR_LIST').'<ul><li>'.implode('</li><li>', $arRecurring).'</li></ul>'.Loc::getMessage('SMALL_BUSINESS_RECURRING_ERR_LIST_CLEAR');
1995 "MESSAGE" => Loc::getMessage("SMALL_BUSINESS_RECURRING_ERR"),
1996 "DETAILS" => $strRecurring,
1997 "HTML" => true,
1998 "TYPE" => "ERROR",
1999 ));
2000}
2001
2002/*define('B_ADMIN_IBLOCK_CATALOGS', 1);
2003define('B_ADMIN_IBLOCK_CATALOGS_LIST', false);
2004$readOnly = false;
2005require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/catalog/tools/iblock_catalog_list.php'); */
2006
2007?>
2008<script>
2009function ib_checkFldActivity(id, flag)
2010{
2011 var Cat = BX('IS_CATALOG_' + id + '_Y');
2012 var Cont = BX('IS_CONTENT_' + id + '_Y');
2013 var Yand = BX('YANDEX_EXPORT_' + id + '_Y');
2014 var Vat = BX('VAT_ID_' + id);
2015
2016 if (flag == 0)
2017 {
2018 if (!!Cat && !!Cont)
2019 {
2020 if (!Cat.checked)
2021 Cont.checked = false;
2022 }
2023 }
2024
2025 if (flag == 1)
2026 {
2027 if (!!Cat && !!Cont)
2028 {
2029 if (Cont.checked)
2030 Cat.checked = true;
2031 }
2032 }
2033
2034 var bActive = Cat.checked;
2035 if (!!Yand)
2036 Yand.disabled = !bActive;
2037 if (!!Vat)
2038 Vat.disabled = !bActive;
2039}
2040
2041function show_add_offers(id, obj)
2042{
2043 var value = obj.options[obj.selectedIndex].value;
2044 var add_form = document.getElementById('offers_add_info_'+id);
2045 if (undefined !== add_form)
2046 {
2047 if (<?= CATALOG_NEW_OFFERS_IBLOCK_NEED; ?> == value)
2048 {
2049 add_form.style.display = 'block';
2050 }
2051 else
2052 {
2053 add_form.style.display = 'none';
2054 }
2055 }
2056}
2057function change_offers_ibtype(obj,ID)
2058{
2059 var value = obj.value;
2060 if ('Y' === value)
2061 {
2062 document.forms.ara['OFFERS_TYPE_' + ID].disabled = true;
2063 document.forms.ara['OFFERS_NEWTYPE_' + ID].disabled = false;
2064 }
2065 else if ('N' === value)
2066 {
2067 document.forms.ara['OFFERS_TYPE_' + ID].disabled = false;
2068 document.forms.ara['OFFERS_NEWTYPE_' + ID].disabled = true;
2069 }
2070}
2071</script>
2072<table width="100%" cellspacing="0" cellpadding="0" border="0" class="internal">
2073 <tr class="heading">
2074 <td><?=Loc::getMessage("CAT_IBLOCK_SELECT_NAME")?></td>
2075 <td><?=Loc::getMessage("CAT_IBLOCK_SELECT_CAT")?></td>
2076 <td><?=Loc::getMessage("CAT_IBLOCK_SELECT_OFFERS")?></td><?php
2077 if (CBXFeatures::IsFeatureEnabled('SaleRecurring'))
2078 {
2079 ?><td><?=Loc::getMessage("CO_SALE_CONTENT") ?></td><?php
2080 }
2081 ?>
2082
2083 <?php if ($canUseYandexMarket): ?>
2084 <td><?=Loc::getMessage("CAT_IBLOCK_SELECT_YANDEX_EXPORT")?></td>
2085 <?php endif; ?>
2086
2087 <td><?=Loc::getMessage("CAT_IBLOCK_SELECT_VAT")?></td>
2088 </tr>
2089 <?php
2090 foreach ($arIBlockFullInfo as $res)
2091 {
2092 ?>
2093 <tr>
2094 <td>[<a title="<?= Loc::getMessage("CO_IB_TYPE_ALT"); ?>" href="/bitrix/admin/iblock_admin.php?type=<?= urlencode($res["IBLOCK_TYPE_ID"]); ?>&lang=<?= LANGUAGE_ID; ?>&admin=Y"><?= $res["IBLOCK_TYPE_ID"]; ?></a>]
2095 &nbsp;[<?= $res["ID"]; ?>] <a title="<?= Loc::getMessage("CO_IB_ELEM_ALT"); ?>" href="<?= CIBlock::GetAdminElementListLink($res["ID"], array('find_section_section' => '0', 'admin' => 'Y')); ?>"><?= $res["NAME"]; ?></a> (<?= $arIBlockSitesList[$res['ID']]['WITH_LINKS']; ?>)
2096 <input type="hidden" name="IS_OFFERS_<?= $res["ID"]; ?>" value="<?= $res['IS_OFFERS']; ?>" />
2097 </td>
2098 <td style="text-align: center;"><input type="hidden" name="IS_CATALOG_<?= $res["ID"]; ?>" id="IS_CATALOG_<?= $res["ID"]; ?>_N" value="N"><input type="checkbox" name="IS_CATALOG_<?= $res["ID"]; ?>" id="IS_CATALOG_<?= $res["ID"]; ?>_Y" onclick="ib_checkFldActivity('<?=$res['ID']?>', 0)"<?= ('Y' == $res['IS_CATALOG'] ? ' checked="checked"' : ''); ?><?= ('Y' == $res['IS_OFFERS'] ? ' disabled="disabled"' : ''); ?>value="Y" /></td>
2099 <td style="text-align: center;"><select id="OFFERS_IBLOCK_ID_<?= $res["ID"]; ?>" name="OFFERS_IBLOCK_ID_<?= $res["ID"]; ?>" class="typeselect" <?= ('Y' == $res['IS_OFFERS'] ? 'disabled="disabled"' : 'onchange="show_add_offers('.$res["ID"].',this);"'); ?> style="width: 100%;">
2100 <option value="0" <?= (0 == $res['OFFERS_IBLOCK_ID'] ? 'selected' : ''); ?>><?= Loc::getMessage('CAT_IBLOCK_OFFERS_EMPTY'); ?></option>
2101 <?php
2102 if ('Y' != $res['IS_OFFERS'])
2103 {
2104 if ($USER->IsAdmin())
2105 {
2106 ?><option value="<?= CATALOG_NEW_OFFERS_IBLOCK_NEED; ?>"><?= Loc::getMessage('CAT_IBLOCK_OFFERS_NEW')?></option><?php
2107 }
2108 foreach ($arDoubleIBlockFullInfo as $value)
2109 {
2110 if ($value['ID'] != $res['OFFERS_IBLOCK_ID'])
2111 {
2112 if (
2113 ('Y' != $value['IS_CATALOG'])
2114 || ('N' == $value['ACTIVE'])
2115 || ('Y' == $value['IS_OFFERS'])
2116 || (0 < $value['OFFERS_IBLOCK_ID'])
2117 || ($res['ID'] == $value['ID'])
2118 || (0 < $value['PRODUCT_IBLOCK_ID'])
2119 )
2120 {
2121 continue;
2122 }
2123 else
2124 {
2125 $arDiffParent = array();
2126 $arDiffParent = array_diff($value['SITE_ID'],$res['SITE_ID']);
2127 $arDiffOffer = array();
2128 $arDiffOffer = array_diff($res['SITE_ID'],$value['SITE_ID']);
2129 if (!empty($arDiffParent) || !empty($arDiffOffer))
2130 {
2131 continue;
2132 }
2133 }
2134 }
2135 ?><option value="<?= (int)$value['ID']; ?>"<?= ($value['ID'] == $res['OFFERS_IBLOCK_ID'] ? ' selected' : ''); ?>><?= $value['FULL_NAME']; ?></option><?php
2136 }
2137 if (isset($value))
2138 unset($value);
2139 }
2140 ?>
2141 </select>
2142 <div id="offers_add_info_<?= $res["ID"]; ?>" style="display: none; width: 98%; margin: 0 1%;"><table class="internal" style="width: 100%;"><tbody>
2143 <tr><td style="text-align: right; width: 25%;"><?= Loc::getMessage('CAT_IBLOCK_OFFERS_TITLE'); ?>:</td><td style="text-align: left; width: 75%;"><input type="text" name="OFFERS_NAME_<?= $res["ID"]; ?>" value="" style="width: 98%; margin: 0 1%;" /></td></tr>
2144 <tr><td style="text-align: left; width: 100%;" colspan="2"><input type="radio" value="N" id="CREATE_OFFERS_TYPE_N_<?= $res["ID"]; ?>" name="CREATE_OFFERS_TYPE_<?= $res["ID"]; ?>" checked="checked" onclick="change_offers_ibtype(this,<?= $res["ID"]; ?>);"><label for="CREATE_OFFERS_TYPE_N_<?= $res["ID"]; ?>"><?= Loc::getMessage('CAT_IBLOCK_OFFERS_OLD_IBTYPE'); ?></label></td></tr>
2145 <tr><td style="text-align: right; width: 25%;"><?= Loc::getMessage('CAT_IBLOCK_OFFERS_TYPE'); ?>:</td><td style="text-align: left; width: 75%;"><?= SelectBoxFromArray('OFFERS_TYPE_'.$res["ID"],array('REFERENCE' => $arIBlockTypeNameList,'REFERENCE_ID' => $arIBlockTypeIDList),'','','style="width: 98%; margin: 0 1%;"'); ?></td></tr>
2146 <tr><td style="text-align: left; width: 100%;" colspan="2"><input type="radio" value="Y" id="CREATE_OFFERS_TYPE_Y_<?= $res["ID"]; ?>" name="CREATE_OFFERS_TYPE_<?= $res["ID"]; ?>" onclick="change_offers_ibtype(this,<?= $res["ID"]; ?>);"><label for="CREATE_OFFERS_TYPE_Y_<?= $res["ID"]; ?>"><?= Loc::getMessage('CAT_IBLOCK_OFFERS_NEW_IBTYPE'); ?></label></td></tr>
2147 <tr><td style="text-align: right; width: 25%;"><?= Loc::getMessage('CAT_IBLOCK_OFFERS_NEWTYPE'); ?>:</td><td style="text-align: left; width: 75%;"><input type="text" name="OFFERS_NEWTYPE_<?= $res["ID"]; ?>" value="" style="width: 98%; margin: 0 1%;" disabled="disabled" /></td></tr>
2148 </tbody></table></div></td><?php
2149 if (CBXFeatures::IsFeatureEnabled('SaleRecurring'))
2150 {
2151 ?><td style="text-align: center;"><input type="hidden" name="IS_CONTENT_<?= $res["ID"]; ?>" id="IS_CONTENT_<?= $res["ID"]; ?>_N" value="N"><input type="checkbox" name="IS_CONTENT_<?= $res["ID"]; ?>" id="IS_CONTENT_<?= $res["ID"]; ?>_Y" onclick="ib_checkFldActivity('<?=$res['ID']?>', 1)"<?= ($res["IS_CONTENT"] === 'Y' ? ' checked' : ''); ?> value="Y" /></td><?php
2152 }
2153 else
2154 {
2155 ?><input type="hidden" name="IS_CONTENT_<?= $res["ID"]; ?>" value="N" id="IS_CONTENT_<?= $res["ID"]; ?>_N"><?php
2156 }
2157 ?>
2158
2159 <?php if ($canUseYandexMarket): ?>
2160 <td style="text-align: center;">
2161 <input type="hidden" name="YANDEX_EXPORT_<?= $res["ID"]; ?>" id="YANDEX_EXPORT_<?= $res["ID"]; ?>_N">
2162 <input type="checkbox" name="YANDEX_EXPORT_<?= $res["ID"]; ?>" id="YANDEX_EXPORT_<?= $res["ID"]; ?>_Y"<?= ($res['IS_CATALOG'] === 'N' ? ' disabled="disabled"' : ''); ?><?= ($res["YANDEX_EXPORT"] === 'Y' ? ' checked' : ''); ?> value="Y" />
2163 </td>
2164 <?php else: ?>
2165 <input type="hidden" name="YANDEX_EXPORT_<?= $res["ID"]; ?>" id="YANDEX_EXPORT_<?= $res["ID"]; ?>_N" value="N">
2166 <?php endif; ?>
2167
2168 <td style="text-align: center;"><?=SelectBoxFromArray('VAT_ID_'.$res['ID'], $arVATRef, $res['VAT_ID'], '', ('N' == $res['IS_CATALOG'] ? 'disabled="disabled"' : ''))?></td>
2169 </tr>
2170 <?php
2171 }
2172 if (isset($res))
2173 unset($res);
2174 ?>
2175</table>
2176</td></tr>
2177<?php
2178
2179if ($USER->IsAdmin())
2180{
2181 if (CBXFeatures::IsFeatureEnabled('SaleRecurring'))
2182 {
2183 $tabControl->BeginNextTab();
2184
2185 $arVal = array();
2186 $strVal = Option::get('catalog', 'avail_content_groups');
2187 if ($strVal != '')
2188 $arVal = explode(',', $strVal);
2189
2190 $groupIterator = Main\GroupTable::getList([
2191 'select' => ['ID', 'NAME', 'C_SORT'],
2192 'filter' => ['!=ID' => 2, '=ANONYMOUS' => 'N'],
2193 'order' => ['C_SORT' => 'ASC', 'NAME' => 'ASC']
2194 ]);
2195 while ($arUserGroups = $groupIterator->fetch())
2196 {
2197 $arUserGroups["ID"] = (int)$arUserGroups["ID"];
2198 ?>
2199 <tr>
2200 <td style="width: 40%;"><label for="user_group_<?=$arUserGroups["ID"]?>"><?= htmlspecialcharsEx($arUserGroups["NAME"])?></label> [<a href="group_edit.php?ID=<?=$arUserGroups["ID"]?>&lang=<?=LANGUAGE_ID?>" title="<?=Loc::getMessage("CO_USER_GROUP_ALT")?>"><?=$arUserGroups["ID"]?></a>]:</td>
2201 <td><input type="checkbox" id="user_group_<?=$arUserGroups["ID"]?>" name="AVAIL_CONTENT_GROUPS[]"<?= (in_array($arUserGroups["ID"], $arVal) ? ' checked' : ''); ?> value="<?= $arUserGroups["ID"] ?>"></td>
2202 </tr>
2203 <?php
2204 }
2205 unset($arUserGroups, $groupIterator);
2206 }
2207
2208 $tabControl->BeginNextTab();
2209
2210 require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/admin/group_rights2.php");
2211
2212}
2213
2214$tabControl->Buttons();
2215?>
2216<input type="submit" class="adm-btn-save" <?= ($bReadOnly ? ' disabled' : ''); ?> name="Update" value="<?= Loc::getMessage("CAT_OPTIONS_BTN_SAVE"); ?>">
2217<input type="hidden" name="Update" value="Y">
2218<input type="reset" name="reset" value="<?= Loc::getMessage("CAT_OPTIONS_BTN_RESET"); ?>">
2219<input type="button"<?= ($bReadOnly ? ' disabled' : ''); ?> title="<?= Loc::getMessage("CAT_OPTIONS_BTN_HINT_RESTORE_DEFAULT"); ?>" onclick="RestoreDefaults();" value="<?= Loc::getMessage("CAT_OPTIONS_BTN_RESTORE_DEFAULT"); ?>">
2220</form>
2221<script>
2222BX.hint_replace(
2223 BX('hint_use_offer_marking_code_group'),
2224 '<?=CUtil::JSEscape(Loc::getMessage('USE_OFFER_MARKING_CODE_GROUP_HINT')); ?>'
2225);
2226BX.hint_replace(BX('hint_reservation'), '<?=CUtil::JSEscape(Loc::getMessage('CAT_ENABLE_RESERVATION_HINT')); ?>');
2227BX.hint_replace(BX('hint_show_catalog_tab_with_offers'), '<?=CUtil::JSEscape(Loc::getMessage('CAT_ENABLE_SHOW_CATALOG_TAB_WITH_OFFERS')); ?>');
2228BX.hint_replace(BX('hint_show_store_shipping_center'), '<?=CUtil::JSEscape(Loc::getMessage('CAT_SHOW_STORE_SHIPPING_CENTER_HINT')); ?>');
2229</script>
2230<?php
2231$tabControl->End();
2232
2233if ($bReadOnly)
2234 return;
2235
2236$catalogData = Catalog\CatalogIblockTable::getList(array(
2237 'select' => array('CNT'),
2238 'runtime' => array(
2239 new Main\Entity\ExpressionField('CNT', 'COUNT(*)')
2240 )
2241))->fetch();
2242$catalogCount = (isset($catalogData['CNT']) ? (int)$catalogData['CNT'] : 0);
2243unset($catalogData);
2244?><h2><?=Loc::getMessage("COP_SYS_ROU"); ?></h2>
2245<?php
2246$aTabs = [];
2247
2249{
2250 $aTabs[] = [
2251 "DIV" => "fedit2",
2252 "TAB" => Loc::getMessage("COP_TAB2_YANDEX_AGENT"),
2253 "ICON" => "catalog_settings",
2254 "TITLE" => Loc::getMessage("COP_TAB2_YANDEX_AGENT_TITLE")
2255 ];
2256}
2257
2259{
2260 $aTabs[] = [
2261 "DIV" => "fedit4",
2262 "TAB" => Loc::getMessage("COP_TAB_RECALC"),
2263 "ICON" => "catalog_settings",
2264 "TITLE" => Loc::getMessage("COP_TAB_RECALC_TITLE")
2265 ];
2266}
2267if ($strUseStoreControl === 'N' && $catalogCount > 0)
2268{
2269 $aTabs[] = [
2270 "DIV" => "fedit3",
2271 "TAB" => Loc::getMessage("CAT_QUANTITY_CONTROL_TAB"),
2272 "ICON" => "catalog_settings",
2273 "TITLE" => Loc::getMessage("CAT_QUANTITY_CONTROL")
2274 ];
2275?>
2276<script>
2277 function catClearQuantity(el, action)
2278 {
2279 var waiter_parent = BX.findParent(el, BX.is_relative),
2280 pos = BX.pos(el, !!waiter_parent);
2281 var iblockId = BX("catalogs_id").value;
2282 if (action === 'clearStore')
2283 {
2284 iblockId = BX("catalogs_store_id").value;
2285 }
2286 var dateURL = {
2287 sessid: BX.bitrix_sessid(),
2288 iblockId: iblockId,
2289 action: action,
2290 elId: el.id
2291 };
2292 if (action === 'clearStore')
2293 {
2294 var obStore = BX('stores_id');
2295 if (!!obStore)
2296 {
2297 dateURL.storeId = obStore.value;
2298 }
2299 else
2300 {
2301 return;
2302 }
2303 }
2304 el.disabled = true;
2305 el.bxwaiter = (waiter_parent || document.body).appendChild(BX.create('DIV', {
2306 props: {className: 'adm-btn-load-img'},
2307 style: {
2308 top: parseInt((pos.bottom + pos.top)/2 - 5, 10) + 'px',
2309 left: parseInt((pos.right + pos.left)/2 - 9, 10) + 'px'
2310 }
2311 }));
2312 BX.addClass(el, 'adm-btn-load');
2313 BX.ajax.post(
2314 '/bitrix/admin/cat_quantity_control.php?lang=<?= LANGUAGE_ID; ?>',
2315 dateURL,
2316 catClearQuantityResult
2317 );
2318 }
2319
2320 function catClearQuantityResult(result)
2321 {
2322 if (result.length > 0)
2323 {
2324 var res = eval( '('+result+')' );
2325 var el = BX(res);
2326 BX(res).setAttribute('class', 'adm-btn');
2327 if (el.bxwaiter && el.bxwaiter.parentNode)
2328 {
2329 el.bxwaiter.parentNode.removeChild(el.bxwaiter);
2330 el.bxwaiter = null;
2331 }
2332 el.disabled = false;
2333 }
2334 }
2335</script>
2336<?php
2337}
2338
2339$systemTabControl = new CAdminTabControl("tabControl2", $aTabs, true, true);
2340
2341$systemTabControl->Begin();
2342?>
2343
2344<?php
2346{
2347 $systemTabControl->BeginNextTab();
2348 ?>
2349 <tr><td style="text-align: left;"><?php
2350 $arAgentInfo = false;
2351 $rsAgents = CAgent::GetList(array(),array('MODULE_ID' => 'catalog','NAME' => 'CCatalog::PreGenerateXML("yandex");'));
2352 if ($arAgent = $rsAgents->Fetch())
2353 {
2354 $arAgentInfo = $arAgent;
2355 }
2356 if (!is_array($arAgentInfo) || empty($arAgentInfo))
2357 {
2358 ?><form name="agent_form" method="POST" action="<?= $APPLICATION->GetCurPage(); ?>?mid=<?=htmlspecialcharsbx($mid)?>&lang=<?= LANGUAGE_ID; ?>">
2359 <?= bitrix_sessid_post();?>
2360 <input type="submit" class="adm-btn-save" name="agent_start" value="<?= Loc::getMessage('CAT_AGENT_START'); ?>"<?= ($bReadOnly ? ' disabled' : ''); ?>>
2361 </form><?php
2362 }
2363 else
2364 {
2365 echo Loc::getMessage('CAT_AGENT_ACTIVE').':&nbsp;'.($arAgentInfo['ACTIVE'] == 'Y' ? Loc::getMessage("MAIN_YES") : Loc::getMessage("MAIN_NO")).'<br>';
2366 if ($arAgentInfo['LAST_EXEC'])
2367 {
2368 echo Loc::getMessage('CAT_AGENT_LAST_EXEC').':&nbsp;'.($arAgentInfo['LAST_EXEC'] ?: '').'<br>';
2369 echo Loc::getMessage('CAT_AGENT_NEXT_EXEC').':&nbsp;'.($arAgentInfo['NEXT_EXEC'] ?: '').'<br>';
2370 }
2371 else
2372 {
2373 echo Loc::getMessage('CAT_AGENT_WAIT_START').'<br>';
2374 }
2375 }
2376 ?><br><?php
2377 $strYandexFile = str_replace('//', '/', Option::get('catalog', 'export_default_path').'/yandex.php');
2378 if (file_exists($_SERVER['DOCUMENT_ROOT'].$strYandexFile))
2379 {
2380 echo Loc::getMessage(
2381 'CAT_AGENT_FILEPATH',
2382 array(
2383 '#FILE#' => '<a href="'.$strYandexFile.'">'.$strYandexFile.'</a>'
2384 )
2385 ).'<br>';
2386 }
2387 else
2388 {
2389 echo Loc::getMessage('CAT_AGENT_FILE_ABSENT').'<br>';
2390 }
2391 ?><br><?php
2392 echo Loc::getMessage('CAT_AGENT_EVENT_LOG').':&nbsp;';
2393
2394 ?><a href="/bitrix/admin/event_log.php?lang=<?= LANGUAGE_ID; ?>&set_filter=Y<?= CCatalogEvent::GetYandexAgentFilter(); ?>"><?= Loc::getMessage('CAT_AGENT_EVENT_LOG_SHOW_ERROR'); ?></a>
2395 </td></tr>
2396 <?php
2397}
2398?>
2399
2400<?php
2402{
2403 $systemTabControl->BeginNextTab();
2404 ?><tr><td style="text-align: left;"><?php
2405 $firstTop = ' style="margin-top: 0;"';
2407 {
2408 ?><h4<?=$firstTop; ?>><?=Loc::getMessage('CAT_PROC_REINDEX_DISCOUNT'); ?></h4>
2409 <input class="adm-btn-save" type="button" id="discount_reindex" value="<?=Loc::getMessage('CAT_PROC_REINDEX_DISCOUNT_BTN'); ?>">
2410 <p><?=Loc::getMessage('CAT_PROC_REINDEX_DISCOUNT_ALERT'); ?></p><?php
2411 $firstTop = '';
2412 }
2413 if ($catalogCount > 0)
2414 {
2415 ?><h4<?=$firstTop; ?>><?=Loc::getMessage('CAT_PROC_REINDEX_CATALOG'); ?></h4>
2416 <input class="adm-btn-save" type="button" id="catalog_reindex" value="<?=Loc::getMessage('CAT_PROC_REINDEX_CATALOG_BTN'); ?>">
2417 <p><?=Loc::getMessage('CAT_PROC_REINDEX_CATALOG_ALERT'); ?></p><?php
2418 if (Catalog\Config\Feature::isProductSetsEnabled() && CCatalogProductSetAvailable::getAllCounter() > 0)
2419 {
2420 ?><h4><?=Loc::getMessage('CAT_PROC_REINDEX_SETS_AVAILABLE'); ?></h4>
2421 <input class="adm-btn-save" type="button" id="sets_reindex" value="<?=Loc::getMessage('CAT_PROC_REINDEX_SETS_AVAILABLE_BTN'); ?>">
2422 <p><?=Loc::getMessage('CAT_PROC_REINDEX_SETS_AVAILABLE_ALERT'); ?></p><?php
2423 }
2424 }
2425 ?></td></tr><?php
2426}
2427 if ($strUseStoreControl === 'N' && $catalogCount > 0)
2428 {
2429 $userListID = array();
2430 $strQuantityUser = '';
2431 $strQuantityReservedUser = '';
2432 $strStoreUser = '';
2433 $strClearQuantityDate = '';
2434 $strClearQuantityReservedDate = '';
2435 $strClearStoreDate = '';
2436
2437 $clearQuantityUser = (int)Option::get('catalog', 'clear_quantity_user');
2438 if ($clearQuantityUser < 0)
2439 $clearQuantityUser = 0;
2440 $userListID[$clearQuantityUser] = true;
2441
2442 $clearQuantityReservedUser = (int)Option::get('catalog', 'clear_reserved_quantity_user');
2443 if ($clearQuantityReservedUser < 0)
2444 $clearQuantityReservedUser = 0;
2445 $userListID[$clearQuantityReservedUser] = true;
2446
2447 $clearStoreUser = (int)Option::get('catalog', 'clear_store_user');
2448 if ($clearStoreUser < 0)
2449 $clearStoreUser = 0;
2450 $userListID[$clearStoreUser] = true;
2451
2452 if (isset($userListID[0]))
2453 unset($userListID[0]);
2454 if (!empty($userListID))
2455 {
2456 $strClearQuantityDate = Option::get('catalog', 'clear_quantity_date');
2457 $strClearQuantityReservedDate = Option::get('catalog', 'clear_reserved_quantity_date');
2458 $strClearStoreDate = Option::get('catalog', 'clear_store_date');
2459
2460 $arUserList = array();
2461 $strNameFormat = CSite::GetNameFormat(true);
2462
2464 $USER->CanDoOperation('view_subordinate_users')
2465 || $USER->CanDoOperation('view_all_users')
2466 || $USER->CanDoOperation('edit_all_users')
2467 || $USER->CanDoOperation('edit_subordinate_users')
2468 );
2469 $userIterator = Main\UserTable::getList(array(
2470 'select' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME', 'SECOND_NAME'),
2471 'filter' => array('ID' => array_keys($userListID))
2472 ));
2473 while ($arOneUser = $userIterator->fetch())
2474 {
2475 $arOneUser['ID'] = (int)$arOneUser['ID'];
2476 if ($canViewUserList)
2477 $arUserList[$arOneUser['ID']] = '['.$arOneUser['ID'].'] <a href="/bitrix/admin/user_edit.php?lang='.LANGUAGE_ID.'&ID='.$arOneUser['ID'].'">'.CUser::FormatName($strNameFormat, $arOneUser).'</a>';
2478 else
2479 $arUserList[$arOneUser['ID']] = '['.$arOneUser['ID'].'] '.CUser::FormatName($strNameFormat, $arOneUser);
2480 }
2481 unset($arOneUser, $userIterator, $canViewUserList);
2482 if (isset($arUserList[$clearQuantityUser]))
2483 $strQuantityUser = $arUserList[$clearQuantityUser];
2484
2485 if (isset($arUserList[$clearQuantityReservedUser]))
2486 $strQuantityReservedUser = $arUserList[$clearQuantityReservedUser];
2487 if (isset($arUserList[$clearStoreUser]))
2488 $strStoreUser = $arUserList[$clearStoreUser];
2489 }
2490 $boolStoreExists = false;
2491 $arStores = array();
2492 $arStores[] = [
2493 'ID' => -1,
2494 'TITLE' => '',
2495 'ADDRESS' => Loc::getMessage("CAT_ALL_STORES"),
2496 'SORT' => 0,
2497 ];
2498 $rsStores = CCatalogStore::GetList(
2499 array('SORT' => 'ASC', 'ID' => 'ASC'),
2500 array('ACTIVE' => 'Y'),
2501 false,
2502 false,
2503 array('ID', 'TITLE', 'ADDRESS', 'SORT')
2504 );
2505 while ($arStore = $rsStores->GetNext())
2506 {
2507 $boolStoreExists = true;
2508 $arStores[] = $arStore;
2509 }
2510
2511 $systemTabControl->BeginNextTab();
2512 ?>
2513 <tr>
2514 <td><?= Loc::getMessage("CAT_SELECT_CATALOG") ?>:</td>
2515 <td>
2516 <select style="max-width: 300px" id="catalogs_id" name="catalogs_id" <?=($bReadOnly ? ' disabled' : ''); ?>>
2517 <?php
2518 //TODO: need get catalog list
2519 foreach($arCatalogList as $arOneCatalog)
2520 {
2521 echo '<option value="'.$arOneCatalog['ID'].'">'.htmlspecialcharsex($arOneCatalog["NAME"]).' ('.$arIBlockSitesList[$arOneCatalog['ID']]['WITHOUT_LINKS'].')</option>';
2522 }
2523 unset($arOneCatalog);
2524 ?>
2525 </select>
2526 </td>
2527 </tr>
2528
2529 <tr>
2530 <td style="width: 40%;"><?= Loc::getMessage("CAT_CLEAR_QUANTITY"); ?>:</td>
2531 <td>
2532 <input type="button" value="<?= Loc::getMessage("CAT_CLEAR_ACTION"); ?>" id="cat_clear_quantity_btn" onclick="catClearQuantity(this, 'clearQuantity')">
2533 <?php
2534 if (0 < $clearQuantityUser)
2535 {
2536 ?><span style="font-size: smaller;"><?=$strQuantityUser;?>&nbsp;<?= $strClearQuantityDate; ?></span><?php
2537 }
2538 ?>
2539 </td>
2540 </tr>
2541 <tr>
2542 <td style="width: 40%;"><?= Loc::getMessage("CAT_CLEAR_RESERVED_QUANTITY"); ?></td>
2543 <td>
2544 <input type="button" value="<?= Loc::getMessage("CAT_CLEAR_ACTION"); ?>" id="cat_clear_reserved_quantity_btn" onclick="catClearQuantity(this, 'clearReservedQuantity')">
2545 <?php
2546 if (0 < $clearQuantityReservedUser)
2547 {
2548 ?><span style="font-size: smaller;"><?=$strQuantityReservedUser;?>&nbsp;<?= $strClearQuantityReservedDate; ?></span><?php
2549 }
2550 ?>
2551 </td>
2552 </tr>
2553 <tr class="heading">
2554 <td colspan="2"><?= Loc::getMessage("CAT_CLEAR_STORE"); ?></td>
2555 </tr>
2556<?php
2557 if ($boolStoreExists)
2558 {
2559?>
2560 <tr>
2561 <td><?= Loc::getMessage("CAT_SELECT_CATALOG") ?>:</td>
2562 <td>
2563 <select style="max-width: 300px" id="catalogs_store_id" name="catalogs_store_id" <?=($bReadOnly ? ' disabled' : ''); ?>>
2564 <?php
2565 foreach($arCatalogList as $arOneCatalog)
2566 {
2567 echo '<option value="'.$arOneCatalog['ID'].'">'.htmlspecialcharsex($arOneCatalog["NAME"]).' ('.$arIBlockSitesList[$arOneCatalog['ID']]['WITHOUT_LINKS'].')</option>';
2568 }
2569 unset($arOneCatalog);
2570 ?>
2571 </select>
2572 </td>
2573 </tr>
2574 <tr>
2575 <td><?= Loc::getMessage("CAT_SELECT_STORE") ?>:</td>
2576 <td>
2577 <select style="max-width: 300px;" id="stores_id" name="stores_id" <?=($bReadOnly ? ' disabled' : ''); ?>>
2578 <?php
2579 foreach($arStores as $key => $val)
2580 {
2581 $store = ($val["TITLE"] != '') ? $val["TITLE"]." (".$val["ADDRESS"].")" : $val["ADDRESS"];
2582 echo '<option value="'.$val['ID'].'">'.$store.'</option>';
2583 }
2584 ?>
2585 </select>
2586
2587 </td>
2588 </tr>
2589 <tr>
2590 <td><?= Loc::getMessage("CAT_CLEAR_STORE") ?>:</td>
2591 <td>
2592 <input type="button" value="<?= Loc::getMessage("CAT_CLEAR_ACTION"); ?>" id="cat_clear_store_btn" onclick="catClearQuantity(this, 'clearStore')">
2593 <?php
2594 if (0 < $clearStoreUser)
2595 {
2596 ?><span style="font-size: smaller;"><?=$strStoreUser;?>&nbsp;<?=$strClearStoreDate;?></span><?php
2597 }
2598 ?>
2599 </td>
2600 </tr>
2601<?php
2602 }
2603 else
2604 {
2605?>
2606 <tr>
2607 <td colspan="2"><?= Loc::getMessage("CAT_STORE_LIST_IS_EMPTY"); ?></td>
2608 </tr>
2609<?php
2610 }
2611 }
2612 $systemTabControl->End();
2613?>
2614<script>
2615function showDiscountReindex()
2616{
2617 var obDiscount, params;
2618
2619 params = {
2620 bxpublic: 'Y',
2621 sessid: BX.bitrix_sessid()
2622 };
2623
2624 var obBtn = {
2625 title: '<?= CUtil::JSEscape(Loc::getMessage('CAT_POPUP_WINDOW_CLOSE_BTN')); ?>',
2626 id: 'close',
2627 name: 'close',
2628 action: function () {
2629 this.parentWindow.Close();
2630 }
2631 };
2632
2633 obDiscount = new BX.CAdminDialog({
2634 'content_url': '/bitrix/admin/cat_discount_convert.php?lang=<?= LANGUAGE_ID; ?>&format=Y',
2635 'content_post': params,
2636 'draggable': true,
2637 'resizable': true,
2638 'buttons': [obBtn]
2639 });
2640 obDiscount.Show();
2641 return false;
2642}
2643function showSetsAvailableReindex()
2644{
2645 var obWindow, params;
2646
2647 params = {
2648 bxpublic: 'Y',
2649 sessid: BX.bitrix_sessid()
2650 };
2651
2652 var obBtn = {
2653 title: '<?= CUtil::JSEscape(Loc::getMessage('CAT_POPUP_WINDOW_CLOSE_BTN')); ?>',
2654 id: 'close',
2655 name: 'close',
2656 action: function () {
2657 this.parentWindow.Close();
2658 }
2659 };
2660
2661 obWindow = new BX.CAdminDialog({
2662 'content_url': '/bitrix/tools/catalog/sets_available.php?lang=<?= LANGUAGE_ID; ?>',
2663 'content_post': params,
2664 'draggable': true,
2665 'resizable': true,
2666 'buttons': [obBtn]
2667 });
2668 obWindow.Show();
2669 return false;
2670}
2671
2672function showCatalogReindex()
2673{
2674 var obWindow, params;
2675
2676 params = {
2677 bxpublic: 'Y',
2678 sessid: BX.bitrix_sessid()
2679 };
2680
2681 var obBtn = {
2682 title: '<?= CUtil::JSEscape(Loc::getMessage('CAT_POPUP_WINDOW_CLOSE_BTN')); ?>',
2683 id: 'close',
2684 name: 'close',
2685 action: function () {
2686 this.parentWindow.Close();
2687 }
2688 };
2689
2690 obWindow = new BX.CAdminDialog({
2691 'content_url': '/bitrix/tools/catalog/catalog_reindex.php?lang=<?= LANGUAGE_ID; ?>',
2692 'content_post': params,
2693 'draggable': true,
2694 'resizable': true,
2695 'buttons': [obBtn]
2696 });
2697 obWindow.Show();
2698 return false;
2699}
2700
2701function showProductSettings()
2702{
2703 var obWindow, params;
2704
2705 params = {
2706 bxpublic: 'Y',
2707 sessid: BX.bitrix_sessid()
2708 };
2709
2710 var obBtn = {
2711 title: '<?= CUtil::JSEscape(Loc::getMessage('CAT_POPUP_WINDOW_CLOSE_BTN')); ?>',
2712 id: 'close',
2713 name: 'close',
2714 action: function () {
2715 this.parentWindow.Close();
2716 }
2717 };
2718
2719 obWindow = new BX.CAdminDialog({
2720 'content_url': '/bitrix/tools/catalog/product_settings.php?lang=<?= LANGUAGE_ID; ?>',
2721 'content_post': params,
2722 'draggable': true,
2723 'resizable': true,
2724 'buttons': [obBtn]
2725 });
2726 obWindow.Show();
2727 return false;
2728}
2729
2730function changeProductSettings(params)
2731{
2732 var i, ob;
2733 if (!BX.type.isPlainObject(params))
2734 return;
2735 for (i in params)
2736 {
2737 ob = BX(i);
2738 if (!!ob)
2739 ob.innerHTML = BX.util.htmlspecialchars(params[i]);
2740 }
2741}
2742
2743function showViewed()
2744{
2745 var enableViewed = BX('enable_viewed_products_y'),
2746 viewedTime = BX('tr_viewed_time'),
2747 viewedCount = BX('tr_viewed_count'),
2748 viewedPeriod = BX('tr_viewed_period'),
2749 rowType;
2750 if (BX.type.isElementNode(enableViewed))
2751 {
2752 rowType = (enableViewed.checked ? 'table-row' : 'none');
2753 if (BX.type.isElementNode(viewedTime))
2754 {
2755 BX.style(viewedTime, 'display', rowType);
2756 }
2757 if (BX.type.isElementNode(viewedCount))
2758 {
2759 BX.style(viewedCount, 'display', rowType);
2760 }
2761 if (BX.type.isElementNode(viewedPeriod))
2762 {
2763 BX.style(viewedPeriod, 'display', rowType);
2764 }
2765 }
2766 viewedPeriod = null;
2767 viewedCount = null;
2768 viewedTime = null;
2769 enableViewed = null;
2770}
2771
2772BX.ready(function(){
2773 var discountReindex = BX('discount_reindex'),
2774 setsReindex = BX('sets_reindex'),
2775 catalogReindex = BX('catalog_reindex'),
2776 productSettings = BX('product_settings'),
2777 enableViewed = BX('enable_viewed_products_y');
2778
2779 if (!!discountReindex)
2780 BX.bind(discountReindex, 'click', showDiscountReindex);
2781 if (!!setsReindex)
2782 BX.bind(setsReindex, 'click', showSetsAvailableReindex);
2783 if (!!catalogReindex)
2784 BX.bind(catalogReindex, 'click', showCatalogReindex);
2785 if (!!productSettings)
2786 BX.bind(productSettings, 'click', showProductSettings);
2787 if (BX.type.isElementNode(enableViewed))
2788 {
2789 BX.bind(enableViewed, 'click', showViewed);
2790 }
2791});
2792</script>
return select
Определения access_edit.php:440
$type
Определения options.php:106
CatalogGetVATArray($arFilter=array(), $bInsertEmptyLine=false)
Определения include.php:2154
global $APPLICATION
Определения include.php:80
const BX_CATALOG_FILENAME_REG
Определения include.php:51
$strAllowCanBuyZero
Определения options.php:1315
$strSubscribe
Определения options.php:1316
$catalogData
Определения options.php:2236
$strOK
Определения options.php:75
for($i=0, $intCount=count($arAllOptions); $i< $intCount; $i++) $default_outfile_action
Определения options.php:1737
$arIBlockSitesList
Определения options.php:1885
$strEnableReservation
Определения options.php:1318
$viewedPeriod
Определения options.php:1610
$styleViewed
Определения options.php:1611
$applyDiscSaveModeList
Определения options.php:41
$viewedTime
Определения options.php:1608
while($arIBlockType=$rsIBlockTypes->Fetch()) $arDoubleIBlockFullInfo
Определения options.php:1988
$strUseStoreControl
Определения options.php:1319
if($saleIsInstalled) $crmInstalled
Определения options.php:39
while($arIBlock=$rsIBlocks->Fetch()) $catalogIterator
Определения options.php:1934
$searchShowOfferName
Определения options.php:1323
$strShowCatalogTab
Определения options.php:1311
$canUseYandexMarket
Определения options.php:46
$bReadOnly
Определения options.php:24
$module_id
Определения options.php:6
$strSimpleSearch
Определения options.php:1322
if($strVal !='') $sectionFields
Определения options.php:1848
if($saleIsInstalled &&Loader::includeModule('sale')) if(! $crmInstalled) if(! $useSaleDiscountOnly $enableViewedProducts)
Определения options.php:1607
$strVal
Определения options.php:1786
$rsIBlockTypes
Определения options.php:1978
$useSaleDiscountOnly
Определения options.php:32
$arRecurring
Определения options.php:1889
$arVal
Определения options.php:1785
if($strVal !='') $priceFields
Определения options.php:1817
$saleSettingsUrl
Определения options.php:43
const CATALOG_NEW_OFFERS_IBLOCK_NEED
Определения options.php:19
if($canUseYandexMarket) $strWarning
Определения options.php:74
$arVATRef
Определения options.php:1882
$arCatalogList
Определения options.php:1884
if($canUseYandexMarket) if(! $useSaleDiscountOnly||$catalogCount > 0) if($strUseStoreControl==='N' && $catalogCount > 0 $systemTabControl)
Определения options.php:2339
$arIBlockFullInfo
Определения options.php:1887
$enabledCommonCatalog
Определения options.php:45
$strShowOffersIBlock
Определения options.php:1321
$arIBlockTypeNameList
Определения options.php:1977
$viewedCount
Определения options.php:1609
$catalogCount
Определения options.php:2242
$accessController
Определения options.php:23
$currentSettings
Определения options.php:1301
$strQuantityTrace
Определения options.php:1314
if($_SERVER $arAllOptions['REQUEST_METHOD']=='GET' &&!empty($_REQUEST['RestoreDefaults']) &&! $bReadOnly &&check_bitrix_sessid())
Определения options.php:63
$arIBlockTypeIDList
Определения options.php:1976
if($strVal !='') $productFields
Определения options.php:1791
$arRecurringKey
Определения options.php:1890
$saleIsInstalled
Определения options.php:33
$strSaveProductWithoutPrice
Определения options.php:1312
$boolFlag
Определения generate_coupon.php:21
static isCanUseYandexExport()
Определения feature.php:195
static isCommonProductProcessingEnabled()
Определения feature.php:170
Определения vat.php:9
Определения loader.php:13
static normalizeArrayValuesByInt(&$map, $sorted=true)
Определения collection.php:150
static getProductReserveClearPeriod()
Определения configuration.php:111
static getReservationConditionList($extendedMode=false)
Определения configuration.php:33
static getProductReservationCondition()
Определения configuration.php:78
static ShowScript($arConfig)
Определения file_dialog.php:9
static ShowMessage($message)
Определения admin_lib.php:2351
static ShowNote($message)
Определения admin_lib.php:2360
static GetApplyModeList($extendedMode=false)
Определения discount_save.php:81
static Delete($ID)
Определения catalog.php:1259
static DeleteByGroup($ID)
Определения product_group.php:76
static GetList($by='c_sort', $order='asc', $arFilter=[], $SHOW_USERS_AMOUNT="N")
Определения group.php:136
static GetNameFormat($dummy=null, $site_id="")
Определения site.php:878
static FormatName($NAME_TEMPLATE, $arUser, $bUseLogin=false, $bHTMLSpec=true, $enabledEmptyNameStub=true)
Определения user.php:5614
static IsFeatureEnabled($_1488512778)
Определения include.php:116
const FIELDS_PRICE
Определения csv_settings.php:9
static getSettingsFields($type, $extFormat=false)
Определения csv_settings.php:14
const FIELDS_PRICE_EXT
Определения csv_settings.php:10
const FIELDS_ELEMENT
Определения csv_settings.php:7
const FIELDS_CATALOG
Определения csv_settings.php:8
const FIELDS_SECTION
Определения csv_settings.php:11
Определения catalog.php:6
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения catalog.php:15
static getAllCounter()
Определения step_operations.php:281
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения store.php:53
Определения iblocktype.php:20
static GetList($arOrder=array("SORT"=> "ASC"), $arFilter=array())
Определения iblocktype.php:53
static GetByID($ID)
Определения iblocktype.php:220
static GetByIDLang($ID, $LID, $bFindAny=true)
Определения iblocktype.php:274
$arFields
Определения dblapprove.php:5
$canViewUserList
Определения discount_coupon_list.php:38
& nbsp
Определения epilog_main_admin.php:38
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
$res
Определения filter_act.php:7
$zr
Определения options.php:5
Form FILTER_ACTION disabled
Определения options.php:358
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
$iblockId
Определения iblock_catalog_edit.php:30
if(! $catalogEdit->isSuccess()) $iblock
Определения iblock_catalog_edit.php:38
$strError
Определения options_user_settings.php:4
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $DB
Определения cron_frame.php:29
global $USER
Определения csv_new_run.php:40
$tabControl
Определения csv_new_setup.php:244
$aTabs
Определения csv_new_setup.php:238
endif
Определения csv_new_setup.php:990
$z
Определения options.php:31
URL bitrix admin public_file_edit php bxpublic
Определения structure.php:440
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
Определения tools.php:4700
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
RegisterModuleDependences($FROM_MODULE_ID, $MESSAGE_ID, $TO_MODULE_ID, $TO_CLASS="", $TO_METHOD="", $SORT=100, $TO_PATH="", $TO_METHOD_ARG=[])
Определения tools.php:5295
GetDirPath($sPath)
Определения tools.php:3245
UnRegisterModuleDependences($FROM_MODULE_ID, $MESSAGE_ID, $TO_MODULE_ID, $TO_CLASS="", $TO_METHOD="", $TO_PATH="", $TO_METHOD_ARG=[])
Определения tools.php:5289
htmlspecialcharsEx($str)
Определения tools.php:2685
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
Rel2Abs($curdir, $relpath)
Определения tools.php:3297
SelectBoxFromArray( $strBoxName, $db_array, $strSelectedVal="", $strDetText="", $field1="class='typeselect'", $go=false, $form="form1")
Определения tools.php:216
$name
Определения menu_edit.php:35
Определения basket.php:2
$value
Определения Param.php:39
Определения ufield.php:9
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
<? endif;?> window document title
Определения prolog_main_admin.php:76
$ar
Определения options.php:199
if(empty($signedUserToken)) $key
Определения quickway.php:257
$i
Определения factura.php:643
font style
Определения invoice.php:442
font size
Определения invoice.php:442
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$firstTop
Определения options.php:3658
$val
Определения options.php:1793
else $Option[0]
Определения options.php:387
$rsIBlocks
Определения yandex_detail.php:58
if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_CATALOG_EXPORT_EDIT)) if((!isset($_REQUEST['IBLOCK_ID']))||($_REQUEST['IBLOCK_ID']=='')) $intIBlockID
Определения yandex_detail.php:44
$arIBlock['PROPERTY']
Определения yandex_detail.php:172
$rsProps
Определения yandex_run.php:584
$arCatalog
Определения yandex_run.php:674