本文整理汇总了PHP中CCatalogDiscount::SaveFilterOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount::SaveFilterOptions方法的具体用法?PHP CCatalogDiscount::SaveFilterOptions怎么用?PHP CCatalogDiscount::SaveFilterOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscount
的用法示例。
在下文中一共展示了CCatalogDiscount::SaveFilterOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: Delete
/**
* <p>Метод удаляет скидку с кодом ID.</p>
*
*
*
*
* @param int $ID Код удаляемой записи.
*
*
*
* @return bool <p>Метод возвращает <i>true</i> в случае успешного удаления и <i>false</i> в
* случае ошибки.</p><br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscount/ccatalogdiscount.delete.php
* @author Bitrix
*/
static public function Delete($ID)
{
global $DB;
global $stackCacheManager;
$ID = intval($ID);
foreach (GetModuleEvents("catalog", "OnBeforeDiscountDelete", true) as $arEvent)
{
if (false === ExecuteModuleEventEx($arEvent, array($ID)))
return false;
}
$stackCacheManager->Clear("catalog_discount");
$DB->Query("DELETE FROM b_catalog_discount_cond WHERE DISCOUNT_ID = ".$ID);
$DB->Query("DELETE FROM b_catalog_discount_coupon WHERE DISCOUNT_ID = ".$ID);
$DB->Query("DELETE FROM b_catalog_discount2iblock WHERE DISCOUNT_ID = ".$ID);
$DB->Query("DELETE FROM b_catalog_discount2section WHERE DISCOUNT_ID = ".$ID);
$DB->Query("DELETE FROM b_catalog_discount2product WHERE DISCOUNT_ID = ".$ID);
$DB->Query("DELETE FROM b_catalog_discount WHERE ID = ".$ID." AND TYPE = ".DISCOUNT_TYPE_STANDART);
CCatalogDiscount::SaveFilterOptions();
foreach (GetModuleEvents("catalog", "OnDiscountDelete", true) as $arEvent)
{
ExecuteModuleEventEx($arEvent, array($ID));
}
return true;
}
示例3: Delete
public function Delete($ID)
{
global $DB;
global $stackCacheManager;
$ID = intval($ID);
$stackCacheManager->Clear("catalog_discount");
$DB->Query("DELETE FROM b_catalog_discount_cond WHERE DISCOUNT_ID = " . $ID);
$DB->Query("DELETE FROM b_catalog_discount_coupon WHERE DISCOUNT_ID = " . $ID);
$DB->Query("DELETE FROM b_catalog_discount2iblock WHERE DISCOUNT_ID = " . $ID);
$DB->Query("DELETE FROM b_catalog_discount2section WHERE DISCOUNT_ID = " . $ID);
$DB->Query("DELETE FROM b_catalog_discount2product WHERE DISCOUNT_ID = " . $ID);
$DB->Query("DELETE FROM b_catalog_discount WHERE ID = " . $ID . " AND TYPE = " . DISCOUNT_TYPE_STANDART);
CCatalogDiscount::SaveFilterOptions();
$events = GetModuleEvents("catalog", "OnDiscountDelete");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID));
}
return true;
}