本文整理汇总了PHP中CCatalogDiscount::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount::Update方法的具体用法?PHP CCatalogDiscount::Update怎么用?PHP CCatalogDiscount::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscount
的用法示例。
在下文中一共展示了CCatalogDiscount::Update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetMessage
}
if (0 >= $arCouponFields['COUPON_COUNT'])
{
$bVarsFromForm = true;
$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();
示例2: 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);
}
示例3: GetMessage
$DB->StartTransaction();
if (!CCatalogDiscount::Delete($ID)) {
$DB->Rollback();
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddGroupError($ex->GetString(), $ID);
} else {
$lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("ERROR_DELETE_DISCOUNT")), $ID);
}
} else {
$DB->Commit();
}
break;
case "activate":
case "deactivate":
$arFields = array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N");
if (!CCatalogDiscount::Update($ID, $arFields)) {
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddGroupError($ex->GetString(), $ID);
} else {
$lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("ERROR_UPDATE_DISCOUNT")), $ID);
}
}
break;
}
}
}
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "NAME", "content" => GetMessage("DSC_NAME"), "sort" => "NAME", "default" => true), array("id" => "VALUE", "content" => GetMessage("DSC_VALUE"), "sort" => "", "default" => true), array("id" => "ACTIVE", "content" => GetMessage("DSC_ACT"), "sort" => "ACTIVE", "default" => true), array("id" => "ACTIVE_FROM", "content" => GetMessage('DSC_PERIOD_FROM'), "sort" => "ACTIVE_FROM", "default" => true), array("id" => "ACTIVE_TO", "content" => GetMessage("DSC_PERIOD_TO2"), "sort" => "ACTIVE_TO", "default" => true), array("id" => "PRIORITY", "content" => GetMessage('DSC_PRIORITY'), "sort" => "PRIORITY", "default" => true), array("id" => "SORT", "content" => GetMessage("DSC_SORT"), "sort" => "SORT", "default" => true), array("id" => "SITE_ID", "content" => GetMessage("DSC_SITE"), "sort" => "SITE_ID", "default" => true), array("id" => "MODIFIED_BY", "content" => GetMessage('DSC_MODIFIED_BY'), "sort" => "MODIFIED_BY", "default" => true), array("id" => "TIMESTAMP_X", "content" => GetMessage('DSC_TIMESTAMP_X'), "sort" => "TIMESTAMP_X", "default" => true), array("id" => "MAX_DISCOUNT", "content" => GetMessage('DSC_MAX_DISCOUNT'), "sort" => "MAX_DISCOUNT", "default" => false), array("id" => "RENEWAL", "content" => GetMessage("DSC_REN"), "sort" => "RENEWAL", "default" => false), array("id" => "CREATED_BY", "content" => GetMessage('DSC_CREATED_BY'), "sort" => "CREATED_BY", "default" => false), array("id" => "DATE_CREATE", "content" => GetMessage('DSC_DATE_CREATE'), "sort" => "DATE_CREATE", "default" => false), array("id" => "XML_ID", "content" => GetMessage('DSC_XML_ID'), "sort" => "XML_ID", "default" => false), array("id" => "CURRENCY", "content" => GetMessage('DSC_CURRENCY'), "sort" => "CURRENCY", "default" => false), array("id" => "LAST_DISCOUNT", "content" => GetMessage('DSC_LAST_DISCOUNT'), "sort" => "LAST_DISCOUNT", "default" => false)));
$arSelectFieldsMap = array("ID" => false, "NAME" => false, "VALUE" => false, "ACTIVE" => false, "ACTIVE_FROM" => false, "ACTIVE_TO" => false, "PRIORITY" => false, "SORT" => false, "SITE_ID" => false, "MODIFIED_BY" => false, "TIMESTAMP_X" => false, "MAX_DISCOUNT" => false, "RENEWAL" => false, "CREATED_BY" => false, "DATE_CREATE" => false, "XML_ID" => false, "CURRENCY" => false, "LAST_DISCOUNT" => false);
$arSelectFields = $lAdmin->GetVisibleHeaderColumns();
if (!in_array('ID', $arSelectFields)) {
$arSelectFields[] = 'ID';
示例4: ConvertFormatDiscount
public static function ConvertFormatDiscount($intStep = 20, $intMaxExecutionTime = 15)
{
global $DBType;
global $DB;
global $APPLICATION;
self::InitStep();
$intStep = intval($intStep);
if (0 >= $intStep) {
$intStep = 20;
}
$startConvertTime = getmicrotime();
$obDiscount = new CCatalogDiscount();
$strTableName = '';
switch (ToUpper($DBType)) {
case 'MYSQL':
$strTableName = 'b_catalog_discount';
break;
case 'MSSQL':
$strTableName = 'B_CATALOG_DISCOUNT';
break;
case 'ORACLE':
$strTableName = 'B_CATALOG_DISCOUNT';
break;
}
if (!CCatalogDiscountConvertTmp::CreateTable()) {
return false;
}
if (0 >= self::$intLastConvertID) {
self::$intLastConvertID = CCatalogDiscountConvertTmp::GetLastID();
}
CTimeZone::Disable();
self::$boolEmptyList = true;
$rsDiscounts = CCatalogDiscount::GetList(array('ID' => 'ASC'), array('>ID' => self::$intLastConvertID, 'TYPE' => DISCOUNT_TYPE_STANDART, 'VERSION' => CATALOG_DISCOUNT_NEW_VERSION), false, array('nTopCount' => $intStep), array('ID', 'MODIFIED_BY', 'TIMESTAMP_X', 'CONDITIONS', 'NAME'));
while ($arDiscount = $rsDiscounts->Fetch()) {
$mxExist = CCatalogDiscountConvertTmp::IsExistID($arDiscount['ID']);
if (false === $mxExist) {
self::$intErrors++;
return false;
}
self::$boolEmptyList = false;
if (0 < $mxExist) {
self::$intConverted++;
self::$intConvertPerStep++;
self::$intLastConvertID = $arDiscount['ID'];
continue;
}
$arFields = array();
$arFields['MODIFIED_BY'] = $arDiscount['MODIFIED_BY'];
$arFields['CONDITIONS'] = $arDiscount['CONDITIONS'];
$mxRes = $obDiscount->Update($arDiscount['ID'], $arFields);
if (!$mxRes) {
self::$intErrors++;
$strError = '';
if ($ex = $APPLICATION->GetException()) {
$strError = $ex->GetString();
}
if (empty($strError)) {
$strError = GetMessage('BT_MOD_CAT_DSC_FORMAT_ERR');
}
self::$arErrors[] = array('ID' => $arDiscount['ID'], 'NAME' => $arDiscount['NAME'], 'ERROR' => $strError);
if (!CCatalogDiscountConvertTmp::SetID($arDiscount['ID'])) {
return false;
}
self::$intConverted++;
self::$intConvertPerStep++;
self::$intLastConvertID = $arDiscount['ID'];
} else {
$arTimeFields = array('~TIMESTAMP_X' => $DB->CharToDateFunction($arDiscount['TIMESTAMP_X'], "FULL"));
$strUpdate = $DB->PrepareUpdate($strTableName, $arTimeFields);
if (!empty($strUpdate)) {
$strQuery = "UPDATE " . $strTableName . " SET " . $strUpdate . " WHERE ID = " . $arDiscount['ID'] . " AND TYPE = " . DISCOUNT_TYPE_STANDART;
$DB->Query($strQuery, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
if (!CCatalogDiscountConvertTmp::SetID($arDiscount['ID'])) {
return false;
}
self::$intConverted++;
self::$intConvertPerStep++;
self::$intLastConvertID = $arDiscount['ID'];
}
if ($intMaxExecutionTime > 0 && getmicrotime() - $startConvertTime > $intMaxExecutionTime) {
break;
}
}
CTimeZone::Enable();
if ($intMaxExecutionTime > 2 * (getmicrotime() - $startConvertTime)) {
self::$intNextConvertPerStep = $intStep * 2;
} else {
self::$intNextConvertPerStep = $intStep;
}
self::SaveStep();
return true;
}