本文整理汇总了PHP中CCatalogGroup::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogGroup::Update方法的具体用法?PHP CCatalogGroup::Update怎么用?PHP CCatalogGroup::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogGroup
的用法示例。
在下文中一共展示了CCatalogGroup::Update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ImportPrices
function ImportPrices($XML_PRICES_PARENT, $IBLOCK_ID, $IBLOCK_LID)
{
$price_sort = 0;
$this->next_step["XML_PRICES_PARENT"] = $XML_PRICES_PARENT;
$arLang = array();
foreach ($IBLOCK_LID as $site_id) {
$rsSite = CSite::GetList($by = "sort", $order = "asc", array("ID" => $site_id));
while ($site = $rsSite->Fetch()) {
$arLang[$site["LANGUAGE_ID"]] = $site["LANGUAGE_ID"];
}
}
$arPrices = array();
$rsPrice = CCatalogGroup::GetList();
while ($arPrice = $rsPrice->Fetch()) {
$arPrices[$arPrice["ID"]] = $arPrice;
}
if (!CBXFeatures::IsFeatureEnabled('CatMultiPrice')) {
$prices_limit = 1 - count($arPrices);
} else {
$prices_limit = null;
}
$arXMLPrices = $this->_xml_file->GetAllChildrenArray($XML_PRICES_PARENT);
$uniqPriceById = array();
foreach ($arXMLPrices as $arXMLPrice) {
$PRICE_ID = $arXMLPrice[$this->mess["IBLOCK_XML2_ID"]];
$PRICE_NAME = $arXMLPrice[$this->mess["IBLOCK_XML2_NAME"]];
if (array_key_exists($PRICE_ID, $uniqPriceById)) {
return GetMessage("IBLOCK_XML2_PRICE_DUP_ERROR");
} else {
$uniqPriceById[$PRICE_ID] = true;
}
$found_id = 0;
//Check for price by XML_ID
if (isset($PRICE_ID) && $PRICE_ID != "") {
foreach ($arPrices as $i => $arPrice) {
if ($PRICE_ID === $arPrice["XML_ID"]) {
$found_id = $arPrice["ID"];
$arPrices[$i]["found"] = true;
break;
}
}
}
//When lookup by it's name
if (!$found_id) {
foreach ($arPrices as $arPrice) {
if ($PRICE_NAME === $arPrice["NAME"] && !isset($arPrice["found"])) {
$found_id = $arPrice["ID"];
break;
}
}
}
//Add new price type
if (!$found_id) {
$price_sort += 100;
$arPrice = array("NAME" => $PRICE_NAME, "XML_ID" => $PRICE_ID, "SORT" => $price_sort, "USER_LANG" => array(), "USER_GROUP" => array(2), "USER_GROUP_BUY" => array(2));
foreach ($arLang as $lang) {
$arPrice["USER_LANG"][$lang] = $arXMLPrice[$this->mess["IBLOCK_XML2_NAME"]];
}
if (!isset($prices_limit) || $prices_limit > 0) {
CCatalogGroup::Add($arPrice);
} elseif (isset($prices_limit)) {
return GetMessage("IBLOCK_XML2_PRICE_SB_ADD_ERROR");
}
} elseif (strlen($arPrices[$found_id]["XML_ID"]) <= 0 && strlen($PRICE_ID) >= 0) {
CCatalogGroup::Update($found_id, array("XML_ID" => $PRICE_ID));
} elseif ($arPrices[$found_id]["NAME"] !== $PRICE_NAME) {
CCatalogGroup::Update($found_id, array("NAME" => $PRICE_NAME));
}
if (isset($prices_limit)) {
$prices_limit--;
}
}
return true;
}
示例2: IncludeModuleLangFile
IncludeModuleLangFile(__FILE__);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/catalog/prolog.php";
$sTableID = "tbl_catalog_group";
$oSort = new CAdminSorting($sTableID, "ID", "asc");
$lAdmin = new CAdminList($sTableID, $oSort);
$arFilterFields = array();
$lAdmin->InitFilter($arFilterFields);
$arFilter = array();
if ($lAdmin->EditAction() && !$bReadOnly) {
foreach ($_POST['FIELDS'] as $ID => $arFields) {
$DB->StartTransaction();
$ID = IntVal($ID);
if (!$lAdmin->IsUpdated($ID)) {
continue;
}
if (!CCatalogGroup::Update($ID, $arFields)) {
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddUpdateError($ex->GetString(), $ID);
} else {
$lAdmin->AddUpdateError(GetMessage("ERROR_UPDATING_REC") . " (" . $arFields["ID"] . ", " . $arFields["NAME"] . ", " . $arFields["SORT"] . ")", $ID);
}
$DB->Rollback();
}
$DB->Commit();
}
}
if (($arID = $lAdmin->GroupAction()) && !$bReadOnly) {
if ($_REQUEST['action_target'] == 'selected') {
$arID = array();
$dbResultList = CCatalogGroup::GetList(array($by => $order));
while ($arResult = $dbResultList->Fetch()) {
示例3: GetMessage
{
WizardServices::IncludeServiceLang("step1.php", $langID);
$arFields["USER_LANG"][$langID] = GetMessage("WIZ_PRICE_NAME");
}
$arFields["BASE"] = "Y";
if($wizard->GetVar("installPriceBASE") == "Y"){
$db_res = CCatalogGroup::GetGroupsList(array("CATALOG_GROUP_ID"=>'1', "BUY"=>"Y"));
if ($ar_res = $db_res->Fetch())
{
$wizGroupId[] = $ar_res['GROUP_ID'];
}
$wizGroupId[] = 2;
$arFields["USER_GROUP"] = $wizGroupId;
$arFields["USER_GROUP_BUY"] = $wizGroupId;
}
CCatalogGroup::Update($arRes["ID"], $arFields);
}
//making orders
function __MakeOrder($prdCnt=1, $arData = Array())
{
global $APPLICATION, $USER, $DB;
CModule::IncludeModule("iblock");
CModule::IncludeModule("sale");
CModule::IncludeModule("catalog");
$arPrd = Array();
$dbItem = CIBlockElement::GetList(Array("PROPERTY_MORE_PHOTO" => "DESC", "ID" => "ASC"), Array("IBLOCK_TYPE" => "offers", "IBLOCK_SITE_ID" => WIZARD_SITE_ID, "PROPERTY_NEWPRODUCT" => false), false, Array("nTopCount" => 10), Array("ID", "IBLOCK_ID", "XML_ID", "NAME", "DETAIL_PAGE_URL", "IBLOCK_XML_ID"));
while($arItem = $dbItem->GetNext())
$arPrd[] = $arItem;
if(!empty($arPrd))
示例4: unset
}
if (isset($intValue)) {
unset($intValue);
}
}
$arUserLang = array();
foreach ($arLangList as &$arOneLang) {
$arUserLang[$arOneLang['LID']] = trim(isset($_POST['NAME_LANG'][$arOneLang['LID']]) ? $_POST['NAME_LANG'][$arOneLang['LID']] : '');
}
if (isset($arOneLang)) {
unset($arOneLang);
}
$arFields = array('NAME' => isset($_POST['NAME']) ? $_POST['NAME'] : '', 'BASE' => isset($_POST['BASE']) && 'Y' == $_POST['BASE'] ? 'Y' : 'N', 'SORT' => intval(isset($_POST['SORT']) ? $_POST['SORT'] : 100), 'XML_ID' => isset($_POST['XML_ID']) ? $_POST['XML_ID'] : '', 'USER_GROUP' => $arGroupID, 'USER_GROUP_BUY' => $arGroupBuyID, 'USER_LANG' => $arUserLang);
$DB->StartTransaction();
if (0 < $ID) {
$bVarsFromForm = !CCatalogGroup::Update($ID, $arFields);
} else {
$ID = CCatalogGroup::Add($arFields);
$bVarsFromForm = !(0 < intval($ID));
}
if (!$bVarsFromForm) {
$DB->Commit();
if (strlen($save) > 0) {
LocalRedirect("cat_group_admin.php?lang=" . LANGUAGE_ID);
} elseif (strlen($apply) > 0) {
LocalRedirect("cat_group_edit.php?lang=" . LANGUAGE_ID . '&ID=' . $ID);
}
} else {
if ($ex = $APPLICATION->GetException()) {
$strError = $ex->GetString() . "<br>";
} else {