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


PHP CCatalogProduct::ParseQueryBuildField方法代码示例

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


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

示例1: GetQueryBuildArrays

	public static function GetQueryBuildArrays($arOrder, $arFilter, $arSelect)
	{
		global $DB, $USER;
		global $stackCacheManager;

		$strDefQuantityTrace = COption::GetOptionString('catalog','default_quantity_trace','N');
		if ('Y' != $strDefQuantityTrace)
			$strDefQuantityTrace = 'N';
		$strDefCanBuyZero = COption::GetOptionString('catalog','default_can_buy_zero','N');
		if ('Y' != $strDefCanBuyZero)
			$strDefCanBuyZero = 'N';
		$strDefNegAmount = COption::GetOptionString('catalog','allow_negative_amount','N');
		if ('Y' != $strDefNegAmount)
			$strDefNegAmount = 'N';

		$sResSelect = "";
		$sResFrom = "";
		$sResWhere = "";
		$arResOrder = array();
		$arJoinGroup = array();

		$arSensID = array(
			'PRODUCT_ID' => true,
			'CATALOG_GROUP_ID' => true,
			'CURRENCY' => true,
			'SHOP_QUANTITY' => true,
			'PRICE' => true
		);

		$arOrderTmp = array();
		foreach ($arOrder as $key => $val)
		{
			foreach ($val as $by => $order)
			{
				if ($arField = CCatalogProduct::ParseQueryBuildField($by))
				{
					$inum = $arField["NUM"];
					$by = $arField["FIELD"];
					$res = '';

					if (0 >= $inum && array_key_exists($by, $arSensID))
						continue;

					if ($by == "PRICE")
					{
						$res = " ".CIBlock::_Order("CAT_P".$inum.".PRICE", $order, "asc")." ";
					}
					elseif ($by == "CURRENCY")
					{
						$res = " ".CIBlock::_Order("CAT_P".$inum.".CURRENCY", $order, "asc")." ";
					}
					elseif ($by == "QUANTITY")
					{
						$arResOrder[$key] = " ".CIBlock::_Order("CAT_PR.QUANTITY", $order, "asc", false)." ";
						continue;
					}
					elseif ($by == 'WEIGHT')
					{
						$arResOrder[$key] = " ".CIBlock::_Order("CAT_PR.WEIGHT", $order, "asc", false)." ";
						continue;
					}
					elseif ($by == 'AVAILABLE')
					{
						$arResOrder[$key] = " ".CIBlock::_Order("CATALOG_AVAILABLE", $order, "desc", false)." ";
						continue;
					}
					else
					{
						$res = " ".CIBlock::_Order("CAT_P".$inum.".ID", $order, "asc", false)." ";
					}

					if (!array_key_exists($inum, $arOrderTmp))
						$arOrderTmp[$inum] = array();
					$arOrderTmp[$inum][$key] = $res;
					$arJoinGroup[$inum] = true;
				}
			}
		}

		$arWhereTmp = array();
		$arAddJoinOn = array();

		$filter_keys = (!is_array($arFilter) ? array() : array_keys($arFilter));

		for ($i=0, $cnt = count($filter_keys); $i < $cnt; $i++)
		{
			$key = strtoupper($filter_keys[$i]);
			$val = $arFilter[$filter_keys[$i]];

			$res = CIBlock::MkOperationFilter($key);
			$key = $res["FIELD"];
			$cOperationType = $res["OPERATION"];

			if ($arField = CCatalogProduct::ParseQueryBuildField($key))
			{
				$key = $arField["FIELD"];
				$inum = $arField["NUM"];

				if (0 >= $inum && array_key_exists($key, $arSensID))
					continue;
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:product.php

示例2: GetQueryBuildArrays

 public static function GetQueryBuildArrays($arOrder, $arFilter, $arSelect)
 {
     global $DB, $USER, $stackCacheManager;
     $strDefQuantityTrace = (string) Option::get('catalog', 'default_quantity_trace') == 'Y' ? 'Y' : 'N';
     $strDefCanBuyZero = (string) Option::get('catalog', 'default_can_buy_zero') == 'Y' ? 'Y' : 'N';
     $strDefNegAmount = (string) Option::get('catalog', 'allow_negative_amount') == 'Y' ? 'Y' : 'N';
     $strSubscribe = (string) Option::get('catalog', 'default_subscribe') == 'N' ? 'N' : 'Y';
     $sResSelect = '';
     $sResFrom = '';
     $sResWhere = '';
     $arResOrder = array();
     $arJoinGroup = array();
     $arStoreWhere = array();
     $arStore = array();
     $arStoreOrder = array();
     $arSensID = array('PRODUCT_ID' => true, 'CATALOG_GROUP_ID' => true, 'CURRENCY' => true, 'SHOP_QUANTITY' => true, 'PRICE' => true, 'STORE_AMOUNT' => true);
     $arOrderTmp = array();
     foreach ($arOrder as $key => $val) {
         foreach ($val as $by => $order) {
             if ($arField = CCatalogProduct::ParseQueryBuildField($by)) {
                 $res = '';
                 $join = true;
                 $inum = (int) $arField["NUM"];
                 $by = (string) $arField["FIELD"];
                 if ($by == '' || $inum <= 0 && isset($arSensID[$by])) {
                     continue;
                 }
                 switch ($by) {
                     case 'PRICE':
                         $res = " " . CIBlock::_Order("CAT_P" . $inum . ".PRICE", $order, "asc") . " ";
                         break;
                     case 'CURRENCY':
                         $res = " " . CIBlock::_Order("CAT_P" . $inum . ".CURRENCY", $order, "asc") . " ";
                         break;
                     case 'QUANTITY':
                         $arResOrder[$key] = " " . CIBlock::_Order("CAT_PR.QUANTITY", $order, "asc", false) . " ";
                         $join = false;
                         break;
                     case 'WEIGHT':
                         $arResOrder[$key] = " " . CIBlock::_Order("CAT_PR.WEIGHT", $order, "asc", false) . " ";
                         $join = false;
                         break;
                     case 'AVAILABLE':
                         $arResOrder[$key] = " " . CIBlock::_Order("CATALOG_AVAILABLE", $order, "desc", false) . " ";
                         $join = false;
                         break;
                     case 'TYPE':
                         $arResOrder[$key] = " " . CIBlock::_Order("CAT_PR.TYPE", $order, "asc", false) . " ";
                         $join = false;
                         break;
                     case 'PURCHASING_PRICE':
                         $arResOrder[$key] = " " . CIBlock::_Order("CAT_PR.PURCHASING_PRICE", $order, "asc") . " ";
                         $join = false;
                         break;
                     case 'PURCHASING_CURRENCY':
                         $arResOrder[$key] = " " . CIBlock::_Order("CAT_PR.PURCHASING_CURRENCY", $order, "asc") . " ";
                         $join = false;
                         break;
                     case 'STORE_AMOUNT':
                         $arStore[$inum] = true;
                         if (!isset($arStoreOrder[$inum])) {
                             $arStoreOrder[$inum] = array();
                         }
                         $arStoreOrder[$inum][$key] = " " . CIBlock::_Order("CAT_SP" . $inum . ".AMOUNT", $order, "asc") . " ";
                         $join = false;
                         break;
                     default:
                         $res = " " . CIBlock::_Order("CAT_P" . $inum . ".ID", $order, "asc", false) . " ";
                         break;
                 }
                 if ($join) {
                     if (!isset($arOrderTmp[$inum])) {
                         $arOrderTmp[$inum] = array();
                     }
                     $arOrderTmp[$inum][$key] = $res;
                     $arJoinGroup[$inum] = true;
                 }
             }
         }
     }
     $productWhere = array();
     $arWhereTmp = array();
     $arAddJoinOn = array();
     $filter_keys = !is_array($arFilter) ? array() : array_keys($arFilter);
     for ($i = 0, $cnt = count($filter_keys); $i < $cnt; $i++) {
         $key = strtoupper($filter_keys[$i]);
         $val = $arFilter[$filter_keys[$i]];
         $res = CIBlock::MkOperationFilter($key);
         $key = $res["FIELD"];
         $cOperationType = $res["OPERATION"];
         if ($arField = CCatalogProduct::ParseQueryBuildField($key)) {
             $res = '';
             $join = true;
             $key = (string) $arField["FIELD"];
             $inum = (int) $arField["NUM"];
             if ($key == '' || $inum <= 0 && isset($arSensID[$key])) {
                 continue;
             }
             switch ($key) {
                 case "PRODUCT_ID":
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:product.php


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