本文整理汇总了PHP中CCatalogDiscount::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount::GetList方法的具体用法?PHP CCatalogDiscount::GetList怎么用?PHP CCatalogDiscount::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscount
的用法示例。
在下文中一共展示了CCatalogDiscount::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllDiscountByID
/**
* get all discount by product id
*/
function getAllDiscountByID($PRODUCT_ID)
{
global $DB;
global $APPLICATION;
$dbProductDiscounts = CCatalogDiscount::GetList(array("SORT" => "ASC"), array("+PRODUCT_ID" => $PRODUCT_ID, "ACTIVE" => "Y", "!>ACTIVE_FROM" => $DB->FormatDate(date("Y-m-d H:i:s"), "YYYY-MM-DD HH:MI:SS", CSite::GetDateFormat("FULL")), "!<ACTIVE_TO" => $DB->FormatDate(date("Y-m-d H:i:s"), "YYYY-MM-DD HH:MI:SS", CSite::GetDateFormat("FULL")), "COUPON" => ""), false, false, array("ID", "SITE_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "RENEWAL", "NAME", "SORT", "MAX_DISCOUNT", "VALUE_TYPE", "VALUE", "CURRENCY", "PRODUCT_ID"));
$arrAllDiscounts = array();
while ($arProductDiscounts = $dbProductDiscounts->Fetch()) {
$arrAllDiscounts[] = $arProductDiscounts;
}
return $arrAllDiscounts;
}
示例2: _Update
public function _Update($ID, &$arFields)
{
global $DB;
global $stackCacheManager;
global $APPLICATION;
$ID = intval($ID);
if ($ID <= 0)
return false;
if (!CCatalogDiscount::CheckFields("UPDATE", $arFields, $ID))
return false;
if (isset($arFields['VALUE']) != isset($arFields['VALUE_TYPE']))
{
$rsDiscounts = CCatalogDiscount::GetList(array(),array('ID' => $ID), false, array('nTopCount' => 1), array('ID', 'VALUE', 'VALUE_TYPE'));
if ($arDiscount = $rsDiscounts->Fetch())
{
if (!isset($arFields['VALUE']))
$arFields['VALUE'] = doubleval($arDiscount['VALUE']);
if (!isset($arFields['VALUE_TYPE']))
$arFields['VALUE_TYPE'] = $arDiscount['VALUE_TYPE'];
if (self::TYPE_PERCENT == $arFields['VALUE_TYPE'] && 100 < $arFields['VALUE'])
{
$APPLICATION->ThrowException(GetMessage("BT_MOD_CATALOG_DISC_ERR_BAD_VALUE"), "VALUE");
return false;
}
}
else
{
$APPLICATION->ThrowException(str_replace('#ID#', $ID, GetMessage("BT_MOD_CATALOG_DISC_ERR_BAD_ID")), "ID");
return false;
}
}
$stackCacheManager->Clear("catalog_discount");
$strUpdate = $DB->PrepareUpdate("b_catalog_discount", $arFields);
if (!empty($strUpdate))
{
$strSql = "UPDATE b_catalog_discount SET ".$strUpdate." WHERE ID = ".$ID." AND TYPE = ".self::ENTITY_ID;
$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if (isset($arFields['HANDLERS']))
self::updateDiscountHandlers($ID, $arFields['HANDLERS'], true);
}
return $ID;
}
示例3: _Update
static public function _Update($ID, &$arFields)
{
global $DB;
global $stackCacheManager;
global $USER;
global $APPLICATION;
$ID = intval($ID);
if ($ID <= 0)
return false;
$arFields1 = array();
if (array_key_exists('CREATED_BY',$arFields))
unset($arFields['CREATED_BY']);
if (array_key_exists('DATE_CREATE',$arFields))
unset($arFields['DATE_CREATE']);
if (array_key_exists('TIMESTAMP_X', $arFields))
unset($arFields['TIMESTAMP_X']);
if (isset($USER) && $USER instanceof CUser && 'CUser' == get_class($USER))
{
if (!array_key_exists('MODIFIED_BY', $arFields) || intval($arFields["MODIFIED_BY"]) <= 0)
$arFields["MODIFIED_BY"] = intval($USER->GetID());
}
$arFields1['TIMESTAMP_X'] = $DB->GetNowFunction();
if (!CCatalogDiscount::CheckFields("UPDATE", $arFields, $ID))
return false;
if (isset($arFields['VALUE']) != isset($arFields['VALUE_TYPE']))
{
$rsDiscounts = CCatalogDiscount::GetList(array(),array('ID' => $ID), false, array('nTopCount' => 1), array('ID', 'VALUE', 'VALUE_TYPE'));
if ($arDiscount = $rsDiscounts->Fetch())
{
if (!isset($arFields['VALUE']))
$arFields['VALUE'] = doubleval($arDiscount['VALUE']);
if (!isset($arFields['VALUE_TYPE']))
$arFields['VALUE_TYPE'] = $arDiscount['VALUE_TYPE'];
if ('P' == $arFields['VALUE_TYPE'] && 100 < $arFields['VALUE'])
{
$APPLICATION->ThrowException(GetMessage("BT_MOD_CATALOG_DISC_ERR_BAD_VALUE"), "VALUE");
return false;
}
}
else
{
$APPLICATION->ThrowException(str_replace('#ID#', $ID, GetMessage("BT_MOD_CATALOG_DISC_ERR_BAD_ID")), "ID");
return false;
}
}
$stackCacheManager->Clear("catalog_discount");
$strUpdate = $DB->PrepareUpdate("b_catalog_discount", $arFields);
if (!empty($strUpdate))
{
$arAdd = array();
if (!empty($arFields1))
{
foreach ($arFields1 as $key => $value)
{
$arAdd[] = $key."=".$value;
}
$strUpdate .= ', '.implode(', ', $arAdd);
}
$strSql = "UPDATE b_catalog_discount SET ".$strUpdate." WHERE ID = ".$ID." AND TYPE = ".DISCOUNT_TYPE_STANDART;
$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
}
return $ID;
}
示例4: foreach
$arCurrencyInfo = CCurrency::GetByID($arParams['CURRENCY_ID']);
if (!(is_array($arCurrencyInfo) && !empty($arCurrencyInfo))) {
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
} else {
$arParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
$arConvertParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
}
}
}
foreach ($arResult["ITEMS"] as $key => $arItem) {
$rsOffers = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $arInfo["IBLOCK_ID"], "PROPERTY_" . $arInfo["SKU_PROPERTY_ID"] => $arItem["ID"]), false, false, array("ID", "CATALOG_QUANTITY"));
$arOffers = CIBlockPriceTools::GetOffersArray($arParams["IBLOCK_ID"], $arItem["ID"], array($arParams["OFFERS_SORT_FIELD"] => $arParams["OFFERS_SORT_ORDER"], "ID" => "DESC"), $arParams["OFFERS_FIELD_CODE"], $arParams["OFFERS_PROPERTY_CODE"], $arParams["OFFERS_LIMIT"], $arResult["PRICES"], $arParams['PRICE_VAT_INCLUDE'], $arConvertParams);
foreach ($arOffers as $arOffer) {
$arResult["ITEMS"][$key]["OFFERS"][] = $arOffer;
$dbProductDiscounts = CCatalogDiscount::GetList(array(), array("PRODUCT_ID" => $arOffer["ID"]));
if ($dbProductDiscounts && $dbProductDiscounts->SelectedRowsCount() > 0) {
while ($arProductDiscounts = $dbProductDiscounts->GetNext()) {
if ($arProductDiscounts["VALUE_TYPE"] == "F") {
echo "f";
$i = 0;
foreach ($arResult["ITEMS"][$key]["OFFERS"] as $item_offer) {
$j = 0;
foreach ($item_offer["PRICES"] as $item_prices) {
$arResult["ITEMS"][$key]["OFFERS"][$i]["PRICES"][$j]["DISCOUNT_PRICE"] = $item_prices["PRICE"] - $arProductDiscounts["VALUE"];
$j++;
}
$i++;
}
} elseif ($arProductDiscounts["VALUE_TYPE"] == "P") {
echo "p";
示例5: __OnElementDiscount
function __OnElementDiscount($arFields)
{
$ProductPrc = false;
$PropID = false;
$res = CIBlockElement::GetProperty($arFields['IBLOCK_ID'],$arFields['ID'], "sort", "asc", array("CODE" => "DISCOUNT", 'EMPTY' => 'N'));
if ($ob = $res->GetNext())
{
$PropID = $ob['ID'];
$ProductPrc = $ob['VALUE'];
}
if($ProductPrc)
{
CModule::IncludeModule('catalog');
$dbProductDiscounts = CCatalogDiscount::GetList(
array(),
array(
"ACTIVE" => "Y",
"VALUE" => $ProductPrc,
"XML_ID" => 'IB_PROPERTY_'.$ProductPrc,
),
false,
false,
array(
"ID", "VALUE"
)
);
if (!$dbProductDiscounts->Fetch())
{
$arDiscountFields = Array(
'SITE_ID' => 's1',
'ACTIVE' => 'Y',
'RENEWAL' => 'N',
'XML_ID' => 'IB_PROPERTY_'.$ProductPrc,
'NAME' => 'Скидка по свойству - '.$ProductPrc.'%',
'SORT' => 100,
'VALUE_TYPE' => 'P',
'VALUE' => $ProductPrc,
'CURRENCY' => 'RUB',
'PRIORITY' => 1,
'LAST_DISCOUNT' => 'N',
'GROUP_IDS' => Array(),
'CATALOG_GROUP_IDS' => Array(),
'CONDITIONS' => Array(
'CLASS_ID' => 'CondGroup',
'DATA' => Array(
'All' => 'AND',
'True' => 'True'
),
'CHILDREN' => Array(
Array(
'CLASS_ID' => 'CondIBIBlock',
'DATA' => Array(
'logic' => 'Equal',
'value' => $arFields['IBLOCK_ID']
)
),
Array(
'CLASS_ID' => 'CondIBProp:'.$arFields['IBLOCK_ID'].':'.$PropID,
'DATA' => Array(
'logic' => 'Equal',
'value' => $ProductPrc
)
)
)
)
);
$ID = CCatalogDiscount::Add($arDiscountFields);
}
}
}
示例6: CAdminContextMenu
"WARNING" => "Y"
);
}
$context = new CAdminContextMenu($aMenu);
$context->Show();
if ($errorMessage !== '')
CAdminMessage::ShowMessage($errorMessage);
$filterDiscount = array();
if ($ID > 0)
$filterDiscount = array('ID' => $arCoupon['DISCOUNT_ID']);
$arDiscountList = array();
$rsDiscounts = CCatalogDiscount::GetList(
array("NAME" => "ASC"),
$filterDiscount,
false,
false,
array("ID", "SITE_ID", "NAME")
);
while ($arDiscount = $rsDiscounts->Fetch())
{
$arDiscountList[$arDiscount['ID']] = "[".$arDiscount["ID"]."] ".$arDiscount["NAME"]." (".$arDiscount["SITE_ID"].")";
}
$arTypeList = CCatalogDiscountCoupon::GetCoupontTypes(true);
$tabControl->BeginPrologContent();
$tabControl->EndPrologContent();
$tabControl->BeginEpilogContent();
echo GetFilterHiddens("filter_");?>
示例7: SetCatalogDiscountCache
public static function SetCatalogDiscountCache($arCatalogGroups, $arUserGroups)
{
global $DB;
if (self::$catalogIncluded === null)
self::$catalogIncluded = \Freetrix\Main\Loader::includeModule('catalog');
if (self::$catalogIncluded)
{
if (!is_array($arCatalogGroups))
return false;
if (!is_array($arUserGroups))
return false;
CatalogClearArray($arCatalogGroups);
if (empty($arCatalogGroups))
return false;
CatalogClearArray($arUserGroups);
if (empty($arUserGroups))
return false;
$arRestFilter = array(
'PRICE_TYPES' => $arCatalogGroups,
'USER_GROUPS' => $arUserGroups,
);
$arRest = CCatalogDiscount::GetRestrictions($arRestFilter, false, false);
$arDiscountFilter = array();
$arDiscountResult = array();
if (empty($arRest) || (array_key_exists('DISCOUNTS', $arRest) && empty($arRest['DISCOUNTS'])))
{
foreach ($arCatalogGroups as &$intOneGroupID)
{
$strCacheKey = CCatalogDiscount::GetDiscountFilterCacheKey(array($intOneGroupID), $arUserGroups, false);
$arDiscountFilter[$strCacheKey] = array();
}
if (isset($intOneGroupID))
unset($intOneGroupID);
}
else
{
$arSelect = array(
"ID", "TYPE", "SITE_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO",
"RENEWAL", "NAME", "SORT", "MAX_DISCOUNT", "VALUE_TYPE", "VALUE", "CURRENCY",
"PRIORITY", "LAST_DISCOUNT",
"COUPON", "COUPON_ONE_TIME", "COUPON_ACTIVE", 'UNPACK'
);
$strDate = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")));
$arFilter = array(
"ID" => $arRest['DISCOUNTS'],
"SITE_ID" => SITE_ID,
"TYPE" => DISCOUNT_TYPE_STANDART,
"ACTIVE" => "Y",
"RENEWAL" => 'N',
"+<=ACTIVE_FROM" => $strDate,
"+>=ACTIVE_TO" => $strDate,
'+COUPON' => array(),
);
$arResultDiscountList = array();
$rsPriceDiscounts = CCatalogDiscount::GetList(
array(),
$arFilter,
false,
false,
$arSelect
);
while ($arPriceDiscount = $rsPriceDiscounts->Fetch())
{
$arPriceDiscount['ID'] = intval($arPriceDiscount['ID']);
$arResultDiscountList[$arPriceDiscount['ID']] = $arPriceDiscount;
}
foreach ($arCatalogGroups as &$intOneGroupID)
{
$strCacheKey = CCatalogDiscount::GetDiscountFilterCacheKey(array($intOneGroupID), $arUserGroups, false);
$arDiscountDetailList = array();
$arDiscountList = array();
foreach ($arRest['RESTRICTIONS'] as $intDiscountID => $arDiscountRest)
{
if (empty($arDiscountRest['PRICE_TYPE']) || array_key_exists($intOneGroupID, $arDiscountRest['PRICE_TYPE']))
{
$arDiscountList[] = $intDiscountID;
if (isset($arResultDiscountList[$intDiscountID]))
$arDiscountDetailList[] = $arResultDiscountList[$intDiscountID];
}
}
sort($arDiscountList);
$arDiscountFilter[$strCacheKey] = $arDiscountList;
$strResultCacheKey = CCatalogDiscount::GetDiscountResultCacheKey($arDiscountList, SITE_ID, 'N');
$arDiscountResult[$strResultCacheKey] = $arDiscountDetailList;
}
if (isset($intOneGroupID))
unset($intOneGroupID);
}
$boolFlag = CCatalogDiscount::SetAllDiscountFilterCache($arDiscountFilter, false);
$boolFlagExt = CCatalogDiscount::SetAllDiscountResultCache($arDiscountResult);
return $boolFlag && $boolFlagExt;
}
return false;
}
示例8: array
<strong>3</strong>
</div>
</div>
</li>
</ul>
</div>--> <?php
$APPLICATION->IncludeComponent("bitrix:news.list", "main_banners", array("ACTIVE_DATE_FORMAT" => "d.m.Y", "ADD_SECTIONS_CHAIN" => "Y", "AJAX_MODE" => "N", "AJAX_OPTION_ADDITIONAL" => "", "AJAX_OPTION_HISTORY" => "N", "AJAX_OPTION_JUMP" => "N", "AJAX_OPTION_STYLE" => "Y", "CACHE_FILTER" => "N", "CACHE_GROUPS" => "N", "CACHE_TIME" => "36000000", "CACHE_TYPE" => "A", "CHECK_DATES" => "Y", "COMPONENT_TEMPLATE" => "main_banners", "DETAIL_URL" => "", "DISPLAY_BOTTOM_PAGER" => "Y", "DISPLAY_DATE" => "Y", "DISPLAY_NAME" => "Y", "DISPLAY_PICTURE" => "Y", "DISPLAY_PREVIEW_TEXT" => "Y", "DISPLAY_TOP_PAGER" => "N", "FIELD_CODE" => array(0 => "DETAIL_PICTURE", 1 => ""), "FILTER_NAME" => "", "HIDE_LINK_WHEN_NO_DETAIL" => "N", "IBLOCK_ID" => "5", "IBLOCK_TYPE" => "news", "INCLUDE_IBLOCK_INTO_CHAIN" => "Y", "INCLUDE_SUBSECTIONS" => "Y", "MESSAGE_404" => "", "NEWS_COUNT" => "20", "PAGER_BASE_LINK_ENABLE" => "N", "PAGER_DESC_NUMBERING" => "N", "PAGER_DESC_NUMBERING_CACHE_TIME" => "36000", "PAGER_SHOW_ALL" => "N", "PAGER_SHOW_ALWAYS" => "N", "PAGER_TEMPLATE" => ".default", "PAGER_TITLE" => "Новости", "PARENT_SECTION" => "", "PARENT_SECTION_CODE" => "", "PREVIEW_TRUNCATE_LEN" => "", "PROPERTY_CODE" => array(0 => "", 1 => ""), "SET_BROWSER_TITLE" => "Y", "SET_LAST_MODIFIED" => "N", "SET_META_DESCRIPTION" => "Y", "SET_META_KEYWORDS" => "Y", "SET_STATUS_404" => "N", "SET_TITLE" => "Y", "SHOW_404" => "N", "SORT_BY1" => "ACTIVE_FROM", "SORT_BY2" => "SORT", "SORT_ORDER1" => "DESC", "SORT_ORDER2" => "ASC"));
?>
<div class="saleWrapp">
<div class="catalogWrapper">
<p class="titleMain">
Скидки только в декабре
</p>
<?php
$disc_items = array("ID" => array());
$disc_list = CCatalogDiscount::GetList(array(), array(">=ACTIVE_FROM" => "01.12.2015 00:00:00", "<=ACTIVE_TO" => "31.12.2015 00:00:00"), false, false, array("ID", "SITE_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "RENEWAL", "NAME", "SORT", "MAX_DISCOUNT", "VALUE_TYPE", "VALUE", "CURRENCY", "PRODUCT_ID"));
while ($disc_fetch = $disc_list->Fetch()) {
$disc_items["ID"][] = $disc_fetch["PRODUCT_ID"];
}
?>
<?php
$APPLICATION->IncludeComponent("bitrix:catalog.section", "discount_books", array("ACTION_VARIABLE" => "action", "ADD_PICT_PROP" => "-", "ADD_PROPERTIES_TO_BASKET" => "Y", "ADD_SECTIONS_CHAIN" => "N", "ADD_TO_BASKET_ACTION" => "ADD", "AJAX_MODE" => "N", "AJAX_OPTION_ADDITIONAL" => "", "AJAX_OPTION_HISTORY" => "N", "AJAX_OPTION_JUMP" => "N", "AJAX_OPTION_STYLE" => "Y", "BACKGROUND_IMAGE" => "-", "BASKET_URL" => "/personal/basket.php", "BROWSER_TITLE" => "-", "CACHE_FILTER" => "N", "CACHE_GROUPS" => "Y", "CACHE_TIME" => "36000000", "CACHE_TYPE" => "A", "COMPONENT_TEMPLATE" => "discount_books", "CONVERT_CURRENCY" => "N", "DETAIL_URL" => "", "DISPLAY_BOTTOM_PAGER" => "Y", "DISPLAY_TOP_PAGER" => "N", "ELEMENT_SORT_FIELD" => "sort", "ELEMENT_SORT_FIELD2" => "id", "ELEMENT_SORT_ORDER" => "asc", "ELEMENT_SORT_ORDER2" => "desc", "FILTER_NAME" => "disc_items", "HIDE_NOT_AVAILABLE" => "N", "IBLOCK_ID" => "4", "IBLOCK_TYPE" => "catalog", "INCLUDE_SUBSECTIONS" => "Y", "LABEL_PROP" => "-", "LINE_ELEMENT_COUNT" => "3", "MESSAGE_404" => "", "MESS_BTN_ADD_TO_BASKET" => "В корзину", "MESS_BTN_BUY" => "Купить", "MESS_BTN_DETAIL" => "Подробнее", "MESS_BTN_SUBSCRIBE" => "Подписаться", "MESS_NOT_AVAILABLE" => "Нет в наличии", "META_DESCRIPTION" => "-", "META_KEYWORDS" => "-", "OFFERS_LIMIT" => "5", "PAGER_BASE_LINK_ENABLE" => "N", "PAGER_DESC_NUMBERING" => "N", "PAGER_DESC_NUMBERING_CACHE_TIME" => "36000", "PAGER_SHOW_ALL" => "N", "PAGER_SHOW_ALWAYS" => "N", "PAGER_TEMPLATE" => ".default", "PAGER_TITLE" => "Товары", "PAGE_ELEMENT_COUNT" => "30", "PARTIAL_PRODUCT_PROPERTIES" => "N", "PRICE_CODE" => array(0 => "BASE"), "PRICE_VAT_INCLUDE" => "Y", "PRODUCT_ID_VARIABLE" => "id", "PRODUCT_PROPERTIES" => array(), "PRODUCT_PROPS_VARIABLE" => "prop", "PRODUCT_QUANTITY_VARIABLE" => "", "PRODUCT_SUBSCRIPTION" => "N", "PROPERTY_CODE" => array(0 => "", 1 => ""), "SECTION_CODE" => "", "SECTION_ID" => $_REQUEST["SECTION_ID"], "SECTION_ID_VARIABLE" => "SECTION_ID", "SECTION_URL" => "", "SECTION_USER_FIELDS" => array(0 => "", 1 => ""), "SEF_MODE" => "N", "SET_BROWSER_TITLE" => "Y", "SET_LAST_MODIFIED" => "N", "SET_META_DESCRIPTION" => "Y", "SET_META_KEYWORDS" => "Y", "SET_STATUS_404" => "N", "SET_TITLE" => "Y", "SHOW_404" => "N", "SHOW_ALL_WO_SECTION" => "N", "SHOW_CLOSE_POPUP" => "N", "SHOW_DISCOUNT_PERCENT" => "N", "SHOW_OLD_PRICE" => "N", "SHOW_PRICE_COUNT" => "1", "TEMPLATE_THEME" => "blue", "USE_MAIN_ELEMENT_SECTION" => "N", "USE_PRICE_COUNT" => "N", "USE_PRODUCT_QUANTITY" => "N"));
?>
<div class="giftWrap">
<img src="/img/giftBack.png"> <input type="text" placeholder="Ваш e-mail">
<p class="title">
Книга в подарок
</p>
<p>
Подпишись на рыссылку и получи книгу бесплатно
示例9: array
"All" => "AND",
"True" => "True",
),
"CHILDREN" => array(
array(
"CLASS_ID" => "CondIBProp:17:466",
"DATA" => array(
"logic" => "Equal",
"value" => $item["discount_id"]
)
)
)
);
// PR($item);
$dbProductDiscounts = CCatalogDiscount::GetList(array(), array("NOTES" => $item["discount_id"]), false, false, array())->Fetch();
if(empty($dbProductDiscounts))
{
$arFields = array(
"SITE_ID" => "s1",
"NAME" => "Скидка из 1с " . $item["discount_name"],
"CURRENCY" => "RUB",
"PRIORITY" => 100,
"VALUE_TYPE" => $item["discount_type"],
"VALUE" => $item["discount_value"],
"NOTES" => $item["discount_id"],
"CONDITIONS" => serialize($arLogic),
);
$Ids[] = CCatalogDiscount::Add($arFields);
}
else
示例10: IncludeModuleLangFile
}
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/catalog/admin/cat_discount_coupon_edit.php");
IncludeModuleLangFile(__FILE__);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/catalog/prolog.php";
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/iblock/classes/general/subelement.php';
$intDiscountID = intval($_REQUEST['DISCOUNT_ID']);
$strSubTMP_ID = trim($_REQUEST['TMP_ID']);
$rsDiscounts = CCatalogDiscount::GetList(array(), array('ID' => $intDiscountID), false, false, array("ID"));
while ($arDiscount = $rsDiscounts->Fetch()) {
$arDiscountList[] = $arDiscount['ID'];
}
$boolDiscount = true;
if (0 >= $intDiscountID) {
$boolDiscount = false;
} else {
$rsDiscounts = CCatalogDiscount::GetList(array(), array('ID' => $intDiscountID), false, false, array("ID"));
if (!($arDiscount = $rsDiscounts->Fetch())) {
$boolDiscount = false;
}
}
if (!$boolDiscount) {
require $DOCUMENT_ROOT . "/bitrix/modules/main/include/prolog_admin_after.php";
ShowError(GetMessage('BT_CAT_DISC_SUBCOUPON_DISCOUNT_ID_ABSENT'));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
if (!empty($return_url) && strtolower(substr($return_url, strlen($APPLICATION->GetCurPage()))) == strtolower($APPLICATION->GetCurPage())) {
$return_url = "";
}
$boolMulti = isset($_REQUEST['MULTI']) && 'Y' == $_REQUEST['MULTI'];
if (!$boolMulti) {
示例11: GetDiscountForProduct
public function GetDiscountForProduct($arProduct, $arParams = false)
{
global $DB;
self::initDiscountSettings();
$arResult = array();
$arResultID = array();
if (is_array($arProduct) && !empty($arProduct)) {
if (!is_array($arParams)) {
$arParams = array();
}
if (!isset($arProduct['ID'])) {
$arProduct['ID'] = 0;
}
$arProduct['ID'] = (int) $arProduct['ID'];
if (!isset($arProduct['IBLOCK_ID'])) {
$arProduct['IBLOCK_ID'] = 0;
}
$arProduct['IBLOCK_ID'] = (int) $arProduct['IBLOCK_ID'];
if ($arProduct['IBLOCK_ID'] <= 0) {
return $arResult;
}
$arSKUExt = false;
if (isset($arParams['SKU']) && $arParams['SKU'] == 'Y') {
$arSKUExt = CCatalogSKU::GetInfoByOfferIBlock($arProduct['IBLOCK_ID']);
}
$arFieldsParams = array();
if (isset($arParams['TIME_ZONE'])) {
$arFieldsParams['TIME_ZONE'] = $arParams['TIME_ZONE'];
}
if (isset($arParams['PRODUCT'])) {
$arFieldsParams['PRODUCT'] = $arParams['PRODUCT'];
}
$boolGenerate = false;
$arSelect = array('ID', 'SITE_ID', 'SORT', 'NAME', 'VALUE_TYPE', 'VALUE', 'CURRENCY', 'UNPACK');
if (isset($arParams['DISCOUNT_FIELDS']) && !empty($arParams['DISCOUNT_FIELDS']) && is_array($arParams['DISCOUNT_FIELDS'])) {
$arSelect = $arParams['DISCOUNT_FIELDS'];
}
if (!in_array('UNPACK', $arSelect)) {
$arSelect[] = 'UNPACK';
}
$strDate = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")));
if (isset($arParams['CURRENT_DATE'])) {
$strDate = $arParams['CURRENT_DATE'];
}
$strRenewal = 'N';
if (isset($arParams['RENEWAL'])) {
$strRenewal = $arParams['RENEWAL'];
}
$strRenewal = $strRenewal == 'Y' ? 'Y' : 'N';
$arSiteList = array();
if (isset($arParams['SITE_ID'])) {
if (!is_array($arParams['SITE_ID'])) {
$arParams['SITE_ID'] = array($arParams['SITE_ID']);
}
if (!empty($arParams['SITE_ID'])) {
$arSiteList = $arParams['SITE_ID'];
}
}
if (empty($arSiteList)) {
$rsIBlockSites = CIBlock::GetSite($arProduct['IBLOCK_ID']);
while ($arIBlockSite = $rsIBlockSites->Fetch()) {
$arSiteList[] = $arIBlockSite['SITE_ID'];
}
}
$arFilter = array('SITE_ID' => $arSiteList, 'TYPE' => self::ENTITY_ID, 'ACTIVE' => "Y", 'RENEWAL' => $strRenewal, '+<=ACTIVE_FROM' => $strDate, '+>=ACTIVE_TO' => $strDate, 'COUPON' => '');
CTimeZone::Disable();
$rsPriceDiscounts = CCatalogDiscount::GetList(array(), $arFilter, false, false, $arSelect);
CTimeZone::Enable();
while ($arPriceDiscount = $rsPriceDiscounts->Fetch()) {
if ($arPriceDiscount['COUPON_ACTIVE'] != 'N') {
if (!$boolGenerate) {
if (!isset(self::$arCacheProduct[$arProduct['ID']])) {
if (!self::__GenerateFields($arProduct, $arFieldsParams)) {
return $arResult;
}
if (!empty($arSKUExt)) {
self::__GenerateParent($arProduct, $arSKUExt);
}
$boolGenerate = true;
self::$arCacheProduct[$arProduct['ID']] = $arProduct['ID'];
} else {
$arProduct = self::$arCacheProduct[$arProduct['ID']];
}
}
if (CCatalogDiscount::__Unpack($arProduct, $arPriceDiscount['UNPACK'])) {
unset($arPriceDiscount['UNPACK']);
$arResult[] = $arPriceDiscount;
$arResultID[] = $arPriceDiscount['ID'];
}
}
}
}
return $arResult;
}
示例12: array
$arDefCoupons = array(
'COUPON_ADD' => 'N',
'COUPON_TYPE' => 'Y',
'COUPON_COUNT' => '',
);
$arSelect = array_merge(array('ID', 'VERSION'), array_keys($arDefaultValues));
$arDiscount = $arDefaultValues;
$arDiscountGroupList = array();
$arDiscountCatList = array();
$arCoupons = $arDefCoupons;
if (0 < $ID)
{
$rsDiscounts = CCatalogDiscount::GetList(array(), array("ID" => $ID), false, false, $arSelect);
if (!($arDiscount = $rsDiscounts->Fetch()))
{
$ID = 0;
$arDiscount = $arDefaultValues;
$arCoupons = $arDefCoupons;
}
else
{
$rsDiscountGroups = CCatalogDiscount::GetDiscountGroupsList(array(), array("DISCOUNT_ID" => $ID));
while ($arDiscountGroup = $rsDiscountGroups->Fetch())
{
$arDiscountGroupList[] = intval($arDiscountGroup["GROUP_ID"]);
}
$rsDiscountCats = CCatalogDiscount::GetDiscountCatsList(array(), array("DISCOUNT_ID" => $ID));
while ($arDiscountCat = $rsDiscountCats->Fetch())
示例13: while
while ($oneSite = $siteIterator->fetch()) {
$arSiteList[$oneSite['LID']] = $oneSite['LID'];
$arSiteLinkList[$oneSite['LID']] = '<a href="/bitrix/admin/site_edit.php?lang=' . LANGUAGE_ID . '&LID=' . $oneSite['LID'] . '" title="' . GetMessage('BT_CAT_DISCOUNT_ADM_MESS_SITE_ID') . '">' . $oneSite['LID'] . '</a>';
}
unset($oneSite, $siteIterator);
}
$arCurrencyList = array();
if ($arSelectFieldsMap['CURRENCY']) {
$currencyList = array_keys(Currency\CurrencyManager::getCurrencyList());
foreach ($currencyList as $currency) {
$arCurrencyList[$currency] = $currency;
}
unset($currencyList);
}
$arNavParams = isset($_REQUEST['mode']) && 'excel' == $_REQUEST["mode"] ? false : array("nPageSize" => CAdminResult::GetNavSize($sTableID));
$dbResultList = CCatalogDiscount::GetList(array($by => $order), $arFilter, false, $arNavParams, $arSelectFields);
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("DSC_NAV")));
$arUserList = array();
$arUserID = array();
$nameFormat = CSite::GetNameFormat(true);
$arRows = array();
while ($arDiscount = $dbResultList->Fetch()) {
$arDiscount['ID'] = (int) $arDiscount['ID'];
if ($arSelectFieldsMap['CREATED_BY']) {
$arDiscount['CREATED_BY'] = (int) $arDiscount['CREATED_BY'];
if ($arDiscount['CREATED_BY'] > 0) {
$arUserID[$arDiscount['CREATED_BY']] = true;
}
}
示例14: SetCatalogDiscountCache
public static function SetCatalogDiscountCache($arCatalogGroups, $arUserGroups)
{
global $DB;
$result = false;
if (self::$catalogIncluded === null) {
self::$catalogIncluded = Loader::includeModule('catalog');
}
if (self::$catalogIncluded) {
if (!is_array($arCatalogGroups) || !is_array($arUserGroups)) {
return false;
}
Main\Type\Collection::normalizeArrayValuesByInt($arCatalogGroups, true);
if (empty($arCatalogGroups)) {
return false;
}
Main\Type\Collection::normalizeArrayValuesByInt($arUserGroups, true);
if (empty($arUserGroups)) {
return false;
}
$arRestFilter = array('PRICE_TYPES' => $arCatalogGroups, 'USER_GROUPS' => $arUserGroups);
$arRest = CCatalogDiscount::GetRestrictions($arRestFilter, false, false);
$arDiscountFilter = array();
$arDiscountResult = array();
if (empty($arRest) || array_key_exists('DISCOUNTS', $arRest) && empty($arRest['DISCOUNTS'])) {
foreach ($arCatalogGroups as &$intOneGroupID) {
$strCacheKey = CCatalogDiscount::GetDiscountFilterCacheKey(array($intOneGroupID), $arUserGroups, false);
$arDiscountFilter[$strCacheKey] = array();
}
unset($intOneGroupID);
} else {
$arResultDiscountList = array();
$arSelect = array('ID', 'TYPE', 'SITE_ID', 'ACTIVE', 'ACTIVE_FROM', 'ACTIVE_TO', 'RENEWAL', 'NAME', 'SORT', 'MAX_DISCOUNT', 'VALUE_TYPE', 'VALUE', 'CURRENCY', 'PRIORITY', 'LAST_DISCOUNT', 'COUPON', 'COUPON_ONE_TIME', 'COUPON_ACTIVE', 'UNPACK', 'CONDITIONS');
$strDate = date($DB->DateFormatToPHP(CSite::GetDateFormat('FULL')));
$discountRows = array_chunk($arRest['DISCOUNTS'], 500);
foreach ($discountRows as &$row) {
$arFilter = array('@ID' => $row, 'SITE_ID' => SITE_ID, 'TYPE' => DISCOUNT_TYPE_STANDART, 'RENEWAL' => 'N', '+<=ACTIVE_FROM' => $strDate, '+>=ACTIVE_TO' => $strDate, '+COUPON' => array());
$rsPriceDiscounts = CCatalogDiscount::GetList(array(), $arFilter, false, false, $arSelect);
while ($arPriceDiscount = $rsPriceDiscounts->Fetch()) {
$arPriceDiscount['ID'] = (int) $arPriceDiscount['ID'];
$arResultDiscountList[$arPriceDiscount['ID']] = $arPriceDiscount;
}
unset($arPriceDiscount, $rsPriceDiscounts, $arFilter);
}
unset($row, $discountRows);
foreach ($arCatalogGroups as &$intOneGroupID) {
$strCacheKey = CCatalogDiscount::GetDiscountFilterCacheKey(array($intOneGroupID), $arUserGroups, false);
$arDiscountDetailList = array();
$arDiscountList = array();
foreach ($arRest['RESTRICTIONS'] as $intDiscountID => $arDiscountRest) {
if (empty($arDiscountRest['PRICE_TYPE']) || array_key_exists($intOneGroupID, $arDiscountRest['PRICE_TYPE'])) {
$arDiscountList[] = $intDiscountID;
if (isset($arResultDiscountList[$intDiscountID])) {
$arDiscountDetailList[] = $arResultDiscountList[$intDiscountID];
}
}
}
sort($arDiscountList);
$arDiscountFilter[$strCacheKey] = $arDiscountList;
$strResultCacheKey = CCatalogDiscount::GetDiscountResultCacheKey($arDiscountList, SITE_ID, 'N');
$arDiscountResult[$strResultCacheKey] = $arDiscountDetailList;
}
if (isset($intOneGroupID)) {
unset($intOneGroupID);
}
}
$boolFlag = CCatalogDiscount::SetAllDiscountFilterCache($arDiscountFilter, false);
$boolFlagExt = CCatalogDiscount::SetAllDiscountResultCache($arDiscountResult);
$result = $boolFlag && $boolFlagExt;
self::$needDiscountCache = $result;
}
return $result;
}
示例15: GetMessage
">
</td>
</tr>
<tr>
<td><?php
echo GetMessage("DSC_CPN_DISC");
?>
:</td>
<td>
<select name="filter_discount_id">
<option value=""><?php
echo GetMessage("DSC_CPN_ALL");
?>
</option>
<?php
$dbDiscountList = CCatalogDiscount::GetList(array("NAME" => "ASC"), array(), false, false, array("ID", "SITE_ID", "NAME"));
while ($arDiscountList = $dbDiscountList->Fetch()) {
?>
<option value="<?php
echo $arDiscountList["ID"];
?>
"<?php
if ($filter_discount_id == $arDiscountList["ID"]) {
echo " selected";
}
?>
><?php
echo htmlspecialcharsbx("[" . $arDiscountList["ID"] . "] " . $arDiscountList["NAME"] . " (" . $arDiscountList["SITE_ID"] . ")");
?>
</option><?php
}