當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CCatalogDiscount::_Update方法代碼示例

本文整理匯總了PHP中CCatalogDiscount::_Update方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCatalogDiscount::_Update方法的具體用法?PHP CCatalogDiscount::_Update怎麽用?PHP CCatalogDiscount::_Update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CCatalogDiscount的用法示例。


在下文中一共展示了CCatalogDiscount::_Update方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Update

 public function Update($ID, $arFields)
 {
     global $DB;
     $ID = intval($ID);
     $boolUpdateRestrictions = false;
     if (isset($arFields['GROUP_IDS']) && is_array($arFields['GROUP_IDS']) || isset($arFields['CATALOG_GROUP_IDS']) && is_array($arFields['CATALOG_GROUP_IDS'])) {
         $boolUpdateRestrictions = true;
     }
     if ($boolUpdateRestrictions) {
         $mxRows = self::__ParseArrays($arFields);
         if (!is_array($mxRows) || empty($mxRows)) {
             return false;
         }
     }
     $boolNewVersion = true;
     if (!is_set($arFields, 'CONDITIONS')) {
         self::__ConvertOldConditions('UPDATE', $arFields);
         $boolNewVersion = false;
     }
     if (!CCatalogDiscount::_Update($ID, $arFields)) {
         return false;
     }
     if ($boolNewVersion) {
         $arValuesList = self::__GetConditionValues($arFields);
         if (is_array($arValuesList) && !empty($arValuesList)) {
             self::__GetOldOneEntity($arFields, $arValuesList, 'IBLOCK_IDS', 'CondIBIBlock');
             self::__GetOldOneEntity($arFields, $arValuesList, 'SECTION_IDS', 'CondIBSection');
             self::__GetOldOneEntity($arFields, $arValuesList, 'PRODUCT_IDS', 'CondIBElement');
         }
     }
     if ($boolUpdateRestrictions) {
         if (!CCatalogDiscount::__UpdateSubdiscount($ID, $mxRows)) {
             return false;
         }
     }
     CCatalogDiscount::__UpdateOldEntities($ID, $arFields, true);
     if (is_set($arFields, "CATALOG_COUPONS")) {
         if (!is_array($arFields["CATALOG_COUPONS"])) {
             $arFields["CATALOG_COUPONS"] = array("DISCOUNT_ID" => $ID, "ACTIVE" => "Y", "ONE_TIME" => "Y", "COUPON" => $arFields["CATALOG_COUPONS"], "DATE_APPLY" => false);
         }
         $arKeys = array_keys($arFields["CATALOG_COUPONS"]);
         if (!is_array($arFields["CATALOG_COUPONS"][$arKeys[0]])) {
             $arFields["CATALOG_COUPONS"] = array($arFields["CATALOG_COUPONS"]);
         }
         foreach ($arFields["CATALOG_COUPONS"] as &$arOneCoupon) {
             if (!empty($arOneCoupon['COUPON'])) {
                 $arOneCoupon['DISCOUNT_ID'] = $ID;
                 CCatalogDiscountCoupon::Add($arOneCoupon, false);
             }
             if (isset($arOneCoupon)) {
                 unset($arOneCoupon);
             }
         }
     }
     CCatalogDiscount::SaveFilterOptions();
     foreach (GetModuleEvents("catalog", "OnDiscountUpdate", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     return $ID;
 }
開發者ID:k-kalashnikov,項目名稱:geekcon_new,代碼行數:60,代碼來源:discount.php

示例2: Update

 public function Update($ID, $arFields)
 {
     $ID = (int) $ID;
     if ($ID <= 0) {
         return false;
     }
     foreach (GetModuleEvents("catalog", "OnBeforeDiscountUpdate", true) as $arEvent) {
         if (false === ExecuteModuleEventEx($arEvent, array($ID, &$arFields))) {
             return false;
         }
     }
     $boolExistUserGroups = isset($arFields['GROUP_IDS']) && is_array($arFields['GROUP_IDS']);
     $boolExistPriceTypes = isset($arFields['CATALOG_GROUP_IDS']) && is_array($arFields['CATALOG_GROUP_IDS']);
     $boolUpdateRestrictions = $boolExistUserGroups || $boolExistPriceTypes || isset($arFields['ACTIVE']);
     $mxRows = false;
     if ($boolUpdateRestrictions) {
         if (!$boolExistUserGroups) {
             if (!CCatalogDiscount::__FillArrays($ID, $arFields, 'GROUP_IDS')) {
                 return false;
             }
         }
         if (!$boolExistPriceTypes) {
             if (!CCatalogDiscount::__FillArrays($ID, $arFields, 'CATALOG_GROUP_IDS')) {
                 return false;
             }
         }
         $mxRows = self::__ParseArrays($arFields);
         if (empty($mxRows) || !is_array($mxRows)) {
             return false;
         }
     }
     $boolNewVersion = true;
     if (!array_key_exists('CONDITIONS', $arFields)) {
         self::__ConvertOldConditions('UPDATE', $arFields);
         $boolNewVersion = false;
     }
     if (!CCatalogDiscount::_Update($ID, $arFields)) {
         return false;
     }
     if ($boolNewVersion) {
         $arValuesList = self::__GetConditionValues($arFields);
         if (is_array($arValuesList) && !empty($arValuesList)) {
             self::__GetOldOneEntity($arFields, $arValuesList, 'IBLOCK_IDS', 'CondIBIBlock');
             self::__GetOldOneEntity($arFields, $arValuesList, 'SECTION_IDS', 'CondIBSection');
             self::__GetOldOneEntity($arFields, $arValuesList, 'PRODUCT_IDS', 'CondIBElement');
         }
     }
     if ($boolUpdateRestrictions) {
         if (!CCatalogDiscount::__UpdateSubdiscount($ID, $mxRows, isset($arFields['ACTIVE']) ? $arFields['ACTIVE'] : '')) {
             return false;
         }
     }
     CCatalogDiscount::__UpdateOldEntities($ID, $arFields, true);
     if (array_key_exists('CATALOG_COUPONS', $arFields)) {
         if (!is_array($arFields["CATALOG_COUPONS"])) {
             $arFields["CATALOG_COUPONS"] = array("DISCOUNT_ID" => $ID, "ACTIVE" => "Y", "ONE_TIME" => "Y", "COUPON" => $arFields["CATALOG_COUPONS"], "DATE_APPLY" => false);
         }
         $arKeys = array_keys($arFields["CATALOG_COUPONS"]);
         if (!is_array($arFields["CATALOG_COUPONS"][$arKeys[0]])) {
             $arFields["CATALOG_COUPONS"] = array($arFields["CATALOG_COUPONS"]);
         }
         foreach ($arFields["CATALOG_COUPONS"] as &$arOneCoupon) {
             if (!empty($arOneCoupon['COUPON'])) {
                 $arOneCoupon['DISCOUNT_ID'] = $ID;
                 CCatalogDiscountCoupon::Add($arOneCoupon, false);
             }
             if (isset($arOneCoupon)) {
                 unset($arOneCoupon);
             }
         }
     }
     foreach (GetModuleEvents("catalog", "OnDiscountUpdate", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     return $ID;
 }
開發者ID:rasuldev,項目名稱:torino,代碼行數:76,代碼來源:discount.php


注:本文中的CCatalogDiscount::_Update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。