$arFields = array("PRODUCT_ID" => $elID, "CATALOG_GROUP_ID" => $arCatalogGroup["ID"], "PRICE" => DoubleVal($arPrice[$arCatalogGroup["ID"]]), "CURRENCY" => $arCurrency[$arCatalogGroup["ID"]], "QUANTITY_FROM" => $CATALOG_QUANTITY_FROM[$elID][$arCatalogGroup["ID"]], "QUANTITY_TO" => $CATALOG_QUANTITY_TO[$elID][$arCatalogGroup["ID"]]); if ($arFields["PRICE"] <= 0) { CPrice::Delete($CATALOG_PRICE_ID[$elID][$arCatalogGroup["ID"]]); } elseif (IntVal($CATALOG_PRICE_ID[$elID][$arCatalogGroup["ID"]]) > 0) { CPrice::Update(IntVal($CATALOG_PRICE_ID[$elID][$arCatalogGroup["ID"]]), $arFields); } elseif ($arFields["PRICE"] > 0) { CPrice::Add($arFields); } } } } } } } } if ($arID = $lAdmin->GroupAction()) { if ($_REQUEST['action_target'] == 'selected') { $rsData = CIBlockElement::GetList(array($by => $order), $arFilter); while ($arRes = $rsData->Fetch()) { $arID[] = $arRes['ID']; } } foreach ($arID as $subID) { if (strlen($subID) <= 0) { continue; } $subID = IntVal($subID); $arRes = CIBlockElement::GetByID($subID); $arRes = $arRes->Fetch(); if (!$arRes) { continue;
if ($result->isSuccess()) { $result = Internals\DiscountCouponTable::update($couponID, $fields); } if ($result->isSuccess()) { $conn->commitTransaction(); } else { $conn->rollbackTransaction(); $adminList->AddUpdateError(implode('<br>', $result->getErrorMessages()), $couponID); } unset($result); } unset($fields, $couponID); Internals\DiscountCouponTable::enableCheckCouponsUse(); } } if (!$couponsReadOnly && ($listID = $adminList->GroupAction())) { $checkUseCoupons = $_REQUEST['action'] == 'delete'; Internals\DiscountCouponTable::clearDiscountCheckList(); if ($_REQUEST['action_target'] == 'selected') { $listID = array(); $couponIterator = Internals\DiscountCouponTable::getList(array('select' => array('ID'), 'filter' => $filter)); while ($coupon = $couponIterator->fetch()) { $listID[] = $coupon['ID']; } } $listID = array_filter($listID); if (!empty($listID)) { switch ($_REQUEST['action']) { case 'activate': case 'deactivate': Internals\DiscountCouponTable::disableCheckCouponsUse();
$ID = intval($ID); if (!$lAdmin->IsUpdated($ID)) { continue; } if (!CCatalogDiscountCoupon::Update($ID, $arFields)) { if ($ex = $APPLICATION->GetException()) { $lAdmin->AddUpdateError($ex->GetString(), $ID); } else { $lAdmin->AddUpdateError(str_replace("#ID#", $ID, GetMessage("ERROR_UPDATE_DISCOUNT_CPN")), $ID); } $DB->Rollback(); } $DB->Commit(); } } if (($arID = $lAdmin->GroupAction()) && !$boolCouponsReadOnly) { if ($_REQUEST['action_target'] == 'selected') { $arID = array(); $dbResultList = CCatalogDiscountCoupon::GetList(array($by => $order), $arFilter, false, false, array("ID")); while ($arResult = $dbResultList->Fetch()) { $arID[] = $arResult['ID']; } } foreach ($arID as $ID) { if (strlen($ID) <= 0) { continue; } switch ($_REQUEST['action']) { case "delete": @set_time_limit(0); $DB->StartTransaction();