本文整理汇总了PHP中CIBlockElement::GetPropertyValuesArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::GetPropertyValuesArray方法的具体用法?PHP CIBlockElement::GetPropertyValuesArray怎么用?PHP CIBlockElement::GetPropertyValuesArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::GetPropertyValuesArray方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetProductSkuProps
static function GetProductSkuProps($ID, $IBLOCK_ID = '', $getExt = false)
{
$getExt = $getExt === true;
$arSkuProps = array();
$ID = (int) $ID;
$IBLOCK_ID = (int) $IBLOCK_ID;
if ($ID > 0 && \Bitrix\Main\Loader::includeModule('catalog')) {
$filter = array('ID' => $ID, 'ACTIVE' => 'Y');
if ($IBLOCK_ID > 0) {
$filter['IBLOCK_ID'] = $IBLOCK_ID;
}
$res = CIBlockElement::GetList(array(), $filter, false, false, array("ID", "IBLOCK_ID"));
$arElement = $res->Fetch();
if ($arElement) {
$arElement['ID'] = (int) $arElement['ID'];
$arParent = CCatalogSku::GetProductInfo($ID, $arElement["IBLOCK_ID"]);
if ($arParent) {
$arElement['PROPERTIES'] = array();
$arElementLink = array($arElement['ID'] => &$arElement);
$arFilter = array('ID' => $arElement['ID'], 'IBLOCK_ID' => $arElement["IBLOCK_ID"]);
CIBlockElement::GetPropertyValuesArray($arElementLink, $arElement["IBLOCK_ID"], $arFilter);
if (!empty($arElement['PROPERTIES'])) {
foreach ($arElement['PROPERTIES'] as &$prop) {
if ($prop['XML_ID'] == 'CML2_LINK' || $prop['PROPERTY_TYPE'] == 'F') {
continue;
}
$boolArr = is_array($prop["VALUE"]);
if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
$displayProperty = CIBlockFormatProperties::GetDisplayValue($arElement, $prop, '');
$mxValues = '';
if ('E' == $prop['PROPERTY_TYPE']) {
if (!empty($displayProperty['LINK_ELEMENT_VALUE'])) {
$mxValues = array();
foreach ($displayProperty['LINK_ELEMENT_VALUE'] as $arTempo) {
$mxValues[] = $arTempo['NAME'] . ' [' . $arTempo['ID'] . ']';
}
}
} elseif ('G' == $prop['PROPERTY_TYPE']) {
if (!empty($displayProperty['LINK_SECTION_VALUE'])) {
$mxValues = array();
foreach ($displayProperty['LINK_SECTION_VALUE'] as $arTempo) {
$mxValues[] = $arTempo['NAME'] . ' [' . $arTempo['ID'] . ']';
}
}
}
if (empty($mxValues)) {
$mxValues = $displayProperty["DISPLAY_VALUE"];
}
if ($getExt) {
$arSkuProps[$prop["ID"]] = array('ID' => $prop["ID"], 'CODE' => $prop['CODE'], 'NAME' => $prop["NAME"], 'VALUE' => strip_tags(is_array($mxValues) ? implode("/ ", $mxValues) : $mxValues));
} else {
$arSkuProps[$prop["NAME"]] = strip_tags(is_array($mxValues) ? implode("/ ", $mxValues) : $mxValues);
}
}
}
unset($prop);
}
}
}
}
return $arSkuProps;
}
示例2: unset
}
if ($pagerParameters && isset($pagerParameters["BASE_LINK"])) {
$pagerBaseLink = $pagerParameters["BASE_LINK"];
unset($pagerParameters["BASE_LINK"]);
}
$navComponentParameters["BASE_LINK"] = CHTTP::urlAddParams($pagerBaseLink, $pagerParameters, array("encode" => true));
}
$arResult["NAV_STRING"] = $rsElements->GetPageNavStringEx($navComponentObject, $arParams["PAGER_TITLE"], $arParams["PAGER_TEMPLATE"], $arParams["PAGER_SHOW_ALWAYS"], $this, $navComponentParameters);
$arResult["NAV_CACHED_DATA"] = null;
$arResult["NAV_RESULT"] = $rsElements;
if (isset($arItem)) {
unset($arItem);
}
if (!empty($arResult["ELEMENTS"]) && ($bGetProperties || $bCatalog && $boolNeedCatalogCache)) {
$arPropFilter = array('ID' => $arResult["ELEMENTS"], 'IBLOCK_ID' => $arParams['IBLOCK_ID']);
CIBlockElement::GetPropertyValuesArray($arElementLink, $arParams["IBLOCK_ID"], $arPropFilter);
foreach ($arResult["ITEMS"] as &$arItem) {
if ($bCatalog && $boolNeedCatalogCache) {
CCatalogDiscount::SetProductPropertiesCache($arItem['ID'], $arItem["PROPERTIES"]);
}
if ($bGetProperties) {
foreach ($arParams["PROPERTY_CODE"] as $pid) {
if (!isset($arItem["PROPERTIES"][$pid])) {
continue;
}
$prop =& $arItem["PROPERTIES"][$pid];
$boolArr = is_array($prop["VALUE"]);
if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
$arItem["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arItem, $prop, "catalog_out");
}
}
示例3: trim
$arResult["SOUND_CLOUD"] = $url;
}
}
}
}
/*SLIDER*/
$sliderProperty = trim($arParams["SLIDER_PROPERTY"]);
if ($sliderProperty) {
if (is_numeric($sliderProperty)) {
$propertyFilter = array("ID" => $sliderProperty);
} else {
$propertyFilter = array("CODE" => $sliderProperty);
}
$elementIndex = array();
$elementIndex[$arResult["ID"]] = array("PROPERTIES" => array());
CIBlockElement::GetPropertyValuesArray($elementIndex, $arResult["IBLOCK_ID"], array("IBLOCK_ID" => $arResult["IBLOCK_ID"], "ID" => $arResult["ID"]), $propertyFilter);
foreach ($elementIndex as $idx) {
foreach ($idx["PROPERTIES"] as $property) {
$files = array();
if ($property["MULTIPLE"] == "Y" && $property["VALUE"]) {
$files = $property["VALUE"];
}
if ($property["MULTIPLE"] == "N" && $property["VALUE"]) {
$files = array($property["VALUE"]);
}
if ($files) {
$arResult["SLIDER"] = array();
foreach ($files as $fileId) {
$file = CFile::GetFileArray($fileId);
if ($file && $file["WIDTH"] > 0 && $file["HEIGHT"] > 0) {
$arResult["SLIDER"][] = $file;
示例4: trim
$sliderProperty = trim($arParams["SLIDER_PROPERTY"]);
if ($sliderProperty) {
if (is_numeric($sliderProperty)) {
$propertyFilter = array("ID" => $sliderProperty);
} else {
$propertyFilter = array("CODE" => $sliderProperty);
}
$elementIndex = array();
$elementIds = array();
foreach ($arResult["ITEMS"] as $i => $arItem) {
$elementIds[$arItem["IBLOCK_ID"]][] = $arItem["ID"];
$elementIndex[$arItem["ID"]] = array("index" => $i, "PROPERTIES" => array());
}
if ($elementIds) {
foreach ($elementIds as $iblockId => $ids) {
CIBlockElement::GetPropertyValuesArray($elementIndex, $iblockId, array("IBLOCK_ID" => $iblockId, "ID" => $ids), $propertyFilter);
}
foreach ($elementIndex as $idx) {
foreach ($idx["PROPERTIES"] as $property) {
$files = array();
if ($property["MULTIPLE"] == "Y" && $property["VALUE"]) {
$files = $property["VALUE"];
}
if ($property["MULTIPLE"] == "N" && $property["VALUE"]) {
$files = array($property["VALUE"]);
}
if ($files) {
$arResult["ITEMS"][$idx["index"]]["SLIDER"] = array();
foreach ($files as $fileId) {
$file = CFile::GetFileArray($fileId);
if ($file && $file["WIDTH"] > 0 && $file["HEIGHT"] > 0) {
示例5: GetOffersArray
//.........这里部分代码省略.........
$arOfferIDs[] = $arOffer['ID'];
$arResult[$intKey] = $arOffer;
$arOffersLink[$arOffer['ID']] = &$arResult[$intKey];
$intKey++;
}
}
if (!empty($arOfferIDs))
{
$rsRatios = CCatalogMeasureRatio::getList(
array(),
array('PRODUCT_ID' => $arOfferIDs),
false,
false,
array('PRODUCT_ID', 'RATIO')
);
while ($arRatio = $rsRatios->Fetch())
{
$arRatio['PRODUCT_ID'] = intval($arRatio['PRODUCT_ID']);
if (isset($arOffersLink[$arRatio['PRODUCT_ID']]))
{
$intRatio = intval($arRatio['RATIO']);
$dblRatio = doubleval($arRatio['RATIO']);
$mxRatio = ($dblRatio > $intRatio ? $dblRatio : $intRatio);
if (CATALOG_VALUE_EPSILON > abs($mxRatio))
$mxRatio = 1;
elseif (0 > $mxRatio)
$mxRatio = 1;
$arOffersLink[$arRatio['PRODUCT_ID']]['CATALOG_MEASURE_RATIO'] = $mxRatio;
}
}
if (!empty($arSelectProperties))
{
CIBlockElement::GetPropertyValuesArray($arOffersLink, $intOfferIBlockID, $arFilter);
foreach ($arResult as &$arOffer)
{
CCatalogDiscount::SetProductPropertiesCache($arOffer['ID'], $arOffer["PROPERTIES"]);
foreach ($arSelectProperties as $pid)
{
if (!isset($arOffer["PROPERTIES"][$pid]))
continue;
$prop = &$arOffer["PROPERTIES"][$pid];
$boolArr = is_array($prop["VALUE"]);
if(
($boolArr && !empty($prop["VALUE"])) ||
(!$boolArr && strlen($prop["VALUE"])>0))
{
$arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
}
}
if (isset($arOffer))
unset($arOffer);
}
}
CCatalogDiscount::SetProductSectionsCache($arOfferIDs);
CCatalogDiscount::SetDiscountProductCache($arOfferIDs, array('IBLOCK_ID' => $intOfferIBlockID, 'GET_BY_ID' => 'Y'));
foreach ($arResult as &$arOffer)
{
$arOffer['CATALOG_QUANTITY'] = (
0 < $arOffer['CATALOG_QUANTITY'] && is_float($arOffer['CATALOG_MEASURE_RATIO'])
? floatval($arOffer['CATALOG_QUANTITY'])
: intval($arOffer['CATALOG_QUANTITY'])
);
$arOffer['MIN_PRICE'] = false;
$arOffer["PRICES"] = CIBlockPriceTools::GetItemPrices($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
示例6: SetDiscountProductCache
public static function SetDiscountProductCache($arItem, $arParams = array())
{
if (empty($arItem) || !is_array($arItem)) {
return;
}
if (!empty($arParams) && isset($arParams['GET_BY_ID']) && $arParams['GET_BY_ID'] == 'Y') {
$filter = array('ID' => $arItem);
if (isset($arParams['IBLOCK_ID'])) {
$filter['IBLOCK_ID'] = $arParams['IBLOCK_ID'];
}
$select = array('ID', 'IBLOCK_ID', 'CODE', 'XML_ID', 'NAME', 'ACTIVE', 'DATE_ACTIVE_FROM', 'DATE_ACTIVE_TO', 'SORT', 'PREVIEW_TEXT', 'DETAIL_TEXT', 'DATE_CREATE', 'DATE_CREATE_UNIX', 'CREATED_BY', 'TIMESTAMP_X', 'TIMESTAMP_X_UNIX', 'MODIFIED_BY', 'TAGS', 'CATALOG_QUANTITY');
CTimeZone::Disable();
$rsProducts = CIBlockElement::GetList(array(), $filter, false, false, $select);
CTimeZone::Enable();
while ($arProductFields = $rsProducts->GetNext(false, true)) {
$arProduct = array();
$arProduct['ID'] = (int) $arProductFields['ID'];
$arProduct['IBLOCK_ID'] = (int) $arProductFields['IBLOCK_ID'];
$arProduct['SECTION_ID'] = array();
$arProductSections = self::__GetSectionList($arProduct['IBLOCK_ID'], $arProduct['ID']);
if (false !== $arProductSections) {
$arProduct['SECTION_ID'] = $arProductSections;
}
$arProduct['CODE'] = (string) $arProductFields['~CODE'];
$arProduct['XML_ID'] = (string) $arProductFields['~XML_ID'];
$arProduct['NAME'] = $arProductFields['~NAME'];
$arProduct['ACTIVE'] = $arProductFields['ACTIVE'];
$arProduct['DATE_ACTIVE_FROM'] = (string) $arProductFields['DATE_ACTIVE_FROM'];
if (!empty($arProduct['DATE_ACTIVE_FROM'])) {
$arProduct['DATE_ACTIVE_FROM'] = (int) MakeTimeStamp($arProduct['DATE_ACTIVE_FROM']);
}
$arProduct['DATE_ACTIVE_TO'] = (string) $arProductFields['DATE_ACTIVE_TO'];
if (!empty($arProduct['DATE_ACTIVE_TO'])) {
$arProduct['DATE_ACTIVE_TO'] = (int) MakeTimeStamp($arProduct['DATE_ACTIVE_TO']);
}
$arProduct['SORT'] = (int) $arProductFields['SORT'];
$arProduct['PREVIEW_TEXT'] = (string) $arProductFields['~PREVIEW_TEXT'];
$arProduct['DETAIL_TEXT'] = (string) $arProductFields['~DETAIL_TEXT'];
$arProduct['TAGS'] = (string) $arProductFields['~TAGS'];
if (isset($arProductFields['DATE_CREATE_UNIX'])) {
$arProduct['DATE_CREATE'] = (string) $arProductFields['DATE_CREATE_UNIX'];
if ('' != $arProduct['DATE_CREATE']) {
$arProduct['DATE_CREATE'] = (int) $arProduct['DATE_CREATE'];
}
} else {
$arProduct['DATE_CREATE'] = (string) $arProductFields['DATE_CREATE'];
if ('' != $arProduct['DATE_CREATE']) {
$arProduct['DATE_CREATE'] = (int) MakeTimeStamp($arProduct['DATE_CREATE']);
}
}
if (isset($arProductFields['TIMESTAMP_X_UNIX'])) {
$arProduct['TIMESTAMP_X'] = (string) $arProductFields['TIMESTAMP_X_UNIX'];
if ('' != $arProduct['TIMESTAMP_X']) {
$arProduct['TIMESTAMP_X'] = (int) $arProduct['TIMESTAMP_X'];
}
} else {
$arProduct['TIMESTAMP_X'] = (string) $arProductFields['TIMESTAMP_X'];
if ('' != $arProduct['TIMESTAMP_X']) {
$arProduct['TIMESTAMP_X'] = (int) MakeTimeStamp($arProduct['TIMESTAMP_X']);
}
}
$arProduct['CREATED_BY'] = (int) $arProductFields['CREATED_BY'];
$arProduct['MODIFIED_BY'] = (int) $arProductFields['MODIFIED_BY'];
$arProduct['CATALOG_QUANTITY'] = (string) $arProductFields['CATALOG_QUANTITY'];
if ('' != $arProduct['CATALOG_QUANTITY']) {
$arProduct['CATALOG_QUANTITY'] = doubleval($arProduct['CATALOG_QUANTITY']);
}
$arProduct['CATALOG_WEIGHT'] = (string) $arProductFields['CATALOG_WEIGHT'];
if ('' != $arProduct['CATALOG_WEIGHT']) {
$arProduct['CATALOG_WEIGHT'] = doubleval($arProduct['CATALOG_WEIGHT']);
}
$arProduct['CATALOG_VAT_ID'] = (string) $arProductFields['CATALOG_VAT_ID'];
if ('' != $arProduct['CATALOG_VAT_ID']) {
$arProduct['CATALOG_VAT_ID'] = (int) $arProduct['CATALOG_VAT_ID'];
}
$arProduct['CATALOG_VAT_INCLUDED'] = (string) $arProductFields['CATALOG_VAT_INCLUDED'];
if (!isset(self::$arCacheProductProperties[$arProduct['ID']])) {
$propsList = array($arProduct['ID'] => array());
CIBlockElement::GetPropertyValuesArray($propsList, $arProduct['IBLOCK_ID'], array('ID' => $arProduct['ID'], 'IBLOCK_ID' => $arProduct['IBLOCK_ID']));
self::$arCacheProductProperties[$arProduct['ID']] = $propsList[$arProduct['ID']];
unset($propsList);
}
$arProps = self::$arCacheProductProperties[$arProduct['ID']];
self::__ConvertProperties($arProduct, $arProps, array('TIME_ZONE' => 'N'));
if (isset(self::$arCacheProductProperties[$arProduct['ID']])) {
unset(self::$arCacheProductProperties[$arProduct['ID']]);
}
if (isset(self::$arCacheProductSections[$arProduct['ID']])) {
unset(self::$arCacheProductSections[$arProduct['ID']]);
}
$sku = CCatalogSKU::GetInfoByOfferIBlock($arProduct['IBLOCK_ID']);
if (!empty($sku)) {
if (!self::__GenerateParent($arProduct, $sku)) {
$sku = false;
}
}
self::$arCacheProduct[$arProduct['ID']] = $arProduct;
}
} else {
if (!isset(self::$arCacheProduct[$arItem['ID']])) {
//.........这里部分代码省略.........
示例7: getOffersList
//.........这里部分代码省略.........
$iblock['IBLOCK_ID'] = (int)$iblock['IBLOCK_ID'];
$iblock['PRODUCT_IBLOCK_ID'] = (int)$iblock['PRODUCT_IBLOCK_ID'];
$iblock['SKU_PROPERTY_ID'] = (int)$iblock['SKU_PROPERTY_ID'];
$iblock['VERSION'] = (int)$iblock['VERSION'];
$iblockSku[$iblock['PRODUCT_IBLOCK_ID']] = $iblock;
self::$arProductCache[$iblock['PRODUCT_IBLOCK_ID']] = $iblock;
self::$arOfferCache[$iblock['IBLOCK_ID']] = $iblock;
$offersIblock[] = $iblock['IBLOCK_ID'];
$iblockProduct[$iblockID] = $productID;
}
unset($iblock, $iblockIterator);
}
if (empty($iblockProduct))
return array();
$propertyFilter = array_filter($propertyFilter);
if (isset($propertyFilter['ID']))
{
$propertyFilter['ID'] = array_filter($propertyFilter['ID']);
if (empty($propertyFilter['ID']))
unset($propertyFilter['ID']);
}
if (isset($propertyFilter['CODE']))
{
$propertyFilter['CODE'] = array_filter($propertyFilter['CODE']);
if (empty($propertyFilter['CODE']))
unset($propertyFilter['CODE']);
}
$iblockProperties = array();
if (!empty($propertyFilter['ID']) || !empty($propertyFilter['CODE']))
{
$propertyIblock = array('=IBLOCK_ID' => $offersIblock);
if (!empty($propertyFilter['ID']))
$propertyIblock['=ID'] = $propertyFilter['ID'];
else
$propertyIblock['=CODE'] = $propertyFilter['CODE'];
$propertyIterator = Iblock\PropertyTable::getList(array(
'select' => array('ID', 'IBLOCK_ID'),
'filter' => $propertyIblock
));
while ($property = $propertyIterator->fetch())
{
$property['IBLOCK_ID'] = (int)$property['IBLOCK_ID'];
if (!isset($iblockProperties[$property['IBLOCK_ID']]))
$iblockProperties[$property['IBLOCK_ID']] = array();
$iblockProperties[$property['IBLOCK_ID']][] = (int)$property['ID'];
}
unset($property, $propertyIterator, $propertyIblock);
}
unset($offersIblock);
$result = array_fill_keys($productID, array());
foreach ($iblockProduct as $iblockID => $productList)
{
$skuProperty = 'PROPERTY_'.$iblockSku[$iblockID]['SKU_PROPERTY_ID'];
$iblockFilter = $skuFilter;
$iblockFilter['IBLOCK_ID'] = $iblockSku[$iblockID]['IBLOCK_ID'];
$iblockFilter['='.$skuProperty] = $productList;
$iblockFields = $fields;
$iblockFields[] = $skuProperty;
$skuProperty .= '_VALUE';
$offersLinks = array();
$offersIterator = CIBlockElement::GetList(
array('ID' => 'ASC'),
$iblockFilter,
false,
false,
$iblockFields
);
while ($offer = $offersIterator->Fetch())
{
$offerProduct = (int)$offer[$skuProperty];
unset($offer[$skuProperty]);
if (!isset($result[$offerProduct]))
continue;
$offer['ID'] = (int)$offer['ID'];
$offer['IBLOCK_ID'] = (int)$offer['IBLOCK_ID'];
$offer['PROPERTIES'] = array();
$result[$offerProduct][$offer['ID']] = $offer;
$offersLinks[$offer['ID']] = &$result[$offerProduct][$offer['ID']];
}
unset($offerProduct, $offer, $offersIterator, $skuProperty);
if (!empty($iblockProperties[$iblockSku[$iblockID]['IBLOCK_ID']]))
{
CIBlockElement::GetPropertyValuesArray(
$offersLinks,
$iblockSku[$iblockID]['IBLOCK_ID'],
$iblockFilter,
array('ID' => $iblockProperties[$iblockSku[$iblockID]['IBLOCK_ID']])
);
}
unset($offersLinks);
}
unset($productList, $iblockID, $iblockProduct);
return array_filter($result);
}
示例8: getItems
/**
* Get items for view.
* @return mixed[] array('ID' => array(), 'ID' => array(), ...)
*/
protected function getItems()
{
if (empty($this->productIdsMap) || empty($this->arParams['SHOW_PRODUCTS'])) {
return array();
}
$this->separateItemsByIblock();
$defaultMeasure = $this->data['DEFAULT_MEASURE'];
$items = array();
foreach (array_keys($this->arParams['SHOW_PRODUCTS']) as $iblock) {
$this->linkItems = array();
if (empty($this->iblockItems[$iblock])) {
continue;
}
$filter = $this->filter;
$filter['IBLOCK_ID'] = $iblock;
$filter['ID'] = $this->iblockItems[$iblock];
$elementIterator = CIBlockElement::GetList(array(), $filter, false, false, $this->selectFields);
$elementIterator->SetUrlTemplates($this->arParams['DETAIL_URL']);
while ($element = $elementIterator->GetNext()) {
$element['ID'] = (int) $element['ID'];
$element['ACTIVE_FROM'] = $element['DATE_ACTIVE_FROM'];
$element['ACTIVE_TO'] = $element['DATE_ACTIVE_TO'];
$buttons = CIBlock::GetPanelButtons($element['IBLOCK_ID'], $element['ID'], 0, array("SECTION_BUTTONS" => false, "SESSID" => false, "CATALOG" => true));
$element['EDIT_LINK'] = $buttons['edit']['edit_element']['ACTION_URL'];
$element['DELETE_LINK'] = $buttons['edit']['delete_element']['ACTION_URL'];
$ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($element["IBLOCK_ID"], $element["ID"]);
$element["IPROPERTY_VALUES"] = $ipropValues->getValues();
$element["PREVIEW_PICTURE"] = $element["PREVIEW_PICTURE"] > 0 ? CFile::GetFileArray($element["PREVIEW_PICTURE"]) : false;
if ($element["PREVIEW_PICTURE"]) {
$element["PREVIEW_PICTURE"]["ALT"] = $element["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"];
if ($element["PREVIEW_PICTURE"]["ALT"] == "") {
$element["PREVIEW_PICTURE"]["ALT"] = $element["NAME"];
}
$element["PREVIEW_PICTURE"]["TITLE"] = $element["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"];
if ($element["PREVIEW_PICTURE"]["TITLE"] == "") {
$element["PREVIEW_PICTURE"]["TITLE"] = $element["NAME"];
}
}
$element["DETAIL_PICTURE"] = $element["DETAIL_PICTURE"] > 0 ? CFile::GetFileArray($element["DETAIL_PICTURE"]) : false;
if ($element["DETAIL_PICTURE"]) {
$element["DETAIL_PICTURE"]["ALT"] = $element["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"];
if ($element["DETAIL_PICTURE"]["ALT"] == "") {
$element["DETAIL_PICTURE"]["ALT"] = $element["NAME"];
}
$element["DETAIL_PICTURE"]["TITLE"] = $element["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"];
if ($element["DETAIL_PICTURE"]["TITLE"] == "") {
$element["DETAIL_PICTURE"]["TITLE"] = $element["NAME"];
}
}
$element["PROPERTIES"] = array();
$element["DISPLAY_PROPERTIES"] = array();
$element["PRODUCT_PROPERTIES"] = array();
$element['PRODUCT_PROPERTIES_FILL'] = array();
if (!isset($element["CATALOG_MEASURE_RATIO"])) {
$element["CATALOG_MEASURE_RATIO"] = 1;
}
if (!isset($element['CATALOG_MEASURE'])) {
$element['CATALOG_MEASURE'] = 0;
}
$element['CATALOG_MEASURE'] = (int) $element['CATALOG_MEASURE'];
if ($element['CATALOG_MEASURE'] < 0) {
$element['CATALOG_MEASURE'] = 0;
}
if (!isset($element['CATALOG_MEASURE_NAME'])) {
$element['CATALOG_MEASURE_NAME'] = '';
}
$element['CATALOG_MEASURE_NAME'] = $defaultMeasure['SYMBOL_RUS'];
$element['~CATALOG_MEASURE_NAME'] = $defaultMeasure['~SYMBOL_RUS'];
$items[$element['ID']] = $element;
$this->linkItems[$element['ID']] =& $items[$element['ID']];
}
unset($element, $elementIterator);
$propFilter = array('ID' => $this->iblockItems[$iblock], 'IBLOCK_ID' => $iblock);
CIBlockElement::GetPropertyValuesArray($this->linkItems, $iblock, $propFilter);
unset($propFilter);
foreach ($this->linkItems as &$element) {
CCatalogDiscount::SetProductPropertiesCache($element['ID'], $element['PROPERTIES']);
if (isset($this->arParams['PROPERTY_CODE'][$iblock])) {
$properties = $this->arParams['PROPERTY_CODE'][$iblock];
foreach ($properties as $propertyName) {
if (!isset($element['PROPERTIES'][$propertyName])) {
continue;
}
$prop =& $element['PROPERTIES'][$propertyName];
$boolArr = is_array($prop["VALUE"]);
if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
$element['DISPLAY_PROPERTIES'][$propertyName] = CIBlockFormatProperties::GetDisplayValue($element, $prop, 'catalog_out');
}
unset($prop);
}
}
if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($this->arParams['CART_PROPERTIES'][$iblock])) {
$element["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($element['IBLOCK_ID'], $element["ID"], $this->arParams['CART_PROPERTIES'][$iblock], $element["PROPERTIES"]);
if (!empty($element["PRODUCT_PROPERTIES"])) {
$element['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($element['PRODUCT_PROPERTIES']);
}
//.........这里部分代码省略.........
示例9: GetOffersArray
//.........这里部分代码省略.........
}
$arMeasureMap[$arOffer['CATALOG_MEASURE']][] = $intKey;
}
$arOfferIDs[] = $arOffer['ID'];
$arResult[$intKey] = $arOffer;
if (!isset($arOffersLink[$arOffer['ID']])) {
$arOffersLink[$arOffer['ID']] =& $arResult[$intKey];
} else {
if (!isset($extPrices[$arOffer['ID']])) {
$extPrices[$arOffer['ID']] = array();
}
$extPrices[$arOffer['ID']][] =& $arResult[$intKey];
}
$intKey++;
}
}
if (!empty($arOfferIDs)) {
$rsRatios = CCatalogMeasureRatio::getList(array(), array('@PRODUCT_ID' => $arOfferIDs), false, false, array('PRODUCT_ID', 'RATIO'));
while ($arRatio = $rsRatios->Fetch()) {
$arRatio['PRODUCT_ID'] = (int) $arRatio['PRODUCT_ID'];
if (isset($arOffersLink[$arRatio['PRODUCT_ID']])) {
$intRatio = (int) $arRatio['RATIO'];
$dblRatio = (double) $arRatio['RATIO'];
$mxRatio = $dblRatio > $intRatio ? $dblRatio : $intRatio;
if (CATALOG_VALUE_EPSILON > abs($mxRatio)) {
$mxRatio = 1;
} elseif (0 > $mxRatio) {
$mxRatio = 1;
}
$arOffersLink[$arRatio['PRODUCT_ID']]['CATALOG_MEASURE_RATIO'] = $mxRatio;
}
}
if (!empty($arSelectProperties)) {
CIBlockElement::GetPropertyValuesArray($arOffersLink, $intOfferIBlockID, $arFilter);
foreach ($arResult as &$arOffer) {
if (self::$needDiscountCache) {
CCatalogDiscount::SetProductPropertiesCache($arOffer['ID'], $arOffer["PROPERTIES"]);
}
foreach ($arSelectProperties as $pid) {
if (!isset($arOffer["PROPERTIES"][$pid])) {
continue;
}
$prop =& $arOffer["PROPERTIES"][$pid];
$boolArr = is_array($prop["VALUE"]);
if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
$arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
}
unset($prop);
}
}
unset($arOffer);
}
if (!empty($extPrices)) {
foreach ($extPrices as $origID => $prices) {
foreach ($prices as $oneRow) {
$oneRow['PROPERTIES'] = $arOffersLink[$origID]['PROPERTIES'];
$oneRow['DISPLAY_PROPERTIES'] = $arOffersLink[$origID]['DISPLAY_PROPERTIES'];
$oneRow['CATALOG_MEASURE_RATIO'] = $arOffersLink[$origID]['CATALOG_MEASURE_RATIO'];
}
}
}
if (self::$needDiscountCache) {
CCatalogDiscount::SetProductSectionsCache($arOfferIDs);
CCatalogDiscount::SetDiscountProductCache($arOfferIDs, array('IBLOCK_ID' => $intOfferIBlockID, 'GET_BY_ID' => 'Y'));
}
foreach ($arResult as &$arOffer) {