{ $rsDiscounts = CCatalogDiscount::GetList(array(), array("ID" => $ID), false, false, $arSelect); if (!($arDiscount = $rsDiscounts->Fetch())) { $ID = 0; $arDiscount = $arDefaultValues; $arCoupons = $arDefCoupons; } else { $rsDiscountGroups = CCatalogDiscount::GetDiscountGroupsList(array(), array("DISCOUNT_ID" => $ID)); while ($arDiscountGroup = $rsDiscountGroups->Fetch()) { $arDiscountGroupList[] = intval($arDiscountGroup["GROUP_ID"]); } $rsDiscountCats = CCatalogDiscount::GetDiscountCatsList(array(), array("DISCOUNT_ID" => $ID)); while ($arDiscountCat = $rsDiscountCats->Fetch()) { $arDiscountCatList[] = intval($arDiscountCat["CATALOG_GROUP_ID"]); } if (!isset($arDiscount['VERSION']) || intval($arDiscount['VERSION']) != CCatalogDiscount::CURRENT_FORMAT) { $bReadOnly = true; $boolShowCoupons = false; $rsAdminNotify = CAdminNotify::GetList(array(), array('MODULE_ID'=>'catalog', 'TAG' => 'CATALOG_DISC_CONVERT')); if (!($arAdminNotify = $rsAdminNotify->Fetch())) { $strLangPath = $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/catalog/lang/'; $strDefLang = false; $arLangList = array();
$arDiscount = $arDefaultValues; $arDiscountGroupList = array(); $arDiscountCatList = array(); $arCoupons = $arDefCoupons; if (0 < $ID) { $rsDiscounts = CCatalogDiscount::GetList(array(), array("ID" => $ID), false, false, $arSelect); if (!($arDiscount = $rsDiscounts->Fetch())) { $ID = 0; $arDiscount = $arDefaultValues; $arCoupons = $arDefCoupons; } else { $rsDiscountGroups = CCatalogDiscount::GetDiscountGroupsList(array(), array('DISCOUNT_ID' => $ID, '>USER_GROUP_ID' => 0), false, false, array('ID', 'DISCOUNT_ID', 'USER_GROUP_ID')); while ($arDiscountGroup = $rsDiscountGroups->Fetch()) { $arDiscountGroupList[] = (int) $arDiscountGroup['USER_GROUP_ID']; } $rsDiscountCats = CCatalogDiscount::GetDiscountCatsList(array(), array('DISCOUNT_ID' => $ID, '>PRICE_TYPE_ID' => 0), false, false, array('ID', 'DISCOUNT_ID', 'PRICE_TYPE_ID')); while ($arDiscountCat = $rsDiscountCats->Fetch()) { $arDiscountCatList[] = (int) $arDiscountCat['PRICE_TYPE_ID']; } if (!isset($arDiscount['VERSION']) || (int) $arDiscount['VERSION'] != CCatalogDiscount::CURRENT_FORMAT) { $readOnly = true; $boolShowCoupons = false; $rsAdminNotify = CAdminNotify::GetList(array(), array('MODULE_ID' => 'catalog', 'TAG' => 'CATALOG_DISC_CONVERT')); if (!($arAdminNotify = $rsAdminNotify->Fetch())) { $strLangPath = $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/catalog/lang/'; $strDefLang = false; $arLangList = array(); $by = "def"; $order = "desc"; $rsLangs = CLanguage::GetList($by, $order); while ($arOneLang = $rsLangs->Fetch()) {