本文整理汇总了PHP中CIBlockFormatProperties::GetDisplayValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockFormatProperties::GetDisplayValue方法的具体用法?PHP CIBlockFormatProperties::GetDisplayValue怎么用?PHP CIBlockFormatProperties::GetDisplayValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockFormatProperties
的用法示例。
在下文中一共展示了CIBlockFormatProperties::GetDisplayValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: __get
/**
* Геттер
* @param $var
* @return int
*/
public function __get($var)
{
if (strpos($var, 'printable_') === 0) {
$varName = substr($var, strlen('printable_'));
$param = $this->getParam($varName);
if (!is_array($param) || !isset($param['PROPERTY_TYPE'])) {
return $param;
}
switch ($param['PROPERTY_TYPE']) {
case 'G':
$printable = \CIBlockSection::GetList(array(), array('ID' => $param['VALUE']), false, array("NAME"))->GetNext();
return $printable['NAME'];
default:
$printable = \CIBlockFormatProperties::GetDisplayValue(array('NAME' => ''), $param, "");
return $printable['DISPLAY_VALUE'];
}
} else {
switch ($var) {
case 'id':
case 'ID':
return $this->id;
case 'IBLOCK_ID':
case 'iblockId':
return $this->iblockId;
default:
return $this->getParam($var);
}
}
}
示例3: GetOffersArray
//.........这里部分代码省略.........
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);
if (!empty($arOffer["PRICES"]))
{
foreach ($arOffer['PRICES'] as &$arOnePrice)
{
if ('Y' == $arOnePrice['MIN_PRICE'])
{
$arOffer['MIN_PRICE'] = $arOnePrice;
break;
}
}
unset($arOnePrice);
}
$arOffer["CAN_BUY"] = CIBlockPriceTools::CanBuy($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer);
}
if (isset($arOffer))
unset($arOffer);
}
if (!empty($arMeasureMap))
{
$rsMeasures = CCatalogMeasure::getList(
array(),
array('@ID' => array_keys($arMeasureMap)),
false,
false,
array('ID', 'SYMBOL_RUS')
);
while ($arMeasure = $rsMeasures->GetNext())
{
$arMeasure['ID'] = intval($arMeasure['ID']);
if (isset($arMeasureMap[$arMeasure['ID']]) && !empty($arMeasureMap[$arMeasure['ID']]))
{
foreach ($arMeasureMap[$arMeasure['ID']] as &$intOneKey)
{
$arResult[$intOneKey]['CATALOG_MEASURE_NAME'] = $arMeasure['SYMBOL_RUS'];
$arResult[$intOneKey]['~CATALOG_MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
}
unset($intOneKey);
}
}
}
}
return $arResult;
}
示例4: GetOffersArray
public static function GetOffersArray($IBLOCK_ID, $arElementID, $arOrder, $arSelectFields, $arSelectProperties, $limit, $arPrices, $vat_include, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
{
$arResult = array();
$arOffersIBlock = CIBlockPriceTools::GetOffersIBlock($IBLOCK_ID);
if($arOffersIBlock)
{
$limit = intval($limit);
if (0 > $limit)
$limit = 0;
if(!array_key_exists("ID", $arOrder))
$arOrder["ID"] = "DESC";
$arFilter = array(
"IBLOCK_ID" => $arOffersIBlock["OFFERS_IBLOCK_ID"],
"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => $arElementID,
"ACTIVE" => "Y",
"ACTIVE_DATE" => "Y",
);
$arSelect = array(
"ID" => 1,
"IBLOCK_ID" => 1,
"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => 1,
);
//if(!$arParams["USE_PRICE_COUNT"])
{
foreach($arPrices as $value)
{
$arSelect[$value["SELECT"]] = 1;
//$arrFilter["CATALOG_SHOP_QUANTITY_".$value["ID"]] = $arParams["SHOW_PRICE_COUNT"];
}
}
foreach($arSelectFields as $code)
$arSelect[$code] = 1; //mark to select
$arOffersPerElement = array();
$rsOffers = CIBlockElement::GetList($arOrder, $arFilter, false, false, array_keys($arSelect));
while($obOffer = $rsOffers->GetNextElement())
{
$arOffer = $obOffer->GetFields();
$element_id = $arOffer["PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"]."_VALUE"];
//No more than limit offers per element
if($limit > 0)
{
$arOffersPerElement[$element_id]++;
if($arOffersPerElement[$element_id] > $limit)
continue;
}
if($element_id > 0)
{
$arOffer["LINK_ELEMENT_ID"] = $element_id;
$arOffer["DISPLAY_PROPERTIES"] = array();
if(!empty($arSelectProperties))
{
$arOffer["PROPERTIES"] = $obOffer->GetProperties();
foreach($arSelectProperties as $pid)
{
$prop = &$arOffer["PROPERTIES"][$pid];
if((is_array($prop["VALUE"]) && count($prop["VALUE"])>0) ||
(!is_array($prop["VALUE"]) && strlen($prop["VALUE"])>0))
{
$arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
}
}
}
$arOffer["PRICES"] = CIBlockPriceTools::GetItemPrices($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
$arOffer["CAN_BUY"] = CIBlockPriceTools::CanBuy($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer);
}
$arResult[] = $arOffer;
}
}
return $arResult;
}
示例5: 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();
}
$elementIterator = CIBlockElement::GetList(array(), $this->filter, false, false, $this->selectFields);
$elementIterator->SetUrlTemplates($this->arParams["DETAIL_URL"]);
$defaultMeasure = $this->data['DEFAULT_MEASURE'];
$items = array();
while ($elementObj = $elementIterator->GetNextElement()) {
$item = $elementObj->GetFields();
$item['ID'] = intval($item['ID']);
$item['ACTIVE_FROM'] = $item['DATE_ACTIVE_FROM'];
$item['ACTIVE_TO'] = $item['DATE_ACTIVE_TO'];
// Inherited Properties
$ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($item["IBLOCK_ID"], $item["ID"]);
$item["IPROPERTY_VALUES"] = $ipropValues->getValues();
$item["PREVIEW_PICTURE"] = 0 < $item["PREVIEW_PICTURE"] ? CFile::GetFileArray($item["PREVIEW_PICTURE"]) : false;
if ($item["PREVIEW_PICTURE"]) {
$item["PREVIEW_PICTURE"]["ALT"] = $item["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"];
if ($item["PREVIEW_PICTURE"]["ALT"] == "") {
$item["PREVIEW_PICTURE"]["ALT"] = $item["NAME"];
}
$item["PREVIEW_PICTURE"]["TITLE"] = $item["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"];
if ($item["PREVIEW_PICTURE"]["TITLE"] == "") {
$item["PREVIEW_PICTURE"]["TITLE"] = $item["NAME"];
}
}
$item["DETAIL_PICTURE"] = 0 < $item["DETAIL_PICTURE"] ? CFile::GetFileArray($item["DETAIL_PICTURE"]) : false;
if ($item["DETAIL_PICTURE"]) {
$item["DETAIL_PICTURE"]["ALT"] = $item["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"];
if ($item["DETAIL_PICTURE"]["ALT"] == "") {
$item["DETAIL_PICTURE"]["ALT"] = $item["NAME"];
}
$item["DETAIL_PICTURE"]["TITLE"] = $item["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"];
if ($item["DETAIL_PICTURE"]["TITLE"] == "") {
$item["DETAIL_PICTURE"]["TITLE"] = $item["NAME"];
}
}
$itemIblockId = (int) $item['IBLOCK_ID'];
$needItemProperties = isset($this->arParams['PROPERTY_CODE'][$itemIblockId]) && !empty($this->arParams['PROPERTY_CODE'][$itemIblockId]) || isset($this->arParams['ADDITIONAL_PICT_PROP'][$itemIblockId]) || isset($this->arParams['LABEL_PROP'][$itemIblockId]);
$item["PROPERTIES"] = array();
$item["DISPLAY_PROPERTIES"] = array();
if ($needItemProperties) {
$item["PROPERTIES"] = $elementObj->getProperties();
CCatalogDiscount::SetProductPropertiesCache($item['ID'], $item["PROPERTIES"]);
}
if (isset($this->arParams['PROPERTY_CODE'][$item['IBLOCK_ID']])) {
$properties = $this->arParams['PROPERTY_CODE'][$item['IBLOCK_ID']];
foreach ($properties as $propertyName) {
if (!isset($item["PROPERTIES"][$propertyName])) {
continue;
}
$prop =& $item["PROPERTIES"][$propertyName];
$boolArr = is_array($prop["VALUE"]);
if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
$item["DISPLAY_PROPERTIES"][$propertyName] = CIBlockFormatProperties::GetDisplayValue($item, $prop, "catalog_out");
}
}
}
$item["PRODUCT_PROPERTIES"] = array();
$item['PRODUCT_PROPERTIES_FILL'] = array();
if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($this->arParams['CART_PROPERTIES'][$item['IBLOCK_ID']])) {
$item["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($item['IBLOCK_ID'], $item["ID"], $this->arParams['CART_PROPERTIES'][$item['IBLOCK_ID']], $item["PROPERTIES"]);
if (!empty($item["PRODUCT_PROPERTIES"])) {
$item['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($item['PRODUCT_PROPERTIES']);
}
}
if (!isset($item["CATALOG_MEASURE_RATIO"])) {
$item["CATALOG_MEASURE_RATIO"] = 1;
}
if (!isset($item['CATALOG_MEASURE'])) {
$item['CATALOG_MEASURE'] = 0;
}
$item['CATALOG_MEASURE'] = intval($item['CATALOG_MEASURE']);
if (0 > $item['CATALOG_MEASURE']) {
$item['CATALOG_MEASURE'] = 0;
}
if (!isset($item['CATALOG_MEASURE_NAME'])) {
$item['CATALOG_MEASURE_NAME'] = '';
}
$item['CATALOG_MEASURE_NAME'] = $defaultMeasure['SYMBOL_RUS'];
$item['~CATALOG_MEASURE_NAME'] = $defaultMeasure['~SYMBOL_RUS'];
$items[$item['ID']] = $item;
}
return $items;
}
示例6: foreach
}
$ID = $arElement["ID"];
$arItem =& $arResult["LINKED_ELEMENTS"][$arMap[$ID]];
if (is_array($arParams["OFFERS_FIELDS"])) {
foreach ($arParams["OFFERS_FIELDS"] as $FIELD_CODE) {
if ($FIELD_CODE) {
$arItem[$FIELD_CODE] = $arElement[$FIELD_CODE];
$arItem["~" . $FIELD_CODE] = $arElement["~" . $FIELD_CODE];
}
}
}
$arItem["DISPLAY_PROPERTIES"] = array();
if (is_array($arParams["OFFERS_PROPERTIES"])) {
foreach ($arParams["OFFERS_PROPERTIES"] as $PROPERTY_CODE) {
if ($PROPERTY_CODE) {
$arItem["DISPLAY_PROPERTIES"][$PROPERTY_CODE] = CIBlockFormatProperties::GetDisplayValue($arElement, $arProperties[$PROPERTY_CODE], "catalog_out");
}
}
}
if ($arParams["USE_PRICE_COUNT"]) {
if (CModule::IncludeModule("catalog")) {
$arItem["PRICE_MATRIX"] = CatalogGetPriceTableEx($arElement["ID"], 0, $arPriceTypeID, 'Y', $arResult['CONVERT_CURRENCY']);
foreach ($arItem["PRICE_MATRIX"]["COLS"] as $keyColumn => $arColumn) {
$arItem["PRICE_MATRIX"]["COLS"][$keyColumn]["NAME_LANG"] = htmlspecialcharsbx($arColumn["NAME_LANG"]);
}
} else {
$arItem["PRICE_MATRIX"] = false;
}
$arItem["PRICES"] = array();
} else {
$arItem["PRICE_MATRIX"] = false;
示例7: 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']);
}
//.........这里部分代码省略.........
示例8: array
$arResult["DELETED_OFFER_PROPERTIES"][$pid] = $arOffer["PROPERTIES"][$pid];
}
} else {
if (!array_key_exists($pid, $arResult["SHOW_OFFER_PROPERTIES"])) {
$arResult["SHOW_OFFER_PROPERTIES"][$pid] = $arOffer["PROPERTIES"][$pid];
}
}
}
}
if (count($arParams["PROPERTY_CODE"]) > 0) {
$arItem["PROPERTIES"] = $obElement->GetProperties();
}
$arItem["DISPLAY_PROPERTIES"] = array();
foreach ($arParams["PROPERTY_CODE"] as $pid) {
if (!array_key_exists($pid, $_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["DELETE_PROP"])) {
$arItem["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arItem, $arItem["PROPERTIES"][$pid], "catalog_out");
}
if (array_key_exists($pid, $_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["DELETE_PROP"])) {
if (!array_key_exists($pid, $arResult["DELETED_PROPERTIES"])) {
$arResult["DELETED_PROPERTIES"][$pid] = $arItem["PROPERTIES"][$pid];
}
} else {
if (!array_key_exists($pid, $arResult["SHOW_PROPERTIES"])) {
$arResult["SHOW_PROPERTIES"][$pid] = $arItem["DISPLAY_PROPERTIES"][$pid];
}
}
}
if ($arOffer) {
if ($arParams["USE_PRICE_COUNT"]) {
if (CModule::IncludeModule("catalog")) {
$arItem["PRICE_MATRIX"] = CatalogGetPriceTableEx($arOffer["ID"], 0, $arPriceTypeID, 'Y', $arConvertParams);
示例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) {
$arOffer['CATALOG_QUANTITY'] = 0 < $arOffer['CATALOG_QUANTITY'] && is_float($arOffer['CATALOG_MEASURE_RATIO']) ? (double) $arOffer['CATALOG_QUANTITY'] : (int) $arOffer['CATALOG_QUANTITY'];
$arOffer['MIN_PRICE'] = false;
$arOffer["PRICES"] = CIBlockPriceTools::GetItemPrices($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
if (!empty($arOffer["PRICES"])) {
foreach ($arOffer['PRICES'] as &$arOnePrice) {
if ($arOnePrice['MIN_PRICE'] == 'Y') {
$arOffer['MIN_PRICE'] = $arOnePrice;
break;
}
}
unset($arOnePrice);
}
$arOffer["CAN_BUY"] = CIBlockPriceTools::CanBuy($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer);
}
if (isset($arOffer)) {
unset($arOffer);
}
}
if (!empty($arMeasureMap)) {
$rsMeasures = CCatalogMeasure::getList(array(), array('@ID' => array_keys($arMeasureMap)), false, false, array('ID', 'SYMBOL_RUS'));
while ($arMeasure = $rsMeasures->GetNext()) {
$arMeasure['ID'] = (int) $arMeasure['ID'];
if (isset($arMeasureMap[$arMeasure['ID']]) && !empty($arMeasureMap[$arMeasure['ID']])) {
foreach ($arMeasureMap[$arMeasure['ID']] as &$intOneKey) {
$arResult[$intOneKey]['CATALOG_MEASURE_NAME'] = $arMeasure['SYMBOL_RUS'];
$arResult[$intOneKey]['~CATALOG_MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
}
unset($intOneKey);
}
}
}
}
return $arResult;
}
示例10: foreach
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
// если отображается свойство USERS_LIKED
if (in_array("USERS_LIKED", $arParams["PROPERTY_CODE"])) {
// запомним интересующие поля текущего пользователя
global $USER;
$id = $USER->GetID();
$isAuth = $USER->IsAuthorized();
// подправим всем элементам отображение свойства
foreach ($arResult["ITEMS"] as $key => $arItem) {
// пусть свойство всегда будет отображаться
if (!array_key_exists("USERS_LIKED", $arItem["DISPLAY_PROPERTIES"])) {
$arResult["ITEMS"][$key]["DISPLAY_PROPERTIES"]["USERS_LIKED"] = CIBlockFormatProperties::GetDisplayValue($arItem, $arItem["PROPERTIES"]["USERS_LIKED"]);
}
$value = "<span class=\"users_liked_block\">";
$usersLiked = $arItem["DISPLAY_PROPERTIES"]["USERS_LIKED"]["VALUE"];
// если есть, то для всех пользователей выводим список тех, кому понравилось
if (count($usersLiked) > 0) {
$rsUser = CUser::GetList($by = "LOGIN", $order = "asc", array("ID" => implode("|", $usersLiked)), array("ID", "LOGIN"));
while ($arUser = $rsUser->Fetch()) {
$value .= "{$arUser["LOGIN"]} ";
}
} else {
$value .= "Нет ";
}
// для авторизованных выводить кнопки нравится / уже не нравится
if ($isAuth) {
if (in_array($id, $usersLiked)) {
示例11: foreach
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
//Make all properties present in order
//to prevent html table corruption
foreach ($arResult["ITEMS"] as $key => $arElement) {
$arRes = array();
foreach ($arParams["PROPERTY_CODE"] as $pid) {
$arRes[$pid] = CIBlockFormatProperties::GetDisplayValue($arElement, $arElement["PROPERTIES"][$pid], "catalog_out");
}
$arResult["ITEMS"][$key]["DISPLAY_PROPERTIES"] = $arRes;
}
示例12: array
$arIBlockPropertiesDateTime = array();
$dbIBlockProperties = CIBlockProperty::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => $arGadgetParams["IBLOCK_ID"], "ACTIVE" => "Y"));
while ($arIBlockProperty = $dbIBlockProperties->Fetch()) {
$arIBlockProperties[] = $arIBlockProperty["CODE"];
if ($arIBlockProperty["USER_TYPE"] == "DateTime") {
$arIBlockPropertiesDateTime[] = $arIBlockProperty["CODE"];
}
}
$dbIBlockElement = CIBlockElement::GetList($arSort, $arFilter, false, array("nTopCount" => $arGadgetParams["ITEMS_COUNT"]));
while ($obElement = $dbIBlockElement->GetNextElement()) {
$arIBlockElement = $obElement->GetFields();
$arIBlockElement["PROPERTIES"] = $obElement->GetProperties();
foreach ($arIBlockProperties as $pid) {
$prop = $arIBlockElement["PROPERTIES"][$pid];
if (is_array($prop["VALUE"]) && count($prop["VALUE"]) > 0 || !is_array($prop["VALUE"]) && strlen($prop["VALUE"]) > 0) {
$arIBlockElement["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arIBlockElement, $prop, "catalog_out");
}
}
?>
<div class="bx-gadgets-text" style="clear: both; padding: 0 0 10px 0;"><?php
if (strlen($arGadgetParams["DATE_FIELD"]) > 0) {
$strDate = "";
if (array_key_exists($arGadgetParams["DATE_FIELD"], $arIBlockElement) && strlen($arIBlockElement[$arGadgetParams["DATE_FIELD"]]) > 0) {
if (in_array($arGadgetParams["DATE_FIELD"], array("DATE_CREATE", "TIMESTAMP_X", "DATE_ACTIVE_FROM", "DATE_ACTIVE_TO"))) {
$strDate = ToLower(FormatDate("j F Y", MakeTimeStamp($arIBlockElement[$arGadgetParams["DATE_FIELD"]])));
} else {
$strDate = $arIBlockElement[$arGadgetParams["DATE_FIELD"]];
}
} elseif (strpos($arGadgetParams["DATE_FIELD"], "PROPERTY_") === 0 && array_key_exists(substr($arGadgetParams["DATE_FIELD"], 9), $arIBlockElement["DISPLAY_PROPERTIES"]) && strlen($arIBlockElement["DISPLAY_PROPERTIES"][substr($arGadgetParams["DATE_FIELD"], 9)]["DISPLAY_VALUE"]) > 0) {
$val = $arIBlockElement["DISPLAY_PROPERTIES"][substr($arGadgetParams["DATE_FIELD"], 9)]["DISPLAY_VALUE"];
if (is_array($val)) {
示例13: array
$prop = null;
$dbProps = CIBlockElement::GetProperty($arParams["IBLOCK_ID"], $res['ID'], array("sort" => "asc"), array('code' => $propName));
if ($dbProps) {
while ($arProps = $dbProps->Fetch()) {
if (!$prop) {
$prop = $arProps;
} else {
if (!is_array($prop)) {
$prop = array($prop);
}
$prop[] = $arProps;
}
}
}
if (is_array($prop["VALUE"]) && count($prop["VALUE"]) > 0 || !is_array($prop["VALUE"]) && strlen($prop["VALUE"]) > 0) {
$prop = CIBlockFormatProperties::GetDisplayValue($res, $prop, 'webdav_link');
if (is_array($prop['DISPLAY_VALUE'])) {
$res[$propSelectName] = array_pop($prop['DISPLAY_VALUE']);
} else {
$res[$propSelectName] = $prop['DISPLAY_VALUE'];
}
}
}
}
}
$arResult["DATA"][$res["ID"]] = $res;
/************** Grid Data ******************************************/
$arParams["RATING_TAG"] = 'N';
if ($arParams["SHOW_RATING"] == 'Y') {
$arParams["RATING_TAG"] = 'Y';
}
示例14: array
)
{
$arResult["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arResult, $prop, "catalog_out");
}
}
$arResult["DISPLAY_PROPERTIES_ZAKREPI"] = array();
foreach($arResult["PROPERTIES"] as $pid)
{
if(!in_array($pid['CODE'],$arParams["NOT_PROPERTY_CODE"])) {
$prop = &$pid;
$boolArr = is_array($prop["VALUE"]);
if (
($boolArr && !empty($prop["VALUE"]))
|| (!$boolArr && strlen($prop["VALUE"]) > 0)
) {
$arResult["DISPLAY_PROPERTIES_ZAKREPI"][$pid['CODE']] = CIBlockFormatProperties::GetDisplayValue($arResult, $prop, "catalog_out");
}
}
}
$arResult["PRODUCT_PROPERTIES"] = array();
$arResult['PRODUCT_PROPERTIES_FILL'] = array();
if ($arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($arParams["PRODUCT_PROPERTIES"]))
{
$arResult["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties(
$arParams["IBLOCK_ID"],
$arResult["ID"],
$arParams["PRODUCT_PROPERTIES"],
$arResult["PROPERTIES"]
);
示例15: array
$arItem["PROPERTIES"] = array();
$arItem["DISPLAY_PROPERTIES"] = array();
if (!empty($arParams["PROPERTY_CODE"])) {
$arItem["PROPERTIES"] = $obElement->GetProperties();
foreach ($arParams["PROPERTY_CODE"] as &$pid) {
if (!isset($arItem['PROPERTIES'][$pid])) {
continue;
}
if (!isset($arResult['EMPTY_PROPERTIES'][$pid])) {
$arResult['EMPTY_PROPERTIES'][$pid] = true;
}
if (!isset($_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["DELETE_PROP"][$pid])) {
$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');
if ($arItem['DISPLAY_PROPERTIES'][$pid]['DISPLAY_VALUE'] !== false) {
$arResult['EMPTY_PROPERTIES'][$pid] = false;
}
}
}
if (isset($_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["DELETE_PROP"][$pid])) {
$arResult["DELETED_PROPERTIES"][$pid] = $arItem["PROPERTIES"][$pid];
$arResult['EMPTY_PROPERTIES'][$pid] = false;
} else {
$arResult["SHOW_PROPERTIES"][$pid] = $arItem["PROPERTIES"][$pid];
}
}
unset($pid);
}
$arItem['PARENT_ID'] = $arItem['ID'];