本文整理汇总了PHP中CCatalogDiscount::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount::Add方法的具体用法?PHP CCatalogDiscount::Add怎么用?PHP CCatalogDiscount::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscount
的用法示例。
在下文中一共展示了CCatalogDiscount::Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
if ($arSect = $dbSect->Fetch()) {
$sofasSectId = $arSect["ID"];
}
}
$dbSite = CSite::GetByID(WIZARD_SITE_ID);
if ($arSite = $dbSite->Fetch()) {
$lang = $arSite["LANGUAGE_ID"];
}
$defCurrency = "EUR";
if ($lang == "ru") {
$defCurrency = "RUB";
} elseif ($lang == "en") {
$defCurrency = "USD";
}
$arF = array("SITE_ID" => WIZARD_SITE_ID, "ACTIVE" => "Y", "RENEWAL" => "N", "NAME" => GetMessage("WIZ_DISCOUNT"), "SORT" => 100, "MAX_DISCOUNT" => 0, "VALUE_TYPE" => "P", "VALUE" => 10, "CURRENCY" => $defCurrency, "CONDITIONS" => array("CLASS_ID" => "CondGroup", "DATA" => array("All" => "OR", "True" => "True"), "CHILDREN" => array(array("CLASS_ID" => "CondIBSection", "DATA" => array("logic" => "Equal", "value" => $sofasSectId)))));
CCatalogDiscount::Add($arF);
}
//precet
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => "SALELEADER"));
$arFields = array();
while ($arProperty = $dbProperty->GetNext()) {
$arFields["find_el_property_" . $arProperty["ID"]] = "";
}
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => "NEWPRODUCT"));
while ($arProperty = $dbProperty->GetNext()) {
$arFields["find_el_property_" . $arProperty["ID"]] = "";
}
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => "SPECIALOFFER"));
while ($arProperty = $dbProperty->GetNext()) {
$arFields["find_el_property_" . $arProperty["ID"]] = "";
}
示例2: GetMessage
$errorMessage .= GetMessage('BT_CAT_DISCOUNT_EDIT_COUPON_COUNT')."<br>";
}
}
}
if (!$bVarsFromForm)
{
$DB->StartTransaction();
if ($ID > 0 && !$boolCopy)
{
$res = CCatalogDiscount::Update($ID, $arFields);
}
else
{
$ID = CCatalogDiscount::Add($arFields);
$res = ($ID > 0);
}
if (!$res)
{
if ($ex = $APPLICATION->GetException())
$errorMessage .= $ex->GetString()."<br>";
else
$errorMessage .= (0 < $ID ? str_replace('#ID#', $ID, GetMessage('BT_CAT_DISCOUNT_EDIT_ERR_UPDATE')) : GetMessage('BT_CAT_DISCOUNT_EDIT_ERR_ADD'))."<br>";
$bVarsFromForm = true;
$DB->Rollback();
}
else
{
$DB->Commit();
示例3: __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);
}
}
}
示例4: array
// 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
{
$arFields2 = array(
"NAME" => "Скидка из 1с " . $item["discount_name"],
"VALUE_TYPE" => $item["discount_type"],
"VALUE" => $item["discount_value"],
"NOTES" => $item["discount_id"],
"CONDITIONS" => serialize($arLogic),
);
CCatalogDiscount::Update($dbProductDiscounts["ID"], $arFields2);
}
}
PR($Ids);
}