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


PHP CIBlockProperty::GetByID方法代码示例

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


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

示例1: onBeforeElementAddHandler

 static function onBeforeElementAddHandler($arFields)
 {
     $IBLOCK_ID = Config\Option::get("citfact.replaceurl", "IBLOCK_ID", "");
     $SECTION_ID = Config\Option::get("citfact.replaceurl", "SECTION_BREND_ID", "BRENDI");
     $CODE_PROP = Config\Option::get("citfact.replaceurl", "PROPERTY_CODE_BRENDI", "BRENDI");
     if ($IBLOCK_ID == $arFields["IBLOCK_ID"]) {
         $propertyBrand = \CIBlockProperty::GetByID($CODE_PROP, $arFields["IBLOCK_ID"]);
         if ($arResultProperty = $propertyBrand->GetNext()) {
             $propertyBrandValue = \CIBlockPropertyEnum::GetByID($arFields["PROPERTY_VALUES"][$arResultProperty["ID"]][0]["VALUE"]);
         }
         $rqParentSection = \CIBlockSection::GetByID($SECTION_ID);
         if ($arParentSection = $rqParentSection->GetNext()) {
             $arFilter = array('IBLOCK_ID' => $arParentSection['IBLOCK_ID'], '>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'], '<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'], '>DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']);
             // выберет потомков без учета активности
             $rqSectChild = \CIBlockSection::GetList(array('left_margin' => 'asc'), $arFilter);
             while ($arSectChild = $rqSectChild->GetNext()) {
                 $arSections[$arSectChild["NAME"]] = $arSectChild["ID"];
             }
         }
         if (array_key_exists($propertyBrandValue["VALUE"], $arSections)) {
             $arFields["IBLOCK_SECTION"][] = $arSections[$propertyBrandValue["VALUE"]];
         } else {
             $arParams = array("replace_space" => "-", "replace_other" => "-");
             $trans = \Cutil::translit($propertyBrandValue["VALUE"], "ru", $arParams);
             $bs = new \CIBlockSection();
             $arFieldsNewSection = array("ACTIVE" => "Y", "IBLOCK_SECTION_ID" => $SECTION_ID, "IBLOCK_ID" => $IBLOCK_ID, "NAME" => $propertyBrandValue["VALUE"], "CODE" => $trans);
             $resultAdd = $bs->Add($arFieldsNewSection);
             $arFields["IBLOCK_SECTION"][] = $resultAdd;
         }
     }
     return true;
 }
开发者ID:ASDAFF,项目名称:citfact.replaceurl,代码行数:32,代码来源:Event.php

示例2: getPropertyEnumValueId

/**
 * Тип свойства - список
 * По коду и значению свойства получить id этого значения
 * В случае отсутствия, значение будет создано и будет возвращен его id
 *
 * <code>
 * $propertyCountryValue = getPropertyEnumValueId($IBLOCK_ID, 'COUNTRIES', 'Япония');
 * $be = new CIBlockElement;
 * $be->Add(array(
 *    "ACTIVE" => 'Y',
 *    "IBLOCK_ID" => $IBLOCK_ID,
 *    "NAME" => $name,
 *    "PROPERTY_VALUES" => array(
 *       'COUNTRIES' => $propertyCountryValue,
 *    )
 *  );
 * </code>
 * @param $IBLOCK_ID int id инфоблока, в котором находится данное свойство
 * @param $prop string код свойства
 * @param $value string значение свойства
 * @return bool|int ID значения свойства или false, если не удалось найти свойство с таким кодом или не удалось создать запись с данным значением
 */
function getPropertyEnumValueId($IBLOCK_ID, $prop, $value)
{
    $property = CIBlockProperty::GetByID($prop, $IBLOCK_ID)->Fetch();
    if (!$property) {
        return false;
    }
    $ar_enum_list = CIBlockProperty::GetPropertyEnum($prop, array("SORT" => "asc"), array("IBLOCK_ID" => $IBLOCK_ID, 'VALUE' => $value))->Fetch();
    if (!$ar_enum_list) {
        $ibpenum = new CIBlockPropertyEnum();
        if ($PropID = $ibpenum->Add(array('PROPERTY_ID' => $property['ID'], 'VALUE' => $value))) {
            $ar_enum_list['ID'] = $PropID;
        } else {
            return false;
        }
    }
    return $ar_enum_list['ID'];
}
开发者ID:ASDAFF,项目名称:Bitrix,代码行数:39,代码来源:iblockElementProperties.php

示例3: getIBlockItems

 public function getIBlockItems($IBLOCK_ID)
 {
     $items = array();
     foreach (CIBlockSectionPropertyLink::GetArray($IBLOCK_ID, $this->SECTION_ID) as $PID => $arLink) {
         if ($arLink["SMART_FILTER"] !== "Y") {
             continue;
         }
         $rsProperty = CIBlockProperty::GetByID($PID);
         $arProperty = $rsProperty->Fetch();
         if ($arProperty) {
             $items[$arProperty["ID"]] = array("ID" => $arProperty["ID"], "IBLOCK_ID" => $arProperty["IBLOCK_ID"], "CODE" => $arProperty["CODE"], "NAME" => $arProperty["NAME"], "PROPERTY_TYPE" => $arProperty["PROPERTY_TYPE"], "VALUES" => array());
             if ($arProperty["PROPERTY_TYPE"] == "N") {
                 $items[$arProperty["ID"]]["VALUES"] = array("MIN" => array("CONTROL_ID" => htmlspecialcharsbx($this->FILTER_NAME . "_" . $arProperty["ID"] . "_MIN"), "CONTROL_NAME" => htmlspecialcharsbx($this->FILTER_NAME . "_" . $arProperty["ID"] . "_MIN")), "MAX" => array("CONTROL_ID" => htmlspecialcharsbx($this->FILTER_NAME . "_" . $arProperty["ID"] . "_MAX"), "CONTROL_NAME" => htmlspecialcharsbx($this->FILTER_NAME . "_" . $arProperty["ID"] . "_MAX")));
             }
         }
     }
     return $items;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:18,代码来源:class.php

示例4: getIBlockItems

	public function getIBlockItems($IBLOCK_ID)
	{
		$items = array();

		foreach(CIBlockSectionPropertyLink::GetArray($IBLOCK_ID, $this->SECTION_ID) as $PID => $arLink)
		{
			if($arLink["SMART_FILTER"] !== "Y")
				continue;

			$rsProperty = CIBlockProperty::GetByID($PID);
			$arProperty = $rsProperty->Fetch();
			if($arProperty)
			{
				$items[$arProperty["ID"]] = array(
					"ID" => $arProperty["ID"],
					"IBLOCK_ID" => $arProperty["IBLOCK_ID"],
					"CODE" => $arProperty["CODE"],
					"NAME" => $arProperty["NAME"],
					"PROPERTY_TYPE" => $arProperty["PROPERTY_TYPE"],
					"USER_TYPE" => $arProperty["USER_TYPE"],
					"USER_TYPE_SETTINGS" => $arProperty["USER_TYPE_SETTINGS"],
					"VALUES" => array(),
				);

				if($arProperty["PROPERTY_TYPE"] == "N")
				{
					$minID = $this->SAFE_FILTER_NAME.'_'.$arProperty['ID'].'_MIN';
					$maxID = $this->SAFE_FILTER_NAME.'_'.$arProperty['ID'].'_MAX';
					$items[$arProperty["ID"]]["VALUES"] = array(
						"MIN" => array(
							"CONTROL_ID" => $minID,
							"CONTROL_NAME" => $minID,
						),
						"MAX" => array(
							"CONTROL_ID" => $maxID,
							"CONTROL_NAME" => $maxID,
						),
					);
				}
			}
		}
		return $items;
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:43,代码来源:class.php

示例5: foreach

        }
        ?>
			<?php 
    }
    ?>
			
			<?php 
    foreach ($arResult["ITEMS"] as $arItem) {
        if (!isset($arItem["PRICE"]) && ($arItem["PROPERTY_TYPE"] == "N" && !empty($arItem["VALUES"]["MIN"]["VALUE"]) || $arItem["PROPERTY_TYPE"] != "N" && !empty($arItem["VALUES"])) && !($arItem["PROPERTY_TYPE"] == "N" && $arItem["VALUES"]["MIN"]["VALUE"] == $arItem["VALUES"]["MAX"]["VALUE"])) {
            ?>

					<?php 
            if ($arItem["CODE"] != "HIT" && $arItem["CODE"] != "RECOMMEND" && $arItem["CODE"] != "NEW" && $arItem["CODE"] != "STOCK") {
                ?>
							<?php 
                $prop = CIBlockProperty::GetByID($arItem["ID"], $arParams["IBLOCK_ID"])->GetNext();
                ?>
							<span class="filter-name"><?php 
                echo $arItem["NAME"];
                if ($prop["HINT"]) {
                    ?>
<span class="hint"><span class="icon"><i>i</i></span><div class="tooltip"><?php 
                    echo $prop["HINT"];
                    ?>
</div></span><?php 
                }
                ?>
</span>	
					<?php 
            } elseif (!$specialtitle) {
                ?>
开发者ID:Andreyjktl,项目名称:rezina74,代码行数:31,代码来源:template.php

示例6: array

        include_once $cPrologPath;
    }
}
if ($this->StartResultCache(36000, false)) {
    $arResult["FIELDS"] = array();
    $arResult["BASE_FIELDS"] = array();
    $sort = 10;
    foreach ($showBaseFields as $baseField) {
        $msgName = "BRSOFT_FC_" . $baseField;
        $arField = array("CODE" => $baseField, "REQUIRED" => in_array($baseField, $reqBaseFields) ? true : false, "NAME" => GetMessage($msgName), "SORT" => $sort, "TYPE" => "BASE", "HINT" => GetMessage($msgName), "INPUT_TYPE" => $baseField == "NAME" ? "S" : "T");
        $arResult["FIELDS"][] = $arField;
        $sort += 100;
    }
    foreach ($showFields as $field) {
        $arField = array("TYPE" => "PROPERTY");
        $dbField = CIBlockProperty::GetByID($field, $iblock_id);
        if ($rsField = $dbField->GetNext()) {
            $input_type = "S";
            //default value
            switch ($rsField["PROPERTY_TYPE"]) {
                case 'S':
                    switch ($rsField["USER_TYPE"]) {
                        case 'DateTime':
                            $input_type = "D";
                            break;
                        case 'HTML':
                            $input_type = "H";
                            break;
                            // html/text usertype
                        // html/text usertype
                        default:
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:component.php

示例7: getTestIBlockProp

 /**
  * @param int|string $iblockCode
  * @param $arPropFields
  * @param bool $bFailOnNonExist
  * @return array
  */
 public function getTestIBlockProp($iblockCode, $arPropFields, $bFailOnNonExist = false)
 {
     $arTestIBlock = $this->getTestIBlock(array('CODE' => $iblockCode), true);
     $this->assertTrue(is_array($arTestIBlock));
     $this->assertArrayHasKey('ID', $arTestIBlock);
     if (!array_key_exists('CODE', $arPropFields)) {
         $this->fail('Error: Infoblock property code is empty');
     }
     if (array_key_exists($arTestIBlock['CODE'], self::$_arTestIBProps) && array_key_exists($arPropFields['CODE'], self::$_arTestIBProps[$arTestIBlock['CODE']])) {
         return self::$_arTestIBProps[$arTestIBlock['CODE']][$arPropFields['CODE']];
     }
     $rsProperty = \CIBlockProperty::GetList(array(), array('IBLOCK_ID' => $arTestIBlock['ID'], 'CODE' => $arPropFields['CODE']));
     $arProperty = $rsProperty->Fetch();
     if (!$arProperty) {
         if ($bFailOnNonExist) {
             $this->fail('Error: Property CODE="' . $arPropFields['CODE'] . '" does not exist');
         }
         if (!array_key_exists('NAME', $arPropFields) || empty($arPropFields['NAME'])) {
             $arPropFields['NAME'] = $arPropFields['CODE'];
         }
         if (array_key_exists('PROPERTY_TYPE', $arPropFields) && $arPropFields['PROPERTY_TYPE'] == 'L' && (!is_array($arPropFields['VALUES']) || empty($arPropFields['VALUES']))) {
             $this->fail('Error: Can\'t create property of type = list without values');
         }
         $arPropFieldsDef = array('IBLOCK_ID' => $arTestIBlock['ID'], 'PROPERTY_TYPE' => 'S', 'MULTIPLE' => 'N', 'ACTIVE' => 'Y', 'SORT' => '100');
         $arPropFields = array_merge($arPropFieldsDef, $arPropFields);
         $obProperty = new \CIBlockProperty();
         /** @global \CDatabase $DB */
         global $DB;
         $DB->StartTransaction();
         $newPropID = $obProperty->Add($arPropFields);
         if ($newPropID > 0) {
             $DB->Commit();
             $rsProperty = \CIBlockProperty::GetByID($newPropID);
             $arProperty = $rsProperty->Fetch();
             if (!$arProperty) {
                 $this->fail('Error: can\'t get just created infoblock property');
             }
         } else {
             $DB->Rollback();
             $this->fail('Error: Can\'t create property: ' . $obProperty->LAST_ERROR);
         }
     }
     if (!array_key_exists($arTestIBlock['CODE'], self::$_arTestIBProps)) {
         self::$_arTestIBProps[$arTestIBlock['CODE']] = array();
     }
     self::$_arTestIBProps[$arTestIBlock['CODE']][$arProperty['CODE']] = $arProperty;
     return self::$_arTestIBProps[$arTestIBlock['CODE']][$arPropFields['CODE']];
 }
开发者ID:OpenBX,项目名称:obx.core,代码行数:54,代码来源:testcase.php

示例8: array

 }
 $res = CIBlockProperty::GetByID("MANUFACTURER", $IBLOCK_CATALOG_ID, false);
 if ($ar_res = $res->GetNext()) {
     $arFields1 = array('LINK_IBLOCK_ID' => $_SESSION['YOUSTORE_BRAND_IBLOCKID']);
     $ibp = new CIBlockProperty();
     $ibp->Update($ar_res['ID'], $arFields1);
 }
 unset($_SESSION['YOUSTORE_BRAND_IBLOCKID']);
 $res = CIBlockProperty::GetByID("ACCESSORIES", $IBLOCK_CATALOG_ID, false);
 if ($ar_res = $res->GetNext()) {
     $arFields1 = array('LINK_IBLOCK_ID' => $IBLOCK_CATALOG_ID);
     $ibp = new CIBlockProperty();
     $ibp->Update($ar_res['ID'], $arFields1);
 }
 if ($IBLOCK_OFFERS_ID) {
     $res = CIBlockProperty::GetByID("COLOR", $IBLOCK_OFFERS_ID, false);
     if ($ar_res = $res->GetNext()) {
         $arFields2 = array('USER_TYPE_SETTINGS' => array('size' => '1', 'width' => '0', 'group' => 'N', 'multiple' => 'N', 'TABLE_NAME' => 'b_color'), 'USER_TYPE' => 'directory');
         $ibp = new CIBlockProperty();
         $ibp->Update($ar_res['ID'], $arFields2);
     }
 }
 WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "catalog/", array("OFFERS_IBLOCK_ID" => $IBLOCK_OFFERS_ID));
 WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "about/", array("CATALOG_IBLOCK_ID" => $IBLOCK_CATALOG_ID));
 WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "ajax/", array("CATALOG_IBLOCK_ID" => $IBLOCK_CATALOG_ID));
 WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "auth/", array("CATALOG_IBLOCK_ID" => $IBLOCK_CATALOG_ID));
 WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "brands/", array("CATALOG_IBLOCK_ID" => $IBLOCK_CATALOG_ID));
 WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "catalog/", array("CATALOG_IBLOCK_ID" => $IBLOCK_CATALOG_ID));
 WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "include/", array("CATALOG_IBLOCK_ID" => $IBLOCK_CATALOG_ID));
 WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "personal/", array("CATALOG_IBLOCK_ID" => $IBLOCK_CATALOG_ID));
 WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "news/", array("CATALOG_IBLOCK_ID" => $IBLOCK_CATALOG_ID));
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:catalog3.php

示例9: GetProp

 public static function GetProp($strProp)
 {
     $prop = '';
     $propert = array("ID", "CODE", "NAME", "ACTIVE", "DATE_CREATE", "CREATED_BY", "DETAIL_PAGE_URL", "SHOW_COUNTER", "QUANTITY");
     if (in_array($strProp, $propert)) {
         $prop = $strProp;
     } else {
         $res = CIBlockProperty::GetByID(intval($strProp));
         if ($ar_res = $res->GetNext()) {
             if ($ar_res['PROPERTY_TYPE'] == "L") {
                 $prop = "PROPERTY_" . $ar_res['CODE'];
             } else {
                 $prop = "PROPERTY_" . $ar_res['CODE'];
             }
         }
     }
     return $prop;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:18,代码来源:gmexport.php

示例10: GetMessage

             }
             $arProductGroups[$PRODUCT_ID][] = $LAST_GROUP_CODE > 0 ? $LAST_GROUP_CODE : false;
         }
         $res = $PRODUCT_ID > 0;
     }
     if (!$res) {
         $strErrorR .= GetMessage("CATI_LINE_NO") . " " . $line_num . ". " . GetMessage("CATI_ERROR_LOADING") . " " . $el->LAST_ERROR . "<br>";
     }
 }
 if ('' === $strErrorR) {
     $PROP = array();
     for ($i = 0; $i < $NUM_FIELDS; $i++) {
         if (0 == strncmp(${"field_" . $i}, "IP_PROP", 7)) {
             $cur_prop_id = intval(substr(${"field_" . $i}, 7));
             if (!isset($arIBlockProperty[$cur_prop_id])) {
                 $res1 = CIBlockProperty::GetByID($cur_prop_id, $IBLOCK_ID);
                 if ($arRes1 = $res1->Fetch()) {
                     $arIBlockProperty[$cur_prop_id] = $arRes1;
                 } else {
                     $arIBlockProperty[$cur_prop_id] = array();
                 }
             }
             if (!empty($arIBlockProperty[$cur_prop_id]) && is_array($arIBlockProperty[$cur_prop_id])) {
                 if ('Y' == $CML2_LINK_IS_XML && $cur_prop_id == $arSku['SKU_PROPERTY_ID']) {
                     $arRes[$i] = trim($arRes[$i]);
                     if ('' != $arRes[$i]) {
                         if (!isset($arProductCache[$arRes[$i]])) {
                             $rsProducts = CIBlockElement::GetList(array(), array('IBLOCK_ID' => $arSku['PRODUCT_IBLOCK_ID'], '=XML_ID' => $arRes[$i]), false, false, array('ID'));
                             if ($arParentProduct = $rsProducts->Fetch()) {
                                 $arProductCache[$arRes[$i]] = $arParentProduct['ID'];
                             }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:csv_new_run.php

示例11: UpdateEnum

 /**
  * <p>Метод устанавливает значения перечислений свойства типа "список". Метод динамичный.</p>
  *
  *
  * @param int $ID  Код свойства.
  *
  * @param array $arVALUES  Массив всех значений в формате Array("код существующего
  * значения"=&gt;"массив полей значения", ..., "массив полей нового
  * значения", ...). Где массив полей имеет вид: Array("VALUE"=&gt;"значение"[,
  * "SORT"=&gt;"порядок сортировки"][, "DEF"=&gt;"является значением по
  * умолчанию (Y|N)"][, "XML_ID"=&gt;"внешний код"]).
  *
  * @param bool $bForceDelete = true Если принимает значение <i>true</i>, то удаляются варианты значений, у
  * которых <i>VALUE</i> пустой. Значение <i>false</i> позволяет сохранить
  * значения, использованные хотя бы у одного элемента.
  * Необязательный параметр.
  *
  * @return mixed 
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * $cnt = 0;<br>$ar_all_values = Array();<br>$db_enum_list = CIBlockProperty::GetPropertyEnum($PROP_ID, Array('SORT'=&gt;'ASC'));<br>while($ar_enum = $db_enum_list-&gt;Fetch())<br>{<br>	$cnt++;<br>	$ar_all_values[$ar_enum['ID']] = Array('SORT'=&gt;$cnt, 'VALUE'=&gt;$ar_enum['VALUE']);<br>}<br>$CIBlockProp = new CIBlockProperty;
  * $CIBlockProp-&gt;UpdateEnum($PROP_ID, $ar_all_values); ?&gt;
  * </pre>
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/iblock/fields.php#fiblockpropertyenum">Поля значений
  * свойства типа "список</a><a
  * href="http://dev.1c-bitrix.ru/api_help/main/reference/ceventmessage/index.php#flds">" </a> </li> <li> <a
  * href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockpropertyenum/index.php">CIBlockPropetyEnum</a>::<a
  * href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockpropertyenum/update.php">Update()</a> </li> <li> <a
  * href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockpropertyenum/index.php">CIBlockPropetyEnum</a>::<a
  * href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockpropertyenum/add.php">Add()</a> </li> </ul> <a
  * name="examples"></a>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockproperty/updateenum.php
  * @author Bitrix
  */
 public function UpdateEnum($ID, $arVALUES, $bForceDelete = true)
 {
     global $DB, $CACHE_MANAGER;
     $ID = IntVal($ID);
     if (!is_array($arVALUES) || empty($arVALUES) && $bForceDelete) {
         CIBlockPropertyEnum::DeleteByPropertyID($ID);
         return true;
     }
     $ar_XML_ID = array();
     $db_res = $this->GetPropertyEnum($ID);
     while ($res = $db_res->Fetch()) {
         $ar_XML_ID[$res["XML_ID"]] = $res["ID"];
     }
     $sqlWhere = "";
     if (!$bForceDelete) {
         $rsProp = CIBlockProperty::GetByID($ID);
         if ($arProp = $rsProp->Fetch()) {
             if ($arProp["VERSION"] == 1) {
                 $sqlWhere = "AND NOT EXISTS (\n\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\tFROM b_iblock_element_property\n\t\t\t\t\t\tWHERE b_iblock_element_property.IBLOCK_PROPERTY_ID = b_iblock_property_enum.PROPERTY_ID\n\t\t\t\t\t\tAND b_iblock_element_property.VALUE_ENUM = b_iblock_property_enum.ID\n\t\t\t\t\t)";
             } elseif ($arProp["MULTIPLE"] == "N") {
                 $sqlWhere = "AND NOT EXISTS (\n\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\tFROM b_iblock_element_prop_s" . $arProp["IBLOCK_ID"] . "\n\t\t\t\t\t\tWHERE b_iblock_element_prop_s" . $arProp["IBLOCK_ID"] . ".PROPERTY_" . $arProp["ID"] . " = b_iblock_property_enum.ID\n\t\t\t\t\t)";
             } else {
                 $sqlWhere = "AND NOT EXISTS (\n\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\tFROM b_iblock_element_prop_m" . $arProp["IBLOCK_ID"] . "\n\t\t\t\t\t\tWHERE b_iblock_element_prop_m" . $arProp["IBLOCK_ID"] . ".IBLOCK_PROPERTY_ID = b_iblock_property_enum.PROPERTY_ID\n\t\t\t\t\t\tAND b_iblock_element_prop_m" . $arProp["IBLOCK_ID"] . ".VALUE_ENUM = b_iblock_property_enum.ID\n\t\t\t\t\t)";
             }
         }
     }
     $db_res = $this->GetPropertyEnum($ID);
     while ($res = $db_res->Fetch()) {
         $VALUE = $arVALUES[$res["ID"]];
         $VAL = is_array($VALUE) ? $VALUE["VALUE"] : $VALUE;
         unset($arVALUES[$res["ID"]]);
         if (strlen($VAL) <= 0) {
             unset($ar_XML_ID[$res["XML_ID"]]);
             $strSql = "\n\t\t\t\t\tDELETE FROM b_iblock_property_enum\n\t\t\t\t\tWHERE ID=" . $res["ID"] . "\n\t\t\t\t\t" . $sqlWhere . "\n\t\t\t\t";
             $DB->Query($strSql);
         } else {
             $DEF = "";
             $SORT = 0;
             $XML_ID = "";
             if (is_array($VALUE)) {
                 if (array_key_exists("DEF", $VALUE)) {
                     $DEF = $VALUE["DEF"] == "Y" ? "Y" : "N";
                 }
                 if (array_key_exists("SORT", $VALUE)) {
                     $SORT = intval($VALUE["SORT"]);
                 }
                 if ($SORT < 0) {
                     $SORT = 0;
                 }
                 if (array_key_exists("XML_ID", $VALUE) && strlen($VALUE["XML_ID"])) {
                     $XML_ID = substr($VALUE["XML_ID"], 0, 200);
                 } elseif (array_key_exists("EXTERNAL_ID", $VALUE) && strlen($VALUE["EXTERNAL_ID"])) {
                     $XML_ID = substr($VALUE["EXTERNAL_ID"], 0, 200);
                 }
             }
             if ($XML_ID) {
                 unset($ar_XML_ID[$res["XML_ID"]]);
                 if (array_key_exists($XML_ID, $ar_XML_ID)) {
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:iblockproperty.php

示例12: array

    $arFields = array("ACTIVE" => "Y", "FIELDS" => array('CODE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y'))), "CODE" => $iblockCode, "XML_ID" => $iblockCode);
    $iblock->Update($iblockID, $arFields);
} else {
    $arSites = array();
    $db_res = CIBlock::GetSite($iblockID);
    while ($res = $db_res->Fetch()) {
        $arSites[] = $res["LID"];
    }
    if (!in_array(WIZARD_SITE_ID, $arSites)) {
        $arSites[] = WIZARD_SITE_ID;
        $iblock = new CIBlock();
        $iblock->Update($iblockID, array("LID" => $arSites));
    }
}
for ($t = 1; $t <= 7; $t++) {
    $res = CIBlockProperty::GetByID("TAB_" . $t . "_TYPE", $iblockID, false);
    if ($ar_res = $res->GetNext()) {
        $arFields2 = array('USER_TYPE_SETTINGS' => array('size' => '1', 'width' => '0', 'group' => 'N', 'multiple' => 'N', 'TABLE_NAME' => 'tab'), 'USER_TYPE' => 'directory');
        $ibp = new CIBlockProperty();
        $ibp->Update($ar_res['ID'], $arFields2);
    }
}
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "about/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "about/obzor/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "ajax/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "auth/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "brands/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "catalog/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "include/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "personal/", array("REVIEWS_IBLOCK_ID" => $iblockID));
WizardServices::ReplaceMacrosRecursive(WIZARD_SITE_PATH . "news/", array("REVIEWS_IBLOCK_ID" => $iblockID));
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:reviews.php

示例13: getIBlockItems

 public function getIBlockItems($IBLOCK_ID)
 {
     $items = array();
     foreach (CIBlockSectionPropertyLink::GetArray($IBLOCK_ID, $this->SECTION_ID) as $PID => $arLink) {
         if ($arLink["SMART_FILTER"] !== "Y") {
             continue;
         }
         if ($arLink['FILTER_HINT'] != '') {
             $arLink['FILTER_HINT'] = CTextParser::closeTags($arLink['FILTER_HINT']);
         }
         $rsProperty = CIBlockProperty::GetByID($PID);
         $arProperty = $rsProperty->Fetch();
         if ($arProperty) {
             $items[$arProperty["ID"]] = array("ID" => $arProperty["ID"], "IBLOCK_ID" => $arProperty["IBLOCK_ID"], "CODE" => $arProperty["CODE"], "NAME" => $arProperty["NAME"], "PROPERTY_TYPE" => $arProperty["PROPERTY_TYPE"], "USER_TYPE" => $arProperty["USER_TYPE"], "USER_TYPE_SETTINGS" => $arProperty["USER_TYPE_SETTINGS"], "DISPLAY_TYPE" => $arLink["DISPLAY_TYPE"], "DISPLAY_EXPANDED" => $arLink["DISPLAY_EXPANDED"], "FILTER_HINT" => $arLink["FILTER_HINT"], "VALUES" => array());
             if ($arProperty["PROPERTY_TYPE"] == "N" || $arLink["DISPLAY_TYPE"] == "U") {
                 $minID = $this->SAFE_FILTER_NAME . '_' . $arProperty['ID'] . '_MIN';
                 $maxID = $this->SAFE_FILTER_NAME . '_' . $arProperty['ID'] . '_MAX';
                 $items[$arProperty["ID"]]["VALUES"] = array("MIN" => array("CONTROL_ID" => $minID, "CONTROL_NAME" => $minID), "MAX" => array("CONTROL_ID" => $maxID, "CONTROL_NAME" => $maxID));
             }
         }
     }
     return $items;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:23,代码来源:class.php

示例14: ShowError

    ShowError(GetMessage('CRM_IBLOCK_MODULE_NOT_INSTALLED'));
    return;
}
global $USER, $APPLICATION;
$arParams['PATH_TO_PRODUCTPROPS_LIST'] = CrmCheckPath('PATH_TO_PRODUCTPROPS_LIST', $arParams['PATH_TO_PRODUCTPROPS_LIST'], '');
$arParams['PATH_TO_PRODUCTPROPS_ADD'] = CrmCheckPath('PATH_TO_PRODUCTPROPS_ADD', $arParams['PATH_TO_PRODUCTPROPS_ADD'], '?add');
$arParams['PATH_TO_PRODUCTPROPS_EDIT'] = CrmCheckPath('PATH_TO_PRODUCTPROPS_EDIT', $arParams['PATH_TO_PRODUCTPROPS_EDIT'], '?prop_id=#prop_id#&edit');
if (!isset($arParams['TYPE'])) {
    $arParams['TYPE'] = 'list';
}
$arResult['BUTTONS'] = array();
$propID = isset($arParams['PROP_ID']) ? intval($arParams['PROP_ID']) : 0;
$CrmPerms = new CCrmPerms($USER->GetID());
$propAdd = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE');
$arProp = null;
if ($propID > 0) {
    $iblockID = intval(CCrmCatalog::EnsureDefaultExists());
    $dbRes = CIBlockProperty::GetByID($propID, $iblockID);
    if (is_object($dbRes)) {
        $arProp = $dbRes->Fetch();
    }
    unset($dbRes);
}
$exists = intval($propID > 0) && is_array($arProp);
if ($arParams['TYPE'] !== 'list') {
    $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_PRODUCTPROP_LIST'), 'TITLE' => GetMessage('CRM_PRODUCTPROP_LIST_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PRODUCTPROPS_LIST'], array()), 'ICON' => 'btn-list');
}
if ($arParams['TYPE'] === 'list' && $propAdd) {
    $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_PRODUCTPROP_ADD'), 'TITLE' => GetMessage('CRM_PRODUCTPROP_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PRODUCTPROPS_ADD'], array()), 'ICON' => 'btn-new');
}
$this->IncludeComponentTemplate();
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例15: DoIBlockAfterSave

function DoIBlockAfterSave($arg1, $arg2 = false)
{
    $ELEMENT_ID = false;
    $IBLOCK_ID = false;
    $OFFERS_IBLOCK_ID = false;
    $OFFERS_PROPERTY_ID = false;
    if (CModule::IncludeModule('currency')) {
        $strDefaultCurrency = CCurrency::GetBaseCurrency();
    }
    //Check for catalog event
    if (is_array($arg2) && $arg2["PRODUCT_ID"] > 0) {
        //Get iblock element
        $rsPriceElement = CIBlockElement::GetList(array(), array("ID" => $arg2["PRODUCT_ID"]), false, false, array("ID", "IBLOCK_ID"));
        if ($arPriceElement = $rsPriceElement->Fetch()) {
            $arCatalog = CCatalog::GetByID($arPriceElement["IBLOCK_ID"]);
            if (is_array($arCatalog)) {
                //Check if it is offers iblock
                if ($arCatalog["OFFERS"] == "Y") {
                    //Find product element
                    $rsElement = CIBlockElement::GetProperty($arPriceElement["IBLOCK_ID"], $arPriceElement["ID"], "sort", "asc", array("ID" => $arCatalog["SKU_PROPERTY_ID"]));
                    $arElement = $rsElement->Fetch();
                    if ($arElement && $arElement["VALUE"] > 0) {
                        $ELEMENT_ID = $arElement["VALUE"];
                        $IBLOCK_ID = $arCatalog["PRODUCT_IBLOCK_ID"];
                        $OFFERS_IBLOCK_ID = $arCatalog["IBLOCK_ID"];
                        $OFFERS_PROPERTY_ID = $arCatalog["SKU_PROPERTY_ID"];
                    }
                } elseif ($arCatalog["OFFERS_IBLOCK_ID"] > 0) {
                    $ELEMENT_ID = $arPriceElement["ID"];
                    $IBLOCK_ID = $arPriceElement["IBLOCK_ID"];
                    $OFFERS_IBLOCK_ID = $arCatalog["OFFERS_IBLOCK_ID"];
                    $OFFERS_PROPERTY_ID = $arCatalog["OFFERS_PROPERTY_ID"];
                } else {
                    $ELEMENT_ID = $arPriceElement["ID"];
                    $IBLOCK_ID = $arPriceElement["IBLOCK_ID"];
                    $OFFERS_IBLOCK_ID = false;
                    $OFFERS_PROPERTY_ID = false;
                }
            }
        }
    } elseif (is_array($arg1) && $arg1["ID"] > 0 && $arg1["IBLOCK_ID"] > 0) {
        //Check if iblock has offers
        $arOffers = CIBlockPriceTools::GetOffersIBlock($arg1["IBLOCK_ID"]);
        if (is_array($arOffers)) {
            $ELEMENT_ID = $arg1["ID"];
            $IBLOCK_ID = $arg1["IBLOCK_ID"];
            $OFFERS_IBLOCK_ID = $arOffers["OFFERS_IBLOCK_ID"];
            $OFFERS_PROPERTY_ID = $arOffers["OFFERS_PROPERTY_ID"];
        }
    }
    if ($ELEMENT_ID) {
        static $arPropCache = array();
        if (!array_key_exists($IBLOCK_ID, $arPropCache)) {
            //Check for MINIMAL_PRICE property
            $rsProperty = CIBlockProperty::GetByID("MINIMUM_PRICE", $IBLOCK_ID);
            $arProperty = $rsProperty->Fetch();
            if ($arProperty) {
                $arPropCache[$IBLOCK_ID] = $arProperty["ID"];
            } else {
                $arPropCache[$IBLOCK_ID] = false;
            }
        }
        if ($arPropCache[$IBLOCK_ID]) {
            //Compose elements filter
            if ($OFFERS_IBLOCK_ID) {
                $rsOffers = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $OFFERS_IBLOCK_ID, "PROPERTY_" . $OFFERS_PROPERTY_ID => $ELEMENT_ID), false, false, array("ID"));
                while ($arOffer = $rsOffers->Fetch()) {
                    $arProductID[] = $arOffer["ID"];
                }
                if (!is_array($arProductID)) {
                    $arProductID = array($ELEMENT_ID);
                }
            } else {
                $arProductID = array($ELEMENT_ID);
            }
            $minPrice = false;
            $maxPrice = false;
            //Get prices
            $rsPrices = CPrice::GetList(array(), array("PRODUCT_ID" => $arProductID));
            while ($arPrice = $rsPrices->Fetch()) {
                if (CModule::IncludeModule('currency') && $strDefaultCurrency != $arPrice['CURRENCY']) {
                    $arPrice["PRICE"] = CCurrencyRates::ConvertCurrency($arPrice["PRICE"], $arPrice["CURRENCY"], $strDefaultCurrency);
                }
                $PRICE = $arPrice["PRICE"];
                if ($minPrice === false || $minPrice > $PRICE) {
                    $minPrice = $PRICE;
                }
                if ($maxPrice === false || $maxPrice < $PRICE) {
                    $maxPrice = $PRICE;
                }
            }
            //Save found minimal price into property
            if ($minPrice !== false) {
                CIBlockElement::SetPropertyValuesEx($ELEMENT_ID, $IBLOCK_ID, array("MINIMUM_PRICE" => $minPrice, "MAXIMUM_PRICE" => $maxPrice));
            }
        }
    }
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:98,代码来源:sort_scu.php


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