当前位置: 首页>>代码示例>>PHP>>正文


PHP CCatalogDiscount::__UpdateSubdiscount方法代码示例

本文整理汇总了PHP中CCatalogDiscount::__UpdateSubdiscount方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount::__UpdateSubdiscount方法的具体用法?PHP CCatalogDiscount::__UpdateSubdiscount怎么用?PHP CCatalogDiscount::__UpdateSubdiscount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCatalogDiscount的用法示例。


在下文中一共展示了CCatalogDiscount::__UpdateSubdiscount方法的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::__UpdateSubdiscount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。