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


PHP CCatalogProduct::GetQueryBuildArrays方法代码示例

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


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

示例1: GetList


//.........这里部分代码省略.........
         if ($db_prop["VERSION"] == 2 && $db_prop["MULTIPLE"] == "N") {
             if ($db_prop["bFullJoin"]) {
                 $sFrom .= "\t\t\tINNER JOIN b_iblock_property_enum JFPEN" . $i . " ON JFPEN" . $i . ".PROPERTY_ID = " . $db_prop["ORIG_ID"] . " AND JFPS" . $db_prop["JOIN"] . ".PROPERTY_" . $db_prop["ORIG_ID"] . " = JFPEN" . $i . ".ID\n";
             } else {
                 $sFrom .= "\t\t\tLEFT JOIN b_iblock_property_enum JFPEN" . $i . " ON JFPEN" . $i . ".PROPERTY_ID = " . $db_prop["ORIG_ID"] . " AND JFPS" . $db_prop["JOIN"] . ".PROPERTY_" . $db_prop["ORIG_ID"] . " = JFPEN" . $i . ".ID\n";
             }
         } else {
             if ($db_prop["bFullJoin"]) {
                 $sFrom .= "\t\t\tINNER JOIN b_iblock_property_enum JFPEN" . $i . " ON JFPEN" . $i . ".PROPERTY_ID = JFPV" . $db_prop["JOIN"] . ".IBLOCK_PROPERTY_ID AND JFPV" . $db_prop["JOIN"] . ".VALUE_ENUM = JFPEN" . $i . ".ID\n";
             } else {
                 $sFrom .= "\t\t\tLEFT JOIN b_iblock_property_enum JFPEN" . $i . " ON JFPEN" . $i . ".PROPERTY_ID = JFPV" . $db_prop["JOIN"] . ".IBLOCK_PROPERTY_ID AND JFPV" . $db_prop["JOIN"] . ".VALUE_ENUM = JFPEN" . $i . ".ID\n";
             }
         }
         if ($db_prop["IBLOCK_ID"]) {
             $arFilterIBlocks[$db_prop["IBLOCK_ID"]] = $db_prop["IBLOCK_ID"];
         }
     }
     if (strlen($arJoinProps["BES"])) {
         $sFrom .= "\t\t\t" . $arJoinProps["BES"] . "\n";
     }
     if ($arJoinProps["RV"]) {
         $sFrom .= "\t\t\tLEFT JOIN b_rating_voting RV ON RV.ENTITY_TYPE_ID = 'IBLOCK_ELEMENT' AND RV.ENTITY_ID = BE.ID\n";
     }
     if ($arJoinProps["RVU"]) {
         $sFrom .= "\t\t\tLEFT JOIN b_rating_vote RVU ON RVU.ENTITY_TYPE_ID = 'IBLOCK_ELEMENT' AND RVU.ENTITY_ID = BE.ID AND RVU.USER_ID = " . $uid . "\n";
     }
     if ($arJoinProps["RVV"]) {
         $sFrom .= "\t\t\t" . ($arJoinProps["RVV"]["bFullJoin"] ? "INNER" : "LEFT") . " JOIN b_rating_vote RVV ON RVV.ENTITY_TYPE_ID = 'IBLOCK_ELEMENT' AND RVV.ENTITY_ID = BE.ID\n";
     }
     //******************END OF FROM PART********************************************
     $bCatalogSort = false;
     if (count($arAddSelectFields) > 0 || count($arAddWhereFields) > 0 || count($arAddOrderByFields) > 0) {
         if (CModule::IncludeModule("catalog")) {
             $res_catalog = CCatalogProduct::GetQueryBuildArrays($arAddOrderByFields, $arAddWhereFields, $arAddSelectFields);
             if ($sGroupBy == "" && !$bOnlyCount && !(is_object($this) && isset($this->strField))) {
                 $sSelect .= $res_catalog["SELECT"] . " ";
             }
             $sFrom .= str_replace("LEFT JOIN", "\n\t\t\tLEFT JOIN", $res_catalog["FROM"]) . "\n";
             //$sWhere .= $res_catalog["WHERE"]." "; moved to MkFilter
             if (is_array($res_catalog["ORDER"]) && count($res_catalog["ORDER"])) {
                 $bCatalogSort = true;
                 foreach ($res_catalog["ORDER"] as $i => $val) {
                     $arSqlOrder[$i] = $val;
                 }
             }
         }
     }
     $i = array_search("CREATED_BY_FORMATTED", $arSelectFields);
     if ($i !== false) {
         if ($sSelect && $sGroupBy == "" && !$bOnlyCount && !(is_object($this) && isset($this->strField))) {
             $sSelect .= ",UC.NAME UC_NAME, UC.LAST_NAME UC_LAST_NAME, UC.SECOND_NAME UC_SECOND_NAME, UC.EMAIL UC_EMAIL, UC.ID UC_ID, UC.LOGIN UC_LOGIN";
         } else {
             unset($arSelectFields[$i]);
         }
     }
     $sOrderBy = "";
     foreach ($arSqlOrder as $i => $val) {
         if (strlen($val)) {
             if ($sOrderBy == "") {
                 $sOrderBy = " ORDER BY ";
             } else {
                 $sOrderBy .= ",";
             }
             $sOrderBy .= $val . " ";
         }
     }
开发者ID:spas-viktor,项目名称:books,代码行数:67,代码来源:iblockelement.php

示例2: MkFilter


//.........这里部分代码省略.........
                             $res["FIELD"] = $arMatch;
                             CIBlockElement::MkPropertyFilter($res, $cOperationType, $propVAL, $db_prop, $arJoinProps, $arSqlSearch);
                         }
                     } else {
                         if ($db_prop = CIBlockProperty::GetPropertyArray($res["FIELD"], CIBlock::_MergeIBArrays($arFilter["IBLOCK_ID"], $arFilter["IBLOCK_CODE"], $arFilter["~IBLOCK_ID"], $arFilter["~IBLOCK_CODE"]))) {
                             CIBlockElement::MkPropertyFilter($res, $cOperationType, $propVAL, $db_prop, $arJoinProps, $arSqlSearch);
                         }
                     }
                 }
                 break;
             default:
                 if (is_numeric($orig_key)) {
                     //Here is hint for better property resolution:
                     if (!is_array($val) || !array_key_exists("~IBLOCK_ID", $val)) {
                         if (array_key_exists("IBLOCK_ID", $arFilter)) {
                             $val["~IBLOCK_ID"] = $arFilter["IBLOCK_ID"];
                         } elseif (array_key_exists("~IBLOCK_ID", $arFilter)) {
                             $val["~IBLOCK_ID"] = $arFilter["~IBLOCK_ID"];
                         }
                     }
                     if (!is_array($val) || !array_key_exists("~IBLOCK_CODE", $val)) {
                         if (array_key_exists("IBLOCK_CODE", $arFilter)) {
                             $val["~IBLOCK_CODE"] = $arFilter["IBLOCK_CODE"];
                         } elseif (array_key_exists("~IBLOCK_CODE", $arFilter)) {
                             $val["~IBLOCK_CODE"] = $arFilter["~IBLOCK_CODE"];
                         }
                     }
                     //Subfilter process
                     $arSubSqlSearch = CIBlockElement::MkFilter($val, $arJoinProps, $arAddWhereFields, $level + 1, $bPropertyLeftJoin);
                     if (strlen(trim($arSubSqlSearch[0], "\n\t"))) {
                         $arSqlSearch[] = str_replace("\n\t\t\t", "\n\t\t\t\t", $arSubSqlSearch[0]);
                     }
                 } elseif (strtoupper(substr($key, 0, 8)) == "CATALOG_" && CModule::IncludeModule("catalog")) {
                     $res_catalog = CCatalogProduct::GetQueryBuildArrays(array(), array($orig_key => $val), array());
                     if (strlen($res_catalog["WHERE"])) {
                         $arSqlSearch[] = substr($res_catalog["WHERE"], 5);
                         // " AND ".$res
                         $arAddWhereFields[$orig_key] = $val;
                     }
                 }
                 break;
         }
     }
     //SECTION sub filter
     $sWhere = "";
     foreach ($arSectionFilter["BS"] as $strFilter) {
         if (strlen($strFilter)) {
             if (strlen($sWhere)) {
                 $sWhere .= " " . $Logic . " ";
             }
             $sWhere .= "(" . $strFilter . ")";
         }
     }
     $bINCLUDE_SUBSECTIONS = isset($arFilter["INCLUDE_SUBSECTIONS"]) && $arFilter["INCLUDE_SUBSECTIONS"] === "Y";
     if (strlen($sWhere)) {
         $sectionScope = "";
         if (isset($arFilter["SECTION_SCOPE"])) {
             if ($arFilter["SECTION_SCOPE"] == "IBLOCK") {
                 $sectionScope = "AND BSE.ADDITIONAL_PROPERTY_ID IS NULL";
             } elseif ($arFilter["SECTION_SCOPE"] == "PROPERTY") {
                 $sectionScope = "AND BSE.ADDITIONAL_PROPERTY_ID IS NOT NULL";
             } elseif (preg_match("/^PROPERTY_(\\d+)\$/", $arFilter["SECTION_SCOPE"], $match)) {
                 $sectionScope = "AND BSE.ADDITIONAL_PROPERTY_ID = " . $match[1];
             }
         }
         //Try to convert correlated subquery to join subquery
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:iblockelement.php


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