当前位置: 首页>>代码示例>>PHP>>正文


PHP CCatalogGroup::Add方法代码示例

本文整理汇总了PHP中CCatalogGroup::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogGroup::Add方法的具体用法?PHP CCatalogGroup::Add怎么用?PHP CCatalogGroup::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCatalogGroup的用法示例。


在下文中一共展示了CCatalogGroup::Add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __cat_setPriceTypes

function __cat_setPriceTypes($arPriceTypes)
{
    $arCurrentPriceTypes = array();
    $dbRes = CCatalogGroup::GetList();
    while ($arRes = $dbRes->Fetch()) {
        $arCurrentPriceTypes[$arRes['NAME']] = $arRes;
    }
    $arLang = __cat_LoadMess(dirname(__FILE__) . '/types.php');
    foreach ($arPriceTypes as $type_id => $arFields) {
        if (isset($arCurrentPriceTypes[$type_id])) {
            continue;
        }
        foreach ($arLang as $LANG => $arMess) {
            $arFields['USER_LANG'][$LANG] = $arMess['CAT_PRICE_TYPE_' . $type_id];
        }
        // errors're goin by forest
        CCatalogGroup::Add($arFields);
    }
}
开发者ID:Satariall,项目名称:izurit,代码行数:19,代码来源:lib.php

示例2: 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;
 }
开发者ID:nycmic,项目名称:bittest,代码行数:74,代码来源:cml2.php

示例3: cmlEndElement

function cmlEndElement($parser, $name)
{
    global $DB;
    global $currentCatalog, $currentProduct, $currentProperty, $currentOffersList, $currentOffer;
    global $arIBlockCache;
    global $APPLICATION, $nameUTF, $tmpid;
    switch ($name) {
        case $nameUTF["Catalog"]:
            $currentCatalog = false;
            break;
        case $nameUTF["Product"]:
            $currentProduct = false;
            break;
        case $nameUTF["Property"]:
            $currentProperty = false;
            break;
        case $nameUTF["OffersList"]:
            if (!array_key_exists("PRICE_TYPE", $currentOffersList) || strlen($currentOffersList["PRICE_TYPE"]) <= 0) {
                $strSql = "SELECT NAME FROM b_catalog_group WHERE BASE = 'Y'";
                $dbRes = $DB->Query($strSql);
                if ($arRes = $dbRes->Fetch()) {
                    $priceType = $arRes["NAME"];
                    $currentOffersList["PRICE_TYPE"] = $priceType;
                    $strSql = "INSERT INTO b_catalog_cml_oflist_prop (OFFER_LIST_XML_ID, PROPERTY_VALUE) " . "VALUES (" . $currentOffersList["ID"] . ", '" . $DB->ForSql($priceType, 255) . "')";
                    $DB->Query($strSql);
                }
            } else {
                $strSql = "SELECT count(*) as CNT FROM b_catalog_group WHERE NAME = '" . $DB->ForSql($currentOffersList["PRICE_TYPE"]) . "'";
                $dbRes = $DB->Query($strSql);
                if ($arRes = $dbRes->Fetch()) {
                    if (IntVal($arRes["CNT"]) <= 0) {
                        CCatalogGroup::Add(array("NAME" => $currentOffersList["PRICE_TYPE"], "USER_LANG" => array("ru" => $currentOffersList["PRICE_TYPE"])));
                    }
                }
            }
            $currentOffersList = false;
            break;
        case $nameUTF["Offer"]:
            $currentOffer = false;
            break;
    }
}
开发者ID:rasuldev,项目名称:torino,代码行数:42,代码来源:commerceml_g_run.php

示例4: array

    }
}
$dbResultList = CCatalogGroup::GetList(array(), array("BASE" => "Y"));
if (!$dbResultList->Fetch()) {
    $arFields = array();
    $rsLanguage = CLanguage::GetList($by, $order, array());
    while ($arLanguage = $rsLanguage->Fetch()) {
        WizardServices::IncludeServiceLang("catalog.php", $arLanguage["ID"]);
        $arFields["USER_LANG"][$arLanguage["ID"]] = GetMessage("WIZ_PRICE_NAME");
    }
    $arFields["BASE"] = "Y";
    $arFields["SORT"] = 100;
    $arFields["NAME"] = "BASE";
    $arFields["USER_GROUP"] = array(1);
    $arFields["USER_GROUP_BUY"] = array(1);
    CCatalogGroup::Add($arFields);
}
if ($IBLOCK_CATALOG_ID == false) {
    $permissions = array("1" => "X", "2" => "R");
    $dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "sale_administrator"));
    if ($arGroup = $dbGroup->Fetch()) {
        $permissions[$arGroup["ID"]] = 'W';
    }
    $dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "content_editor"));
    if ($arGroup = $dbGroup->Fetch()) {
        $permissions[$arGroup["ID"]] = 'W';
    }
    $IBLOCK_CATALOG_ID = WizardServices::ImportIBlockFromXML($iblockXMLFile, "clothes", $iblockType, WIZARD_SITE_ID, $permissions);
    $IBLOCK_CATALOG_ID1 = WizardServices::ImportIBlockFromXML($iblockXMLFilePrices, "clothes", $iblockType . "_prices", WIZARD_SITE_ID, $permissions);
    if ($IBLOCK_CATALOG_ID < 1) {
        return;
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:catalog.php

示例5: array

		if (strlen($OFFER_LIST_CURRENCY)<=0)
			$OFFER_LIST_CURRENCY = "USD";

		//detect "price type" property
		$props = $xOfferListNode->select_nodes("/".$nameUTF['PropertyValue']);
		if (!is_object($props[0]))
			continue;

		$PRICE_TYPE = $props[0]->GetAttribute($nameUTF['Value']);
		$res = CCatalogGroup::GetList(array(), array("NAME"=>$PRICE_TYPE));
		if ($arr = $res->Fetch())
			$PRICE_ID = $arr["ID"];
		else
			$PRICE_ID = CCatalogGroup::Add(
					Array(
						"NAME"=>$PRICE_TYPE,
						"USER_LANG"=>Array("ru"=>$PRICE_TYPE)
					)
				);

		$arProducts = $arCatalogsParams[$IBLOCK_XML_ID]["arProducts"];

		$arOffers = array();
		$offers = $xOfferListNode->select_nodes("/".$nameUTF['Offer']);

		for ($j = 0, $intOtOFCount = count($offers); $j < $intOtOFCount; $j++)
		{
			$xOfferNode = $offers[$j];

			$PRODUCT_XML_ID = $xOfferNode->GetAttribute($nameUTF['ProductId']);

			// we sholdn't go to 'continue', but should search product in DB by XML_ID
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:32,代码来源:commerceml_run.php

示例6: array

    }
    $arFields = array();
    $arFields["USER_LANG"] = array();
    foreach ($arActiveLangs as &$language) {
        if (isset($catalogGroupLangFiles[$language])) {
            $arFields["USER_LANG"][$language] = $catalogGroupLangFiles[$language]['CRM_BASE_PRICE_NAME'];
        }
    }
    unset($language);
    unset($catalogGroupLangFiles);
    $arFields["BASE"] = "Y";
    $arFields["SORT"] = 100;
    $arFields["NAME"] = "BASE";
    $arFields["USER_GROUP"] = array(1, 2);
    $arFields["USER_GROUP_BUY"] = array(1, 2);
    $basePriceId = CCatalogGroup::Add($arFields);
    if ($basePriceId <= 0) {
        $errMsg[] = Loc::getMessage('CRM_UPDATE_ERR_003');
        return;
    }
}
if ($basePriceId <= 0 && isset($basePrice['ID']) && $basePrice['ID'] > 0) {
    $basePriceId = $basePrice['ID'];
}
unset($basePrice, $dbRes);
$arCatalogId = array();
$dbCatalogList = CCrmCatalog::GetList();
while ($arCatalog = $dbCatalogList->Fetch()) {
    $arCatalogId[] = $arCatalog['ID'];
}
$defCatalogId = CCrmCatalog::EnsureDefaultExists();
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:sale_link.php


注:本文中的CCatalogGroup::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。