コード例 #1
0
 //	check if it is greater than 0
 //3 otherwise
 //	look up it's value in database and
 //	output an error if not found or found less or equal then zero
 $bError = false;
 $arBaseGroup = CCatalogGroup::GetBaseGroup();
 if (isset($arPrice[$arBaseGroup['ID']])) {
     if ($arPrice[$arBaseGroup['ID']] <= 0) {
         $bError = true;
         $lAdmin->AddUpdateError($elID . ': ' . GetMessage('IB_CAT_NO_BASE_PRICE'), $elID);
     }
 } else {
     $arBasePrice = CPrice::GetBasePrice($elID, $CATALOG_QUANTITY_FROM[$elID][$arBaseGroup['ID']], $CATALOG_QUANTITY_FROM[$elID][$arBaseGroup['ID']]);
     if (!is_array($arBasePrice) || $arBasePrice['PRICE'] <= 0) {
         $bError = true;
         $lAdmin->AddGroupError($elID . ': ' . GetMessage('IB_CAT_NO_BASE_PRICE'), $elID);
     }
 }
 if ($bError) {
     continue;
 }
 $arCurrency = $CATALOG_CURRENCY[$elID];
 $dbCatalogGroups = CCatalogGroup::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID));
 while ($arCatalogGroup = $dbCatalogGroups->Fetch()) {
     if (doubleval($arPrice[$arCatalogGroup["ID"]]) != doubleval($CATALOG_PRICE_old[$elID][$arCatalogGroup["ID"]]) || $arCurrency[$arCatalogGroup["ID"]] != $CATALOG_CURRENCY_old[$elID][$arCatalogGroup["ID"]]) {
         if ($arCatalogGroup["BASE"] == "Y") {
             $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);
コード例 #2
0
     $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();
             $fields = array('ACTIVE' => $_REQUEST['action'] == 'activate' ? 'Y' : 'N');
             foreach ($listID as &$couponID) {
                 $result = Internals\DiscountCouponTable::update($couponID, $fields);
                 if (!$result->isSuccess()) {
                     $adminList->AddGroupError(implode('<br>', $result->getErrorMessages(), $couponID));
                 }
             }
             unset($couponID, $fields);
             Internals\DiscountCouponTable::enableCheckCouponsUse();
             break;
         case 'delete':
             Internals\DiscountCouponTable::setDiscountCheckList(array($discountID));
             Internals\DiscountCouponTable::disableCheckCouponsUse();
             foreach ($listID as &$couponID) {
                 $result = Internals\DiscountCouponTable::delete($couponID);
                 if (!$result->isSuccess()) {
                     $adminList->AddGroupError(implode('<br>', $result->getErrorMessages(), $couponID));
                 }
             }
             unset($couponID);
コード例 #3
0
     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();
             if (!CCatalogDiscountCoupon::Delete($ID)) {
                 $DB->Rollback();
                 if ($ex = $APPLICATION->GetException()) {
                     $lAdmin->AddGroupError($ex->GetString(), $ID);
                 } else {
                     $lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("ERROR_DELETE_DISCOUNT_CPN")), $ID);
                 }
             }
             $DB->Commit();
             break;
         case "activate":
         case "deactivate":
             $arFields = array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N");
             if (!CCatalogDiscountCoupon::Update($ID, $arFields)) {
                 if ($ex = $APPLICATION->GetException()) {
                     $lAdmin->AddGroupError($ex->GetString(), $ID);
                 } else {
                     $lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("ERROR_UPDATE_DISCOUNT_CPN")), $ID);
                 }