本文整理汇总了PHP中CIBlockElement::GetPropertyValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::GetPropertyValues方法的具体用法?PHP CIBlockElement::GetPropertyValues怎么用?PHP CIBlockElement::GetPropertyValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::GetPropertyValues方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$rsElements = CIBlockElement::GetPropertyValues($this->IBLOCK_ID, $arElementFilter, false, array('ID' => $this->arResult["PROPERTY_ID_LIST"]));
while ($arElement = $rsElements->Fetch()) {
$arElements[$arElement["IBLOCK_ELEMENT_ID"]] = $arElement;
}
} else {
$rsElements = CIBlockElement::GetList(array('ID' => 'ASC'), $arElementFilter, false, false, array('ID', 'IBLOCK_ID'));
while ($arElement = $rsElements->Fetch()) {
$arElements[$arElement["ID"]] = array();
}
}
if (!empty($arElements) && $this->SKU_IBLOCK_ID && $arResult["SKU_PROPERTY_COUNT"] > 0) {
$arSkuFilter = array("IBLOCK_ID" => $this->SKU_IBLOCK_ID, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y", "=PROPERTY_" . $this->SKU_PROPERTY_ID => array_keys($arElements));
if ($this->arParams['HIDE_NOT_AVAILABLE'] == 'Y') {
$arSkuFilter['CATALOG_AVAILABLE'] = 'Y';
}
$rsElements = CIBlockElement::GetPropertyValues($this->SKU_IBLOCK_ID, $arSkuFilter, false, array('ID' => $this->arResult["SKU_PROPERTY_ID_LIST"]));
while ($arSku = $rsElements->Fetch()) {
foreach ($arResult["ITEMS"] as $PID => $arItem) {
if (isset($arSku[$PID]) && $arSku[$this->SKU_PROPERTY_ID] > 0) {
if (is_array($arSku[$PID])) {
foreach ($arSku[$PID] as $value) {
$arElements[$arSku[$this->SKU_PROPERTY_ID]][$PID][] = $value;
}
} else {
$arElements[$arSku[$this->SKU_PROPERTY_ID]][$PID][] = $arSku[$PID];
}
}
}
}
}
CTimeZone::Disable();
示例2: array
$arElements = array();
$rsElements = CIBlockElement::GetPropertyValues($this->IBLOCK_ID, $arElementFilter);
while($arElement = $rsElements->Fetch())
$arElements[$arElement["IBLOCK_ELEMENT_ID"]] = $arElement;
if (!empty($arElements) && $this->SKU_IBLOCK_ID && $this->SKU_PROPERTY_COUNT > 0)
{
$arSkuFilter = array(
"IBLOCK_ID" => $this->SKU_IBLOCK_ID,
"ACTIVE_DATE" => "Y",
"ACTIVE" => "Y",
"CHECK_PERMISSIONS" => "Y",
"=PROPERTY_".$this->SKU_PROPERTY_ID => array_keys($arElements),
);
$rsElements = CIBlockElement::GetPropertyValues($this->SKU_IBLOCK_ID, $arSkuFilter);
while($arSku = $rsElements->Fetch())
{
foreach($arResult["ITEMS"] as $PID => $arItem)
{
if (isset($arSku[$PID]) && $arSku[$this->SKU_PROPERTY_ID] > 0)
$arElements[$arSku[$this->SKU_PROPERTY_ID]][$PID][] = $arSku[$PID];
}
}
}
foreach($arElements as $arElement)
{
$propertyValues = $propertyEmptyValuesCombination;
foreach($arResult["ITEMS"] as $PID => $arItem)
{
示例3: GetPropertyValuesArray
public static function GetPropertyValuesArray(&$result, $iblockID, $filter, $propertyFilter = array())
{
$iblockExtVersion = CIBlockElement::GetIBVersion($iblockID) == 2;
$propertiesList = array();
$mapCodes = array();
$userTypesList = array();
$existList = array();
$selectListMultiply = array('SORT' => SORT_ASC, 'VALUE' => SORT_STRING);
$selectAllMultiply = array('PROPERTY_VALUE_ID' => SORT_ASC);
$propertyListFilter = array('IBLOCK_ID' => $iblockID);
$propertyID = array();
if (isset($propertyFilter['ID'])) {
$propertyID = is_array($propertyFilter['ID']) ? $propertyFilter['ID'] : array($propertyFilter['ID']);
Collection::normalizeArrayValuesByInt($propertyID);
}
if (!empty($propertyID)) {
$propertyListFilter['@ID'] = $propertyID;
} elseif (isset($propertyFilter['CODE'])) {
if (!is_array($propertyFilter['CODE'])) {
$propertyFilter['CODE'] = array($propertyFilter['CODE']);
}
$propertyCodes = array();
if (!empty($propertyFilter['CODE'])) {
foreach ($propertyFilter['CODE'] as &$code) {
$code = (string) $code;
if ($code !== '') {
$propertyCodes[] = $code;
}
}
unset($code);
}
if (!empty($propertyCodes)) {
$propertyListFilter['@CODE'] = $propertyCodes;
}
unset($propertyCodes);
}
$propertyListFilter['=ACTIVE'] = isset($propertyFilter['ACTIVE']) && ($propertyFilter['ACTIVE'] == 'Y' || $propertyFilter['ACTIVE'] == 'N') ? $propertyFilter['ACTIVE'] : 'Y';
$propertyID = array();
$propertyIterator = PropertyTable::getList(array('select' => array('ID', 'IBLOCK_ID', 'NAME', 'ACTIVE', 'SORT', 'CODE', 'DEFAULT_VALUE', 'PROPERTY_TYPE', 'ROW_COUNT', 'COL_COUNT', 'LIST_TYPE', 'MULTIPLE', 'XML_ID', 'FILE_TYPE', 'MULTIPLE_CNT', 'LINK_IBLOCK_ID', 'WITH_DESCRIPTION', 'SEARCHABLE', 'FILTRABLE', 'IS_REQUIRED', 'VERSION', 'USER_TYPE', 'USER_TYPE_SETTINGS', 'HINT'), 'filter' => $propertyListFilter, 'order' => array('SORT' => 'ASC', 'ID' => 'ASC')));
while ($property = $propertyIterator->fetch()) {
$propertyID[] = (int) $property['ID'];
$property['CODE'] = trim((string) $property['CODE']);
if ($property['CODE'] === '') {
$property['CODE'] = $property['ID'];
}
$code = $property['CODE'];
$property['~NAME'] = $property['NAME'];
if (preg_match("/[;&<>\"]/", $property['NAME'])) {
$property['NAME'] = htmlspecialcharsex($property['NAME']);
}
if ($property['USER_TYPE']) {
$userType = CIBlockProperty::GetUserType($property['USER_TYPE']);
if (isset($userType['ConvertFromDB'])) {
$userTypesList[$property['ID']] = $userType;
if (array_key_exists("DEFAULT_VALUE", $property)) {
$value = array("VALUE" => $property["DEFAULT_VALUE"], "DESCRIPTION" => "");
$value = call_user_func_array($userType["ConvertFromDB"], array($property, $value));
$property["DEFAULT_VALUE"] = $value["VALUE"];
}
}
}
if ($property['USER_TYPE_SETTINGS'] !== '' || $property['USER_TYPE_SETTINGS'] !== null) {
$property['USER_TYPE_SETTINGS'] = unserialize($property['USER_TYPE_SETTINGS']);
}
$property['~DEFAULT_VALUE'] = $property['DEFAULT_VALUE'];
if (is_array($property['DEFAULT_VALUE']) || preg_match("/[;&<>\"]/", $property['DEFAULT_VALUE'])) {
$property['DEFAULT_VALUE'] = htmlspecialcharsex($property['DEFAULT_VALUE']);
}
if ($property['PROPERTY_TYPE'] == PropertyTable::TYPE_LIST) {
$existList[] = $property['ID'];
}
$mapCodes[$property['ID']] = $code;
$propertiesList[$code] = $property;
}
unset($property, $propertyIterator);
if (empty($propertiesList)) {
return;
}
if (!empty($existList)) {
$enumList = array();
$enumIterator = PropertyEnumerationTable::getList(array('select' => array('ID', 'PROPERTY_ID', 'VALUE', 'SORT', 'XML_ID'), 'filter' => array('PROPERTY_ID' => $existList), 'order' => array('PROPERTY_ID' => 'ASC', 'SORT' => 'ASC', 'VALUE' => 'ASC')));
while ($enum = $enumIterator->fetch()) {
if (!isset($enumList[$enum['PROPERTY_ID']])) {
$enumList[$enum['PROPERTY_ID']] = array();
}
$enumList[$enum['PROPERTY_ID']][$enum['ID']] = array('ID' => $enum['ID'], 'VALUE' => $enum['VALUE'], 'SORT' => $enum['SORT'], 'XML_ID' => $enum['XML_ID']);
}
unset($enum, $enumIterator);
}
$valuesRes = !empty($propertyID) ? CIBlockElement::GetPropertyValues($iblockID, $filter, true, array('ID' => $propertyID)) : CIBlockElement::GetPropertyValues($iblockID, $filter, true);
while ($value = $valuesRes->Fetch()) {
$elementID = $value['IBLOCK_ELEMENT_ID'];
if (!isset($result[$elementID])) {
continue;
}
$elementValues = array();
$existDescription = isset($value['DESCRIPTION']);
foreach ($propertiesList as $code => $property) {
$existElementDescription = isset($value['DESCRIPTION']) && array_key_exists($property['ID'], $value['DESCRIPTION']);
$existElementPropertyID = isset($value['PROPERTY_VALUE_ID']) && array_key_exists($property['ID'], $value['PROPERTY_VALUE_ID']);
//.........这里部分代码省略.........
示例4: GetPropertyValuesArray
public static function GetPropertyValuesArray(&$result, $iblockID, $filter)
{
$iblockExtVersion = (CIBlockElement::GetIBVersion($iblockID) == 2);
$propertiesList = array();
$mapCodes = array();
$userTypesList = array();
$existList = false;
$selectListMultiply = array('SORT' => SORT_NUMERIC, 'VALUE' => SORT_STRING);
$propertyRes = CIBlockProperty::GetList(array('SORT'=>'ASC','ID'=>'ASC'), array('IBLOCK_ID' => $iblockID, 'ACTIVE' => 'Y'));
while ($property = $propertyRes->Fetch())
{
$property['CODE'] = trim((string)$property['CODE']);
if ('' === $property['CODE'])
{
$property['CODE'] = $property['ID'];
}
$code = $property['CODE'];
$property['~NAME'] = $property['NAME'];
if (preg_match("/[;&<>\"]/", $property['NAME']))
$property['NAME'] = htmlspecialcharsex($property['NAME']);
$property['~DEFAULT_VALUE'] = $property['DEFAULT_VALUE'];
if (is_array($property['DEFAULT_VALUE']) || preg_match("/[;&<>\"]/", $property['DEFAULT_VALUE']))
$property['DEFAULT_VALUE'] = htmlspecialcharsex($property['DEFAULT_VALUE']);
if ('L' == $property['PROPERTY_TYPE'])
{
$existList = true;
}
if ('' != $property['USER_TYPE'])
{
$userType = CIBlockProperty::GetUserType($property['USER_TYPE']);
if (isset($userType['ConvertFromDB']))
{
$userTypesList[$property['ID']] = $userType;
}
}
$mapCodes[$property['ID']] = $code;
$propertiesList[$code] = $property;
}
if (empty($propertiesList))
{
return;
}
if ($existList)
{
$enumList = array();
$enumRes = CIBlockPropertyEnum::GetList(
array('PROPERTY_ID' => 'ASC', 'SORT' => 'ASC', 'VALUE' => 'ASC'),
array('IBLOCK_ID' => $iblockID, 'PROPERTY_ACTIVE' => 'Y')
);
while ($enum = $enumRes->Fetch())
{
if (!isset($enumList[$enum['PROPERTY_ID']]))
{
$enumList[$enum['PROPERTY_ID']] = array();
}
$enumList[$enum['PROPERTY_ID']][$enum['ID']] = array(
'ID' => $enum['ID'],
'VALUE' => $enum['VALUE'],
'SORT' => $enum['SORT'],
'XML_ID' => $enum['XML_ID']
);
}
}
$valuesRes = CIBlockElement::GetPropertyValues($iblockID, $filter, true);
while ($value = $valuesRes->Fetch())
{
$elementID = $value['IBLOCK_ELEMENT_ID'];
if (!isset($result[$elementID]))
{
continue;
}
$elementValues = array();
$existDescription = isset($value['DESCRIPTION']);
foreach ($propertiesList as $code => $property)
{
$existElementDescription = isset($value['DESCRIPTION']) && array_key_exists($property['ID'], $value['DESCRIPTION']);
$existElementPropertyID = isset($value['PROPERTY_VALUE_ID']) && array_key_exists($property['ID'], $value['PROPERTY_VALUE_ID']);
$elementValues[$code] = $property;
$elementValues[$code]['VALUE_ENUM'] = null;
$elementValues[$code]['VALUE_XML_ID'] = null;
$elementValues[$code]['VALUE_SORT'] = null;
$elementValues[$code]['VALUE'] = null;
if ('Y' === $property['MULTIPLE'])
{
$elementValues[$code]['PROPERTY_VALUE_ID'] = false;
if (!isset($value[$property['ID']]) || empty($value[$property['ID']]))
{
$elementValues[$code]['DESCRIPTION'] = false;
$elementValues[$code]['VALUE'] = false;
//.........这里部分代码省略.........