本文整理汇总了PHP中CCatalogDiscount::SetCoupon方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount::SetCoupon方法的具体用法?PHP CCatalogDiscount::SetCoupon怎么用?PHP CCatalogDiscount::SetCoupon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscount
的用法示例。
在下文中一共展示了CCatalogDiscount::SetCoupon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnBasketAddHandler
function OnBasketAddHandler($ID, $arFields)
{
global $USER;
\Bitrix\Main\Loader::includeModule('catalog');
\Bitrix\Main\Loader::includeModule('sale');
if ($USER->IsAuthorized()) {
$arFilter = array("USER_ID" => $USER->GetID());
$db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
$arrCount = [];
while ($ar_sales = $db_sales->Fetch()) {
$arrCount[] = $ar_sales;
}
if (is_array($arrCount) == false) {
$res = CCatalogDiscount::SetCoupon('SL-CDUEA-HI8MMPY');
//3%
} else {
if (count($arrCount) >= 1) {
$resClean = CCatalogDiscount::ClearCoupon('SL-CDUEA-HI8MMPY');
$res5 = CCatalogDiscount::SetCoupon('SL-0JG2C-XIHBEYZ');
//5%
} else {
}
}
} else {
$res = CCatalogDiscountCoupon::SetCoupon('SL-CDUEA-HI8MMPY');
//3%
}
}
示例2: htmlspecialcharsbx
if (!isset($arParams['QUANTITY_FLOAT'])) {
$arParams['QUANTITY_FLOAT'] = 'N';
}
$arParams["COUNT_DISCOUNT_4_ALL_QUANTITY"] = $arParams["COUNT_DISCOUNT_4_ALL_QUANTITY"] == "Y" ? "Y" : "N";
//$arParams['PRICE_VAT_INCLUDE'] = $arParams['PRICE_VAT_INCLUDE'] == 'N' ? 'N' : 'Y';
$arParams['PRICE_VAT_SHOW_VALUE'] = $arParams['PRICE_VAT_SHOW_VALUE'] == 'N' ? 'N' : 'Y';
$arParams["WEIGHT_UNIT"] = htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', "", SITE_ID));
$arParams["WEIGHT_KOEF"] = htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, SITE_ID));
$arResult["WARNING_MESSAGE"] = array();
$GLOBALS['CATALOG_ONETIME_COUPONS_BASKET'] = null;
$GLOBALS['CATALOG_ONETIME_COUPONS_ORDER'] = null;
if (strlen($_REQUEST["BasketRefresh"]) > 0 || strlen($_REQUEST["BasketOrder"]) > 0) {
if ($arParams["HIDE_COUPON"] != "Y") {
$COUPON = Trim($_REQUEST["COUPON"]);
if (strlen($COUPON) > 0) {
CCatalogDiscount::SetCoupon($COUPON);
} else {
CCatalogDiscount::ClearCoupon();
}
}
$dbBasketItems = CSaleBasket::GetList(array("PRICE" => "DESC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "CURRENCY", "SUBSCRIBE"));
while ($arBasketItems = $dbBasketItems->Fetch()) {
$arBasketItems['QUANTITY'] = $arParams['QUANTITY_FLOAT'] == 'Y' ? DoubleVal($arBasketItems['QUANTITY']) : IntVal($arBasketItems['QUANTITY']);
if (!isset($_REQUEST["QUANTITY_" . $arBasketItems["ID"]])) {
$quantityTmp = $arBasketItems['QUANTITY'];
} else {
$quantityTmp = $arParams['QUANTITY_FLOAT'] == 'Y' ? DoubleVal($_REQUEST["QUANTITY_" . $arBasketItems["ID"]]) : IntVal($_REQUEST["QUANTITY_" . $arBasketItems["ID"]]);
}
$deleteTmp = $_REQUEST["DELETE_" . $arBasketItems["ID"]] == "Y" ? "Y" : "N";
$delayTmp = $_REQUEST["DELAY_" . $arBasketItems["ID"]] == "Y" ? "Y" : "N";
if ($deleteTmp == "Y" && in_array("DELETE", $arParams["COLUMNS_LIST"])) {