本文整理汇总了PHP中CCatalogMeasure::add方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogMeasure::add方法的具体用法?PHP CCatalogMeasure::add怎么用?PHP CCatalogMeasure::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogMeasure
的用法示例。
在下文中一共展示了CCatalogMeasure::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetMessage
$errorMessage .= GetMessage("CAT_MEASURE_CODE_EMPTY") . "\n";
}
if (trim($_REQUEST["MEASURE_TITLE"]) == '') {
$errorMessage .= GetMessage("CAT_MEASURE_TITLE_EMPTY") . "\n";
}
$arFields = array("CODE" => $_REQUEST["CODE"], "MEASURE_TITLE" => $_REQUEST["MEASURE_TITLE"], "SYMBOL_RUS" => $_REQUEST["SYMBOL_RUS"], "SYMBOL_INTL" => $_REQUEST["SYMBOL_INTL"], "SYMBOL_LETTER_INTL" => $_REQUEST["SYMBOL_LETTER_INTL"], "IS_DEFAULT" => $IS_DEFAULT);
$DB->StartTransaction();
if (strlen($errorMessage) == 0 && $ID > 0 && ($res = CCatalogMeasure::update($ID, $arFields))) {
$ID = $res;
$DB->Commit();
if (strlen($_REQUEST["apply"]) <= 0) {
LocalRedirect("/bitrix/admin/cat_measure_list.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
} else {
LocalRedirect("/bitrix/admin/cat_measure_edit.php?lang=" . LANG . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
}
} elseif (strlen($errorMessage) == 0 && $ID == 0 && ($res = CCatalogMeasure::add($arFields))) {
$ID = $res;
$DB->Commit();
if (strlen($_REQUEST["apply"]) <= 0) {
LocalRedirect("/bitrix/admin/cat_measure_list.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
} else {
LocalRedirect("/bitrix/admin/cat_measure_edit.php?lang=" . LANG . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
}
} else {
if ($ex = $APPLICATION->GetException()) {
$errorMessage .= $ex->GetString() . "<br>";
}
$bVarsFromForm = true;
$DB->Rollback();
}
}
示例2: GetMessage
if ($title == '') {
$errors[] = GetMessage('CRM_MEASURE_ERR_TITLE_EMPTY');
}
if (empty($errors)) {
$fields = array('CODE' => $code, 'MEASURE_TITLE' => $title, 'SYMBOL_RUS' => isset($_REQUEST['SYMBOL_RUS']) ? $_REQUEST['SYMBOL_RUS'] : '', 'SYMBOL_INTL' => isset($_REQUEST['SYMBOL_INTL']) ? $_REQUEST['SYMBOL_INTL'] : '', 'SYMBOL_LETTER_INTL' => isset($_REQUEST['SYMBOL_LETTER_INTL']) ? $_REQUEST['SYMBOL_LETTER_INTL'] : '', 'IS_DEFAULT' => isset($_REQUEST['IS_DEFAULT']) && $_REQUEST['IS_DEFAULT'] == 'Y' ? 'Y' : 'N');
if ($elementID > 0) {
if (CCatalogMeasure::update($elementID, $fields) === false) {
$exception = $APPLICATION->GetException();
if ($exception) {
$errors[] = $exception->GetString();
} else {
$errors[] = GetMessage('CRM_MEASURE_ERR_UPDATE');
}
}
} else {
$result = CCatalogMeasure::add($fields);
if (is_int($result)) {
$elementID = $arParams['ELEMENT_ID'] = $result;
} else {
$exception = $APPLICATION->GetException();
if ($exception) {
$errors[] = $exception->GetString();
} else {
$errors[] = GetMessage('CRM_MEASURE_ERR_CREATE');
}
}
}
$fields['ID'] = $elementID;
$arResult['ELEMENT'] = $fields;
}
if (!empty($errors)) {