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


PHP CCatalogDiscountSave::GetRangeByDiscount方法代码示例

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


在下文中一共展示了CCatalogDiscountSave::GetRangeByDiscount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetDiscount


//.........这里部分代码省略.........
                     }
                     if (false !== $arDiscSave['COUNT_TO_UT'] && $arDiscSave['COUNT_TO_UT'] <= $arDiscSave['COUNT_FROM_UT']) {
                         continue;
                     }
                     if (false !== $arDiscSave['ACTIVE_TO_UT'] && $arDiscSave['COUNT_FROM_UT'] >= $arDiscSave['ACTIVE_TO_UT']) {
                         continue;
                     }
                 }
                 if (false !== $arDiscSave['COUNT_TO_UT']) {
                     if ($strActionPeriod == self::ACTION_TIME_PERIOD && $arDiscSave['COUNT_TO_UT'] < AddToTimeStamp($arActionPeriodBack, $intCountTime)) {
                         continue;
                     }
                 }
             }
             if ($strActionPeriod == self::ACTION_TIME_PERIOD) {
                 if ($strCountPeriod == self::COUNT_TIME_PERIOD) {
                     $arStartDate = CCatalogDiscountSave::__GetUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriodBack, $intCountTime))));
                     if (is_array($arStartDate) && !empty($arStartDate)) {
                         $arOldOrderFilter['<DATE_INSERT'] = $arStartDate['ACTIVE_FROM_FORMAT'];
                         $arOldOrderFilter['>=DATE_INSERT'] = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arCountPeriodBack, MakeTimeStamp($arStartDate['ACTIVE_FROM_FORMAT'])));
                         $arOldOrderSumm = CCatalogDiscountSave::__SaleOrderSumm($arOldOrderFilter, $arDiscSave['CURRENCY']);
                     }
                 } else {
                     $arStartDate = CCatalogDiscountSave::__GetUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID), array('ACTIVE_FROM' => false, 'DELETE' => false));
                     if (is_array($arStartDate) && !empty($arStartDate)) {
                         $intTimeStart = MakeTimeStamp($arStartDate['ACTIVE_FROM_FORMAT']);
                         $intTimeFinish = MakeTimeStamp($arStartDate['ACTIVE_TO_FORMAT']);
                         if (!($intTimeStart <= $intCountTime && $intTimeFinish >= $intCountTime)) {
                             continue;
                         } else {
                             $boolPeriodInsert = false;
                         }
                     }
                 }
             }
             $intTimeStart = false;
             $intTimeFinish = false;
             if ($strCountPeriod == self::COUNT_TIME_INTERVAL) {
                 $intTimeStart = !empty($arDiscSave['COUNT_FROM']) ? $arDiscSave['COUNT_FROM'] : false;
                 $intTimeFinish = !empty($arDiscSave['COUNT_TO']) ? $arDiscSave['COUNT_TO'] : false;
             } elseif ($strCountPeriod == self::COUNT_TIME_PERIOD) {
                 $intTimeStart = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arCountPeriodBack, $intCountTime));
             }
             if ($intTimeStart) {
                 $arOrderFilter['>=DATE_INSERT'] = $intTimeStart;
             }
             if ($intTimeFinish) {
                 $arOrderFilter['<DATE_INSERT'] = $intTimeFinish;
             }
             $arOrderSumm = CCatalogDiscountSave::__SaleOrderSumm($arOrderFilter, $arDiscSave['CURRENCY']);
             if (is_array($arOldOrderSumm) && 0 < $arOldOrderSumm['RANGE_SUMM']) {
                 if ($arOrderSumm['RANGE_SUMM'] <= $arOldOrderSumm['RANGE_SUMM']) {
                     $arOrderSumm = $arOldOrderSumm;
                 } else {
                     $arOldOrderSumm = false;
                 }
             }
             $rsRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'DESC'), array('DISCOUNT_ID' => $arDiscSave['ID'], '<=RANGE_FROM' => $arOrderSumm['RANGE_SUMM']), false, array('nTopCount' => 1));
             $arRange = $rsRanges->Fetch();
             if (!empty($arRange) || $getAll) {
                 if (!empty($arRange)) {
                     if ($strActionPeriod == self::ACTION_TIME_PERIOD) {
                         if ($strCountPeriod == self::COUNT_TIME_PERIOD) {
                             if (!is_array($arOldOrderSumm)) {
                                 CCatalogDiscountSave::__UpdateUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCountTime), 'ACTIVE_TO' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriod, $intCountTime)), 'RANGE_FROM' => -1));
                             }
                         } else {
                             if ($boolPeriodInsert) {
                                 CCatalogDiscountSave::__UpdateUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCountTime), 'ACTIVE_TO' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriod, $intCountTime)), 'RANGE_FROM' => -1), array('SEARCH' => true, 'DELETE' => false));
                             }
                         }
                     }
                 }
                 unset($arDiscSave['ACTIVE_FROM_UT'], $arDiscSave['ACTIVE_TO_UT'], $arDiscSave['COUNT_FROM_UT'], $arDiscSave['COUNT_TO_UT']);
                 $arOneResult = $arDiscSave;
                 if (!empty($arRange)) {
                     $arOneResult['VALUE'] = $arRange['VALUE'];
                     $arOneResult['VALUE_TYPE'] = $arRange['TYPE'];
                     $arOneResult['RANGE_FROM'] = $arRange['RANGE_FROM'];
                     $arOneResult['MAX_DISCOUNT'] = 0;
                 } else {
                     $arOneResult['VALUE'] = 0;
                     $arOneResult['VALUE_TYPE'] = self::TYPE_PERCENT;
                     $arOneResult['MAX_DISCOUNT'] = 0;
                     $rsRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'ASC'), array('DISCOUNT_ID' => $arDiscSave['ID']), false, array('nTopCount' => 1));
                     $arRange = $rsRanges->Fetch();
                     $arOneResult['NEXT_RANGE_FROM'] = $arRange['RANGE_FROM'];
                     $arOneResult['NEXT_VALUE'] = $arRange['VALUE'];
                     $arOneResult['NEXT_VALUE_TYPE'] = $arRange['TYPE'];
                 }
                 $arOneResult['SUMM'] = $arOrderSumm['SUMM'];
                 $arOneResult['SUMM_CURRENCY'] = $arOrderSumm['CURRENCY'];
                 $arOneResult['RANGE_SUMM'] = $arOrderSumm['RANGE_SUMM'];
                 $arOneResult['LAST_ORDER_DATE'] = $arOrderSumm['LAST_ORDER_DATE'];
                 $arResult[] = $arOneResult;
             }
         }
     }
     return $arResult;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:discount_save.php

示例2: array

$str_ACTION_SIZE = 0;
$str_ACTION_TYPE = 'M';
$arRanges = array();
$arGroupList = array();
if ($ID > 0) {
    $rsDiscSaves = CCatalogDiscountSave::GetByID($ID);
    if (!$rsDiscSaves->ExtractFields("str_")) {
        $ID = 0;
    }
}
if ($ID > 0) {
    $rsDiscGroups = CCatalogDiscountSave::GetGroupByDiscount(array(), array('DISCOUNT_ID' => $ID));
    while ($arDiscGroup = $rsDiscGroups->Fetch()) {
        $arGroupList[] = $arDiscGroup['GROUP_ID'];
    }
    $rsDiscRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'ASC'), array('DISCOUNT_ID' => $ID));
    while ($arDiscRange = $rsDiscRanges->Fetch()) {
        $arRanges[] = $arDiscRange;
    }
}
if (!isset($COUNT_PERIOD)) {
    if ('' != $str_COUNT_FROM || '' != $str_COUNT_TO) {
        $str_COUNT_PERIOD = 'D';
    } elseif (0 < intval($str_COUNT_SIZE)) {
        $str_COUNT_PERIOD = 'P';
    } else {
        $str_COUNT_PERIOD = 'U';
    }
} else {
    $str_COUNT_PERIOD = $COUNT_PERIOD;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:cat_discsave_edit.php

示例3: GetDiscount


//.........这里部分代码省略.........
                         $arDiscSave['COUNT_TO'] = ConvertTimeStamp($intCountTime, 'FULL');
                     }
                 }
             } elseif (0 < $arDiscSave['COUNT_SIZE'] && in_array($arDiscSave['COUNT_TYPE'], array('D', 'M', 'Y'))) {
                 $strCountPeriod = 'P';
                 $arCountPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['COUNT_SIZE'], $arDiscSave['COUNT_TYPE']);
             }
             if ('D' == $strCountPeriod) {
                 if (false !== $arDiscSave['COUNT_FROM_UT']) {
                     if ($arDiscSave['COUNT_FROM_UT'] > $intCountTime) {
                         continue;
                     }
                     if (false !== $arDiscSave['COUNT_TO_UT'] && $arDiscSave['COUNT_TO_UT'] <= $arDiscSave['COUNT_FROM_UT']) {
                         continue;
                     }
                     if (false !== $arDiscSave['ACTIVE_TO_UT'] && $arDiscSave['COUNT_FROM_UT'] >= $arDiscSave['ACTIVE_TO_UT']) {
                         continue;
                     }
                 }
                 if (false !== $arDiscSave['COUNT_TO_UT']) {
                     if ('P' == $strActionPeriod && $arDiscSave['COUNT_TO_UT'] < AddToTimeStamp($arActionPeriodBack, $intCountTime)) {
                         continue;
                     }
                 }
             }
             if ('P' == $strActionPeriod) {
                 if ('P' == $strCountPeriod) {
                     $arStartDate = CCatalogDiscountSave::__GetUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriodBack, $intCountTime))));
                     if (is_array($arStartDate) && !empty($arStartDate)) {
                         $arOldOrderFilter['<DATE_INSERT'] = $arStartDate['ACTIVE_FROM_FORMAT'];
                         $arOldOrderFilter['>=DATE_INSERT'] = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arCountPeriodBack, MakeTimeStamp($arStartDate['ACTIVE_FROM_FORMAT'])));
                         $arOldOrderSumm = CCatalogDiscountSave::__SaleOrderSumm($arOldOrderFilter, $arDiscSave['CURRENCY']);
                     }
                 } else {
                     $arStartDate = CCatalogDiscountSave::__GetUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID), array('ACTIVE_FROM' => false, 'DELETE' => false));
                     if (is_array($arStartDate) && !empty($arStartDate)) {
                         $intTimeStart = MakeTimeStamp($arStartDate['ACTIVE_FROM_FORMAT']);
                         $intTimeFinish = MakeTimeStamp($arStartDate['ACTIVE_TO_FORMAT']);
                         if (!($intTimeStart <= $intCountTime && $intTimeFinish >= $intCountTime)) {
                             continue;
                         } else {
                             $boolPeriodInsert = false;
                         }
                     }
                 }
             }
             $intTimeStart = false;
             $intTimeFinish = false;
             if ('D' == $strCountPeriod) {
                 $intTimeStart = !empty($arDiscSave['COUNT_FROM']) ? $arDiscSave['COUNT_FROM'] : false;
                 $intTimeFinish = !empty($arDiscSave['COUNT_TO']) ? $arDiscSave['COUNT_TO'] : false;
             } elseif ('P' == $strCountPeriod) {
                 $intTimeStart = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arCountPeriodBack, $intCountTime));
             }
             if ($intTimeStart) {
                 $arOrderFilter['>=DATE_INSERT'] = $intTimeStart;
             }
             if ($intTimeFinish) {
                 $arOrderFilter['<DATE_INSERT'] = $intTimeFinish;
             }
             $arOrderSumm = CCatalogDiscountSave::__SaleOrderSumm($arOrderFilter, $arDiscSave['CURRENCY']);
             if (is_array($arOldOrderSumm) && 0 < $arOldOrderSumm['RANGE_SUMM']) {
                 if ($arOrderSumm['RANGE_SUMM'] <= $arOldOrderSumm['RANGE_SUMM']) {
                     $arOrderSumm = $arOldOrderSumm;
                 } else {
                     $arOldOrderSumm = false;
                 }
             }
             $rsRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'desc'), array('DISCOUNT_ID' => $arDiscSave['ID'], '<=RANGE_FROM' => $arOrderSumm['RANGE_SUMM']), false, array('nTopCount' => 1));
             if ($arRange = $rsRanges->Fetch()) {
                 if ('P' == $strActionPeriod) {
                     if ('P' == $strCountPeriod) {
                         if (!is_array($arOldOrderSumm)) {
                             CCatalogDiscountSave::__UpdateUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCountTime), 'ACTIVE_TO' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriod, $intCountTime)), 'RANGE_FROM' => -1));
                         }
                     } else {
                         if ($boolPeriodInsert) {
                             CCatalogDiscountSave::__UpdateUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCountTime), 'ACTIVE_TO' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriod, $intCountTime)), 'RANGE_FROM' => -1), array('SEARCH' => true, 'DELETE' => false));
                         }
                     }
                 }
                 unset($arDiscSave['ACTIVE_FROM_UT']);
                 unset($arDiscSave['ACTIVE_TO_UT']);
                 unset($arDiscSave['COUNT_FROM_UT']);
                 unset($arDiscSave['COUNT_TO_UT']);
                 $arOneResult = array();
                 $arOneResult = $arDiscSave;
                 $arOneResult['VALUE'] = $arRange['VALUE'];
                 $arOneResult['VALUE_TYPE'] = $arRange['TYPE'];
                 $arOneResult['RANGE_FROM'] = $arRange['RANGE_FROM'];
                 $arOneResult['SUMM'] = $arOrderSumm['SUMM'];
                 $arOneResult['SUMM_CURRENCY'] = $arOrderSumm['CURRENCY'];
                 $arOneResult['RANGE_SUMM'] = $arOrderSumm['RANGE_SUMM'];
                 $arOneResult['LAST_ORDER_DATE'] = $arOrderSumm['LAST_ORDER_DATE'];
                 $arResult[] = $arOneResult;
             }
         }
     }
     return $arResult;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:discount_save.php

示例4: intval

    $arParams['USER_ID'] = intval($USER->GetID());
}
if (0 >= $arParams['USER_ID']) {
    return;
}
$arParams['SHOW_NEXT_LEVEL'] = isset($arParams['SHOW_NEXT_LEVEL']) && 'Y' == $arParams['SHOW_NEXT_LEVEL'] ? 'Y' : 'N';
if (!CModule::IncludeModule('catalog')) {
    return;
}
if (!CBXFeatures::IsFeatureEnabled('CatDiscountSave')) {
    CCatalogDiscountSave::Disable();
    ShowError(GetMessage("CAT_FEATURE_NOT_ALLOW"));
    return;
}
$arFields = array('USER_ID' => $arParams['USER_ID'], 'SITE_ID' => $arParams['SITE_ID']);
$arResult = CCatalogDiscountSave::GetDiscount($arFields);
if (!empty($arResult)) {
    foreach ($arResult as $key => $arDiscountSave) {
        if ('Y' == $arParams['SHOW_NEXT_LEVEL']) {
            $rsRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'ASC'), array('DISCOUNT_ID' => $arDiscountSave['ID'], '>RANGE_FROM' => $arDiscountSave['RANGE_FROM'], false, array('nTopCount' => 1)));
            if ($arRange = $rsRanges->Fetch()) {
                $arTempo = array('RANGE_FROM' => $arRange['RANGE_FROM'], 'VALUE' => $arRange['VALUE'], 'VALUE_TYPE' => $arRange['TYPE']);
                $arDiscountSave['NEXT_LEVEL'] = $arTempo;
            }
        }
        $arDiscountSave['~NAME'] = $arDiscountSave['NAME'];
        $arDiscountSave['NAME'] = htmlspecialcharsex($arDiscountSave['NAME']);
        $arResult[$key] = $arDiscountSave;
    }
}
$this->IncludeComponentTemplate();
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php


注:本文中的CCatalogDiscountSave::GetRangeByDiscount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。