本文整理汇总了PHP中CIBlockElement::MkPropertyGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::MkPropertyGroup方法的具体用法?PHP CIBlockElement::MkPropertyGroup怎么用?PHP CIBlockElement::MkPropertyGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::MkPropertyGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PrepareGetList
//.........这里部分代码省略.........
}
//Add order by fields to the select list
//in order to avoid sql errors
if (is_array($arGroupBy) && count($arGroupBy) > 0) {
if ($by == "STATUS") {
$arGroupBy[] = "WF_STATUS_ID";
} elseif ($by == "CREATED") {
$arGroupBy[] = "DATE_CREATE";
} else {
$arGroupBy[] = $by;
}
} else {
if ($by == "STATUS") {
$arSelectFields[] = "WF_STATUS_ID";
} elseif ($by == "CREATED") {
$arSelectFields[] = "DATE_CREATE";
} else {
$arSelectFields[] = $by;
}
}
}
//*************************GROUP BY PART****************************
$sGroupBy = "";
if (is_array($arGroupBy) && count($arGroupBy) > 0) {
$arSelectFields = $arGroupBy;
$bWasGroup = true;
foreach ($arSelectFields as $key => $val) {
$val = strtoupper($val);
if (array_key_exists($val, $arIblockElementFields)) {
$sGroupBy .= "," . preg_replace("/(\\s+AS\\s+[A-Z_]+)/i", "", $arIblockElementFields[$val]);
} elseif (substr($val, 0, 9) == "PROPERTY_") {
$PR_ID = strtoupper(substr($val, 9));
if ($db_prop = CIBlockProperty::GetPropertyArray($PR_ID, CIBlock::_MergeIBArrays($arFilter["IBLOCK_ID"], $arFilter["IBLOCK_CODE"]))) {
$sGroupBy .= CIBlockElement::MkPropertyGroup($db_prop, $arJoinProps);
}
} elseif (substr($val, 0, 13) == "PROPERTYSORT_") {
$PR_ID = strtoupper(substr($val, 13));
if ($db_prop = CIBlockProperty::GetPropertyArray($PR_ID, CIBlock::_MergeIBArrays($arFilter["IBLOCK_ID"], $arFilter["IBLOCK_CODE"]))) {
$sGroupBy .= CIBlockElement::MkPropertyGroup($db_prop, $arJoinProps, true);
}
}
}
if ($sGroupBy != "") {
$sGroupBy = " GROUP BY " . substr($sGroupBy, 1) . " ";
}
}
//*************************SELECT PART****************************
$arAddSelectFields = array();
if ($bOnlyCount) {
$sSelect = "COUNT(%%_DISTINCT_%% BE.ID) as CNT ";
} else {
$sSelect = "";
$arDisplayedColumns = array();
$arProductFields = array("CATALOG_PURCHASING_PRICE" => true, "CATALOG_PURCHASING_CURRENCY" => true, "CATALOG_WEIGHT" => true, "CATALOG_QUANTITY" => true, "CATALOG_QUANTITY_RESERVED" => true, "CATALOG_VAT_INCLUDED" => true, "CATALOG_TYPE" => true, "CATALOG_MEASURE" => true, "CATALOG_AVAILABLE" => true);
$bStar = false;
foreach ($arSelectFields as $key => $val) {
$val = strtoupper($val);
if (array_key_exists($val, $arIblockElementFields)) {
if (array_key_exists($val, $arDisplayedColumns)) {
continue;
}
$arDisplayedColumns[$val] = true;
$arSelectFields[$key] = $val;
$sSelect .= "," . $arIblockElementFields[$val] . " as " . $val;
} elseif ($val == "PROPERTY_*" && !$bWasGroup) {
//We have to analyze arFilter IBLOCK_ID and IBLOCK_CODE