本文整理汇总了PHP中CatalogClearArray函数的典型用法代码示例。如果您正苦于以下问题:PHP CatalogClearArray函数的具体用法?PHP CatalogClearArray怎么用?PHP CatalogClearArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CatalogClearArray函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DeleteByProduct
function DeleteByProduct($ProductID, $arExceptionIDs = array())
{
global $DB;
$ProductID = intval($ProductID);
if ($ProductID <= 0)
return false;
foreach (GetModuleEvents("catalog", "OnBeforeProductPriceDelete", true) as $arEvent)
{
if (ExecuteModuleEventEx($arEvent, array($ProductID, &$arExceptionIDs))===false)
return false;
}
if (!empty($arExceptionIDs))
CatalogClearArray($arExceptionIDs, false);
if (!empty($arExceptionIDs))
{
$strSql = "DELETE FROM b_catalog_price WHERE PRODUCT_ID = ".$ProductID." AND ID NOT IN (".implode(',',$arExceptionIDs).")";
}
else
{
$strSql = "DELETE FROM b_catalog_price WHERE PRODUCT_ID = ".$ProductID;
}
$mxRes = $DB->Query($strSql, true);
foreach (GetModuleEvents("catalog", "OnProductPriceDelete", true) as $arEvent)
{
ExecuteModuleEventEx($arEvent, array($ProductID,$arExceptionIDs));
}
return $mxRes;
}
示例2: array
}
if ($USER->IsAdmin() && CBXFeatures::IsFeatureEnabled('SaleRecurring'))
{
$arOldAvailContentGroups = array();
$oldAvailContentGroups = (string)Option::get('catalog', 'avail_content_groups');
if ($oldAvailContentGroups != '')
$arOldAvailContentGroups = explode(",", $oldAvailContentGroups);
if (!empty($arOldAvailContentGroups))
$arOldAvailContentGroups = array_fill_keys($arOldAvailContentGroups, true);
$fieldsClear = array();
if (isset($_POST['AVAIL_CONTENT_GROUPS']) && is_array($_POST['AVAIL_CONTENT_GROUPS']))
{
$fieldsClear = $_POST['AVAIL_CONTENT_GROUPS'];
CatalogClearArray($fieldsClear);
foreach ($fieldsClear as &$oneValue)
{
if (isset($arOldAvailContentGroups[$oneValue]))
unset($arOldAvailContentGroups[$oneValue]);
}
if (isset($oneValue))
unset($oneValue);
}
Option::set('catalog', 'avail_content_groups', implode(',', $fieldsClear), '');
if (!empty($arOldAvailContentGroups))
{
$arOldAvailContentGroups = array_keys($arOldAvailContentGroups);
foreach ($arOldAvailContentGroups as &$oneValue)
{
示例3: CouponOneOrderDisable
public static function CouponOneOrderDisable($intOrderID = 0)
{
global $DB;
if (!empty(self::$arOneOrderCoupons)) {
$arCouponID = array_keys(self::$arOneOrderCoupons);
foreach (self::$arOneOrderCoupons as &$arCoupon) {
$arCoupon['USER_ID'] = intval($arCoupon['USER_ID']);
if (0 < $arCoupon['USER_ID']) {
CCatalogDiscountCoupon::EraseCouponByManage($arCoupon['USER_ID'], $arCoupon['COUPON']);
} else {
CCatalogDiscountCoupon::EraseCoupon($arCoupon['COUPON']);
}
}
if (isset($arCoupon)) {
unset($arCoupon);
}
CatalogClearArray($arCouponID, false);
if (!empty($arCouponID)) {
$strSql = "UPDATE b_catalog_discount_coupon SET ACTIVE='N' WHERE ID IN (" . implode(', ', $arCouponID) . ") AND ONE_TIME='" . self::TYPE_ONE_ORDER . "'";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
self::$arOneOrderCoupons = array();
}
}
示例4: getDiscountHandlers
protected function getDiscountHandlers($discountList)
{
global $DB;
$defaultRes = array('MODULES' => array(), 'EXT_FILES' => array());
$result = array();
CatalogClearArray($discountList, true);
if (!empty($discountList)) {
$result = array_fill_keys($discountList, $defaultRes);
$discountIn = implode(', ', $discountList);
$sqlQuery = 'select * from b_catalog_discount_module where DISCOUNT_ID IN (' . $discountIn . ')';
$resQuery = $DB->Query($sqlQuery, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
while ($row = $resQuery->Fetch()) {
$row['DISCOUNT_ID'] = (int) $row['DISCOUNT_ID'];
$result[$row['DISCOUNT_ID']]['MODULES'][] = $row['MODULE_ID'];
}
}
return $result;
}
示例5: CatalogGetPriceTableEx
function CatalogGetPriceTableEx($ID, $filterQauntity = 0, $arFilterType = array(), $VAT_INCLUDE = 'Y', $arCurrencyParams = array())
{
global $USER;
static $arPriceTypes = array();
$ID = (int) $ID;
if ($ID <= 0) {
return false;
}
$filterQauntity = (int) $filterQauntity;
if (!is_array($arFilterType)) {
$arFilterType = array($arFilterType);
}
$boolConvert = false;
$strCurrencyID = '';
$arCurrencyList = array();
if (!empty($arCurrencyParams) && is_array($arCurrencyParams) && !empty($arCurrencyParams['CURRENCY_ID'])) {
$boolConvert = true;
$strCurrencyID = $arCurrencyParams['CURRENCY_ID'];
}
$arResult = array();
$arResult["ROWS"] = array();
$arResult["COLS"] = array();
$arResult["MATRIX"] = array();
$arResult["CAN_BUY"] = array();
$arResult["AVAILABLE"] = "N";
$cacheTime = CATALOG_CACHE_DEFAULT_TIME;
if (defined("CATALOG_CACHE_TIME")) {
$cacheTime = intval(CATALOG_CACHE_TIME);
}
$arUserGroups = $USER->GetUserGroupArray();
CatalogClearArray($arUserGroups, true);
$strCacheID = 'UG_' . implode('_', $arUserGroups);
if (isset($arPriceTypes[$strCacheID])) {
$arPriceGroups = $arPriceTypes[$strCacheID];
} else {
$arPriceGroups = CCatalogGroup::GetGroupsPerms($arUserGroups, array());
$arPriceTypes[$strCacheID] = $arPriceGroups;
}
if (empty($arPriceGroups["view"])) {
return $arResult;
}
$currentQuantity = -1;
$rowsCnt = -1;
$arFilter = array("PRODUCT_ID" => $ID);
if ($filterQauntity > 0) {
$arFilter["+<=QUANTITY_FROM"] = $filterQauntity;
$arFilter["+>=QUANTITY_TO"] = $filterQauntity;
}
if (!empty($arFilterType)) {
$arTmp = array();
foreach ($arPriceGroups["view"] as &$intOneGroup) {
if (in_array($intOneGroup, $arFilterType)) {
$arTmp[] = $intOneGroup;
}
}
if (isset($intOneGroup)) {
unset($intOneGroup);
}
if (empty($arTmp)) {
return $arResult;
}
$arFilter["CATALOG_GROUP_ID"] = $arTmp;
} else {
$arFilter["CATALOG_GROUP_ID"] = $arPriceGroups["view"];
}
$productQuantity = 0;
$productQuantityTrace = "N";
$dbRes = CCatalogProduct::GetVATInfo($ID);
if ($arVatInfo = $dbRes->Fetch()) {
$fVatRate = floatval($arVatInfo['RATE'] * 0.01);
$bVatIncluded = $arVatInfo['VAT_INCLUDED'] == 'Y';
} else {
$fVatRate = 0.0;
$bVatIncluded = false;
}
$rsProducts = CCatalogProduct::GetList(array(), array('ID' => $ID), false, false, array('ID', 'CAN_BUY_ZERO', 'QUANTITY_TRACE', 'QUANTITY'));
if ($arProduct = $rsProducts->Fetch()) {
$intIBlockID = CIBlockElement::GetIBlockByID($arProduct['ID']);
if (!$intIBlockID) {
return false;
}
$arProduct['IBLOCK_ID'] = $intIBlockID;
} else {
return false;
}
$dbPrice = CPrice::GetListEx(array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC"), $arFilter, false, false, array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO"));
while ($arPrice = $dbPrice->Fetch()) {
if ($VAT_INCLUDE == 'N') {
if ($bVatIncluded) {
$arPrice['PRICE'] /= 1 + $fVatRate;
}
} else {
if (!$bVatIncluded) {
$arPrice['PRICE'] *= 1 + $fVatRate;
}
}
$arPrice['VAT_RATE'] = $fVatRate;
CCatalogDiscountSave::Disable();
$arDiscounts = CCatalogDiscount::GetDiscount($ID, $arProduct["IBLOCK_ID"], $arPrice["CATALOG_GROUP_ID"], $arUserGroups, "N", SITE_ID, array());
CCatalogDiscountSave::Enable();
//.........这里部分代码省略.........
示例6: deleteFromSet
protected function deleteFromSet($intID, $arEx)
{
global $DB;
$intID = (int) $intID;
if (0 >= $intID) {
return false;
}
CatalogClearArray($arEx, false);
if (empty($arEx)) {
return false;
}
$strSql = "delete from b_catalog_product_sets where SET_ID=" . $intID . " and ID NOT IN(" . implode(', ', $arEx) . ")";
$DB->Query($strSql, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
return true;
}
示例7: GetItemPrices
public static function GetItemPrices($IBLOCK_ID, $arCatalogPrices, $arItem, $bVATInclude = true, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
{
$arPrices = array();
if (empty($arCatalogPrices) || !is_array($arCatalogPrices))
{
return $arPrices;
}
global $USER;
static $arCurUserGroups = array();
static $strBaseCurrency = '';
if (self::$catalogIncluded === null)
self::$catalogIncluded = \Freetrix\Main\Loader::includeModule('catalog');
if (self::$catalogIncluded)
{
$USER_ID = intval($USER_ID);
$intUserID = $USER_ID;
if (0 >= $intUserID)
$intUserID = $USER->GetID();
if (!isset($arCurUserGroups[$intUserID]))
{
$arUserGroups = (0 < $USER_ID ? CUser::GetUserGroup($USER_ID) : $USER->GetUserGroupArray());
CatalogClearArray($arUserGroups);
$arCurUserGroups[$intUserID] = $arUserGroups;
}
else
{
$arUserGroups = $arCurUserGroups[$intUserID];
}
$boolConvert = false;
$strCurrencyID = '';
if (isset($arCurrencyParams['CURRENCY_ID']) && !empty($arCurrencyParams['CURRENCY_ID']))
{
$boolConvert = true;
$strCurrencyID = $arCurrencyParams['CURRENCY_ID'];
}
if (!$boolConvert && '' == $strBaseCurrency)
$strBaseCurrency = CCurrency::GetBaseCurrency();
$strMinCode = '';
$boolStartMin = true;
$dblMinPrice = 0;
$strMinCurrency = ($boolConvert ? $strCurrencyID : $strBaseCurrency);
CCatalogDiscountSave::Disable();
foreach($arCatalogPrices as $key => $value)
{
if($value["CAN_VIEW"] && strlen($arItem["CATALOG_PRICE_".$value["ID"]]) > 0)
{
// get final price with VAT included.
if ($arItem['CATALOG_VAT_INCLUDED'] != 'Y')
{
$arItem['CATALOG_PRICE_'.$value['ID']] *= (1 + $arItem['CATALOG_VAT'] * 0.01);
}
// so discounts will include VAT
$arDiscounts = CCatalogDiscount::GetDiscount(
$arItem["ID"],
$arItem["IBLOCK_ID"],
array($value["ID"]),
$arUserGroups,
"N",
$LID,
array()
);
$discountPrice = CCatalogProduct::CountPriceWithDiscount(
$arItem["CATALOG_PRICE_".$value["ID"]],
$arItem["CATALOG_CURRENCY_".$value["ID"]],
$arDiscounts
);
// get clear prices WO VAT
$arItem['CATALOG_PRICE_'.$value['ID']] /= (1 + $arItem['CATALOG_VAT'] * 0.01);
$discountPrice /= (1 + $arItem['CATALOG_VAT'] * 0.01);
$vat_value_discount = $discountPrice * $arItem['CATALOG_VAT'] * 0.01;
$vat_discountPrice = $discountPrice + $vat_value_discount;
$vat_value = $arItem['CATALOG_PRICE_'.$value['ID']] * $arItem['CATALOG_VAT'] * 0.01;
$vat_price = $arItem["CATALOG_PRICE_".$value["ID"]] + $vat_value;
if ($boolConvert && $strCurrencyID != $arItem["CATALOG_CURRENCY_".$value["ID"]])
{
$strOrigCurrencyID = $arItem["CATALOG_CURRENCY_".$value["ID"]];
$dblOrigNoVat = $arItem["CATALOG_PRICE_".$value["ID"]];
$dblNoVat = CCurrencyRates::ConvertCurrency($dblOrigNoVat, $strOrigCurrencyID, $strCurrencyID);
$dblVatPrice = CCurrencyRates::ConvertCurrency($vat_price, $strOrigCurrencyID, $strCurrencyID);
$dblVatValue = CCurrencyRates::ConvertCurrency($vat_value, $strOrigCurrencyID, $strCurrencyID);
$dblDiscountValueNoVat = CCurrencyRates::ConvertCurrency($discountPrice, $strOrigCurrencyID, $strCurrencyID);
$dblVatDiscountPrice = CCurrencyRates::ConvertCurrency($vat_discountPrice, $strOrigCurrencyID, $strCurrencyID);
$dblDiscountValueVat = CCurrencyRates::ConvertCurrency($vat_value_discount, $strOrigCurrencyID, $strCurrencyID);
$arPrices[$key] = array(
'ORIG_VALUE_NOVAT' => $dblOrigNoVat,
"VALUE_NOVAT" => $dblNoVat,
"PRINT_VALUE_NOVAT" => CCurrencyLang::CurrencyFormat($dblNoVat, $strCurrencyID, true),
'ORIG_VALUE_VAT' => $vat_price,
"VALUE_VAT" => $dblVatPrice,
"PRINT_VALUE_VAT" => CCurrencyLang::CurrencyFormat($dblVatPrice, $strCurrencyID, true),
//.........这里部分代码省略.........
示例8: SetProductSectionsCache
public static function SetProductSectionsCache($arItemIDs)
{
if (empty($arItemIDs) || !is_array($arItemIDs)) {
return;
}
CatalogClearArray($arItemIDs);
if (empty($arItemIDs)) {
return;
}
if (empty(self::$arCacheProductSections)) {
self::$arCacheProductSections = array_fill_keys($arItemIDs, array());
} else {
foreach ($arItemIDs as &$intOneID) {
self::$arCacheProductSections[$intOneID] = array();
}
unset($intOneID);
}
$rsSections = CIBlockElement::GetElementGroups($arItemIDs, true, array("ID", "IBLOCK_SECTION_ID", "IBLOCK_ELEMENT_ID"));
while ($arSection = $rsSections->Fetch()) {
$arSection['ID'] = (int) $arSection['ID'];
$arSection['IBLOCK_SECTION_ID'] = (int) $arSection['IBLOCK_SECTION_ID'];
$arSection['IBLOCK_ELEMENT_ID'] = (int) $arSection['IBLOCK_ELEMENT_ID'];
self::$arCacheProductSections[$arSection['IBLOCK_ELEMENT_ID']][] = $arSection;
}
unset($arSection, $rsSections);
}
示例9: CheckProducts
public static function CheckProducts($arItemIDs)
{
if (!is_array($arItemIDs)) {
$arItemIDs = array($arItemIDs);
}
CatalogClearArray($arItemIDs);
if (empty($arItemIDs)) {
return false;
}
$arProductList = array();
$rsProducts = CCatalogProduct::GetList(array(), array('@ID' => $arItemIDs), false, false, array('ID'));
while ($arProduct = $rsProducts->Fetch()) {
$arProduct['ID'] = (int) $arProduct['ID'];
$arProductList[$arProduct['ID']] = true;
}
if (empty($arProductList)) {
return false;
}
$boolFlag = true;
foreach ($arItemIDs as &$intItemID) {
if (!isset($arProductList[$intItemID])) {
$boolFlag = false;
break;
}
}
unset($intItemID);
return $boolFlag;
}
示例10: GetDiscountResultCacheKey
public static function GetDiscountResultCacheKey($arDiscountIDs, $strSiteID, $strRenewal, $boolNeedClear = true)
{
$boolNeedClear = !!$boolNeedClear;
if ($boolNeedClear)
{
if (!is_array($arDiscountIDs))
return false;
CatalogClearArray($arDiscountIDs);
if (empty($arDiscountIDs))
return false;
if ('' == $strSiteID)
return false;
$strRenewal = ('Y' == $strRenewal ? 'Y' : 'N');
}
return md5('D'.implode('_', $arDiscountIDs).'-'.'S'.$strSiteID.'-R'.$strRenewal);
}
示例11: GetDiscount
public static function GetDiscount($arParams = array(), $getAll = false)
{
global $DB, $USER;
$arResult = array();
if (!CCatalog::IsUserExists() || !$USER->IsAuthorized() || !self::IsEnabled()) {
return $arResult;
}
foreach (GetModuleEvents("catalog", "OnGetDiscountSave", true) as $arEvent) {
$mxResult = ExecuteModuleEventEx($arEvent, $arParams);
if ($mxResult !== true) {
return $mxResult;
}
}
if (empty($arParams) || !is_array($arParams)) {
return $arResult;
}
$intUserID = 0;
$arUserGroups = array();
$strSiteID = false;
if (isset($arParams['USER_ID'])) {
$intUserID = $arParams['USER_ID'];
}
if (isset($arParams['USER_GROUPS'])) {
$arUserGroups = $arParams['USER_GROUPS'];
}
if (isset($arParams['SITE_ID'])) {
$strSiteID = $arParams['SITE_ID'];
}
if (self::GetDiscountUserID() > 0) {
$intUserID = self::GetDiscountUserID();
$arUserGroups = $USER->GetUserGroup($intUserID);
} else {
$intUserID = (int) $intUserID;
if ($intUserID <= 0) {
$intUserID = $USER->GetID();
$arUserGroups = $USER->GetUserGroupArray();
} else {
if (empty($arUserGroups)) {
$arUserGroups = $USER->GetUserGroup($intUserID);
}
}
}
if (empty($arUserGroups) || !is_array($arUserGroups) || $intUserID <= 0) {
return $arResult;
}
$key = array_search(2, $arUserGroups);
if ($key !== false) {
unset($arUserGroups[$key]);
}
if (empty($arUserGroups)) {
return $arResult;
}
if ($strSiteID === false) {
$strSiteID = SITE_ID;
}
$arCurrentDiscountID = CCatalogDiscountSave::__GetDiscountIDByGroup($arUserGroups);
if (isset($arParams['ID'])) {
CatalogClearArray($arParams['ID'], false);
if (!empty($arParams['ID'])) {
$arCurrentDiscountID = array_intersect($arCurrentDiscountID, $arParams['ID']);
}
}
if (!empty($arCurrentDiscountID)) {
$getAll = $getAll === true;
$intCurrentTime = getmicrotime();
$strDate = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCurrentTime);
$arFilter = array('ID' => $arCurrentDiscountID, 'SITE_ID' => $strSiteID, 'TYPE' => self::ENTITY_ID, 'ACTIVE' => 'Y', '+<=ACTIVE_FROM' => $strDate, '+>=ACTIVE_TO' => $strDate);
CTimeZone::Disable();
$rsDiscSaves = CCatalogDiscountSave::GetList(array(), $arFilter);
CTimeZone::Enable();
while ($arDiscSave = $rsDiscSaves->Fetch()) {
$arDiscSave['ACTION_SIZE'] = (int) $arDiscSave['ACTION_SIZE'];
$arDiscSave['COUNT_SIZE'] = (int) $arDiscSave['COUNT_SIZE'];
$arDiscSave['ACTIVE_FROM_UT'] = false;
$arDiscSave['ACTIVE_TO_UT'] = false;
$arDiscSave['COUNT_FROM_UT'] = false;
$arDiscSave['COUNT_TO_UT'] = false;
$strCountPeriod = self::COUNT_TIME_ALL;
$strActionPeriod = self::ACTION_TIME_ALL;
$arCountPeriodBack = array();
$arActionPeriodBack = array();
$arActionPeriod = array();
$arStartDate = false;
$arOldOrderSumm = false;
$arOrderSumm = false;
$boolPeriodInsert = true;
$intCountTime = $intCurrentTime;
$arOrderFilter = array('USER_ID' => $intUserID, 'LID' => $arDiscSave['SITE_ID'], 'PAYED' => 'Y', 'CANCELED' => 'N');
$arOldOrderFilter = $arOrderFilter;
if (!empty($arDiscSave['ACTIVE_FROM']) || !empty($arDiscSave['ACTIVE_TO'])) {
$strActionPeriod = self::ACTION_TIME_INTERVAL;
if (!empty($arDiscSave['ACTIVE_FROM'])) {
$arDiscSave['ACTIVE_FROM_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_FROM']);
}
if (!empty($arDiscSave['ACTIVE_TO'])) {
$arDiscSave['ACTIVE_TO_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_TO']);
}
} elseif ($arDiscSave['ACTION_SIZE'] > 0 && in_array($arDiscSave['ACTION_TYPE'], array('D', 'M', 'Y'))) {
$strActionPeriod = self::ACTION_TIME_PERIOD;
$arActionPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE']);
//.........这里部分代码省略.........