本文整理汇总了PHP中CCatalogDiscountSave::GetGroupByDiscount方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscountSave::GetGroupByDiscount方法的具体用法?PHP CCatalogDiscountSave::GetGroupByDiscount怎么用?PHP CCatalogDiscountSave::GetGroupByDiscount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscountSave
的用法示例。
在下文中一共展示了CCatalogDiscountSave::GetGroupByDiscount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __UpdateGroupsCache
protected function __UpdateGroupsCache($intID, $arGroups = array())
{
global $DB;
$intID = intval($intID);
if (0 >= $intID) {
return false;
}
if (!is_array($arGroups) || empty($arGroups)) {
$rsDiscGroups = CCatalogDiscountSave::GetGroupByDiscount(array(), array('DISCOUNT_ID' => $intID), false, false, array('GROUP_ID'));
while ($arDiscGroup = $rsDiscGroups->Fetch()) {
$arGroups[] = $arDiscGroup['GROUP_ID'];
}
}
if (empty($arGroups)) {
return false;
}
$arDiscountSaveGroups = array();
$strDataFileName = CATALOG_DISCOUNT_SAVE_FILE;
if (file_exists($_SERVER["DOCUMENT_ROOT"] . $strDataFileName) && is_file($_SERVER["DOCUMENT_ROOT"] . $strDataFileName)) {
include $_SERVER["DOCUMENT_ROOT"] . $strDataFileName;
}
if (!empty($arDiscountSaveGroups)) {
foreach ($arDiscountSaveGroups as $intGroup => $arCurDisc) {
$key = array_search($intID, $arCurDisc);
if (false !== $key) {
unset($arDiscountSaveGroups[$intGroup][$key]);
if (empty($arDiscountSaveGroups[$intGroup])) {
unset($arDiscountSaveGroups[$intGroup]);
}
}
}
}
foreach ($arGroups as &$intGroup) {
if (isset($arDiscountSaveGroups[$intGroup])) {
if (!in_array($intID, $arDiscountSaveGroups[$intGroup])) {
$arDiscountSaveGroups[$intGroup][] = $intID;
}
} else {
$arDiscountSaveGroups[$intGroup] = array();
$arDiscountSaveGroups[$intGroup][] = $intID;
}
}
if (isset($intGroup)) {
unset($intGroup);
}
ignore_user_abort(true);
if ($fp = @fopen($_SERVER["DOCUMENT_ROOT"] . $strDataFileName, "wb")) {
if (flock($fp, LOCK_EX)) {
fwrite($fp, "<" . "?\n");
fwrite($fp, "\$arDiscountSaveGroups=unserialize('" . serialize($arDiscountSaveGroups) . "');");
fwrite($fp, "if(!is_array(\$arDiscountSaveGroups))\$arDiscountSaveGroups=array();\n");
fwrite($fp, "?" . ">");
fflush($fp);
flock($fp, LOCK_UN);
fclose($fp);
}
}
ignore_user_abort(false);
return true;
}
示例2: array
$str_COUNT_SIZE = 0;
$str_COUNT_TYPE = 'M';
$str_COUNT_FROM = '';
$str_COUNT_TO = '';
$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';