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


PHP CCatalogGroup::GetGroupsPerms方法代码示例

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


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

示例1: GetCatalogPrices

 public static function GetCatalogPrices($IBLOCK_ID, $arPriceCode)
 {
     global $USER;
     $arCatalogPrices = array();
     if (self::$catalogIncluded === null) {
         self::$catalogIncluded = Loader::includeModule('catalog');
     }
     if (self::$catalogIncluded) {
         $arCatalogGroupCodesFilter = array();
         foreach ($arPriceCode as $value) {
             $t_value = trim($value);
             if ('' != $t_value) {
                 $arCatalogGroupCodesFilter[$value] = true;
             }
         }
         $arCatalogGroupsFilter = array();
         $arCatalogGroups = CCatalogGroup::GetListArray();
         foreach ($arCatalogGroups as $key => $value) {
             if (isset($arCatalogGroupCodesFilter[$value['NAME']])) {
                 $arCatalogGroupsFilter[] = $key;
                 $arCatalogPrices[$value["NAME"]] = array("ID" => (int) $value["ID"], "TITLE" => htmlspecialcharsbx($value["NAME_LANG"]), "SELECT" => "CATALOG_GROUP_" . $value["ID"]);
             }
         }
         $arPriceGroups = CCatalogGroup::GetGroupsPerms($USER->GetUserGroupArray(), $arCatalogGroupsFilter);
         foreach ($arCatalogPrices as $name => $value) {
             $arCatalogPrices[$name]["CAN_VIEW"] = in_array($value["ID"], $arPriceGroups["view"]);
             $arCatalogPrices[$name]["CAN_BUY"] = in_array($value["ID"], $arPriceGroups["buy"]);
         }
     } else {
         $arPriceGroups = array("view" => array());
         $rsProperties = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_ID, "CHECK_PERMISSIONS" => "N", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N"));
         while ($arProperty = $rsProperties->Fetch()) {
             if (in_array($arProperty["CODE"], $arPriceCode)) {
                 $arPriceGroups["view"][] = htmlspecialcharsbx("PROPERTY_" . $arProperty["CODE"]);
                 $arCatalogPrices[$arProperty["CODE"]] = array("ID" => (int) $arProperty["ID"], "TITLE" => htmlspecialcharsbx($arProperty["NAME"]), "SELECT" => "PROPERTY_" . $arProperty["ID"], "CAN_VIEW" => true, "CAN_BUY" => false);
             }
         }
     }
     return $arCatalogPrices;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:40,代码来源:comp_pricetools.php

示例2: GetCatalogPrices

 function GetCatalogPrices($IBLOCK_ID, $arPriceCode)
 {
     global $USER;
     $arCatalogPrices = array();
     if (CModule::IncludeModule("catalog")) {
         $bFromCatalog = true;
         $arCatalogGroupCodesFilter = array();
         foreach ($arPriceCode as $key => $value) {
             $t_value = trim($value);
             if (strlen($t_value) > 0) {
                 $arCatalogGroupCodesFilter[$value] = true;
             }
         }
         $arCatalogGroupsFilter = array();
         $arCatalogGroups = CCatalogGroup::GetListArray();
         foreach ($arCatalogGroups as $key => $value) {
             if (array_key_exists($value["NAME"], $arCatalogGroupCodesFilter)) {
                 $arCatalogGroupsFilter[] = $key;
                 $arCatalogPrices[$value["NAME"]] = array("ID" => htmlspecialcharsbx($value["ID"]), "TITLE" => htmlspecialcharsbx($value["NAME_LANG"]), "SELECT" => "CATALOG_GROUP_" . $value["ID"]);
             }
         }
         $arPriceGroups = CCatalogGroup::GetGroupsPerms($USER->GetUserGroupArray(), $arCatalogGroupsFilter);
         foreach ($arCatalogPrices as $name => $value) {
             $arCatalogPrices[$name]["CAN_VIEW"] = in_array($value["ID"], $arPriceGroups["view"]);
             $arCatalogPrices[$name]["CAN_BUY"] = in_array($value["ID"], $arPriceGroups["buy"]);
         }
     } else {
         $bFromCatalog = false;
         $arPriceGroups = array("view" => array());
         $rsProperties = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_ID, "CHECK_PERMISSIONS" => "N", "PROPERTY_TYPE" => "N"));
         while ($arProperty = $rsProperties->Fetch()) {
             if ($arProperty["MULTIPLE"] == "N" && in_array($arProperty["CODE"], $arPriceCode)) {
                 $arPriceGroups["view"][] = htmlspecialcharsbx("PROPERTY_" . $arProperty["CODE"]);
                 $arCatalogPrices[$arProperty["CODE"]] = array("ID" => htmlspecialcharsbx($arProperty["ID"]), "TITLE" => htmlspecialcharsbx($arProperty["NAME"]), "SELECT" => "PROPERTY_" . $arProperty["ID"], "CAN_VIEW" => true, "CAN_BUY" => false);
             }
         }
     }
     return $arCatalogPrices;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:39,代码来源:comp_pricetools.php

示例3: CatalogGetPriceTableEx

function CatalogGetPriceTableEx($ID, $filterQauntity = 0, $arFilterType = array(), $VAT_INCLUDE = 'Y', $arCurrencyParams = array())
{
    global $USER;
    static $arPriceTypes = array();
    $ID = (int) $ID;
    if ($ID <= 0) {
        return false;
    }
    $filterQauntity = (int) $filterQauntity;
    if (!is_array($arFilterType)) {
        $arFilterType = array($arFilterType);
    }
    $boolConvert = false;
    $strCurrencyID = '';
    $arCurrencyList = array();
    if (!empty($arCurrencyParams) && is_array($arCurrencyParams) && !empty($arCurrencyParams['CURRENCY_ID'])) {
        $boolConvert = true;
        $strCurrencyID = $arCurrencyParams['CURRENCY_ID'];
    }
    $arResult = array();
    $arResult["ROWS"] = array();
    $arResult["COLS"] = array();
    $arResult["MATRIX"] = array();
    $arResult["CAN_BUY"] = array();
    $arResult["AVAILABLE"] = "N";
    $cacheTime = CATALOG_CACHE_DEFAULT_TIME;
    if (defined("CATALOG_CACHE_TIME")) {
        $cacheTime = intval(CATALOG_CACHE_TIME);
    }
    $arUserGroups = $USER->GetUserGroupArray();
    CatalogClearArray($arUserGroups, true);
    $strCacheID = 'UG_' . implode('_', $arUserGroups);
    if (isset($arPriceTypes[$strCacheID])) {
        $arPriceGroups = $arPriceTypes[$strCacheID];
    } else {
        $arPriceGroups = CCatalogGroup::GetGroupsPerms($arUserGroups, array());
        $arPriceTypes[$strCacheID] = $arPriceGroups;
    }
    if (empty($arPriceGroups["view"])) {
        return $arResult;
    }
    $currentQuantity = -1;
    $rowsCnt = -1;
    $arFilter = array("PRODUCT_ID" => $ID);
    if ($filterQauntity > 0) {
        $arFilter["+<=QUANTITY_FROM"] = $filterQauntity;
        $arFilter["+>=QUANTITY_TO"] = $filterQauntity;
    }
    if (!empty($arFilterType)) {
        $arTmp = array();
        foreach ($arPriceGroups["view"] as &$intOneGroup) {
            if (in_array($intOneGroup, $arFilterType)) {
                $arTmp[] = $intOneGroup;
            }
        }
        if (isset($intOneGroup)) {
            unset($intOneGroup);
        }
        if (empty($arTmp)) {
            return $arResult;
        }
        $arFilter["CATALOG_GROUP_ID"] = $arTmp;
    } else {
        $arFilter["CATALOG_GROUP_ID"] = $arPriceGroups["view"];
    }
    $productQuantity = 0;
    $productQuantityTrace = "N";
    $dbRes = CCatalogProduct::GetVATInfo($ID);
    if ($arVatInfo = $dbRes->Fetch()) {
        $fVatRate = floatval($arVatInfo['RATE'] * 0.01);
        $bVatIncluded = $arVatInfo['VAT_INCLUDED'] == 'Y';
    } else {
        $fVatRate = 0.0;
        $bVatIncluded = false;
    }
    $rsProducts = CCatalogProduct::GetList(array(), array('ID' => $ID), false, false, array('ID', 'CAN_BUY_ZERO', 'QUANTITY_TRACE', 'QUANTITY'));
    if ($arProduct = $rsProducts->Fetch()) {
        $intIBlockID = CIBlockElement::GetIBlockByID($arProduct['ID']);
        if (!$intIBlockID) {
            return false;
        }
        $arProduct['IBLOCK_ID'] = $intIBlockID;
    } else {
        return false;
    }
    $dbPrice = CPrice::GetListEx(array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC"), $arFilter, false, false, array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO"));
    while ($arPrice = $dbPrice->Fetch()) {
        if ($VAT_INCLUDE == 'N') {
            if ($bVatIncluded) {
                $arPrice['PRICE'] /= 1 + $fVatRate;
            }
        } else {
            if (!$bVatIncluded) {
                $arPrice['PRICE'] *= 1 + $fVatRate;
            }
        }
        $arPrice['VAT_RATE'] = $fVatRate;
        CCatalogDiscountSave::Disable();
        $arDiscounts = CCatalogDiscount::GetDiscount($ID, $arProduct["IBLOCK_ID"], $arPrice["CATALOG_GROUP_ID"], $arUserGroups, "N", SITE_ID, array());
        CCatalogDiscountSave::Enable();
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:include.php

示例4: CatalogGetPriceTableEx

/**
 * 
 *
 *
 *
 *
 * @param $I $D  Код товара. (ID элемента инфоблока, для которого запрашиваются
 * цены.)
 *
 *
 *
 * @param $filterQauntit $y = 0 Если значение больше 0, то выводится диапазон цен,
 * соответствующий этому количеству. Имеет смысл только при
 * расширенном режиме управления ценами.
 *
 *
 *
 * @param $arFilterTyp $e = array() Массив ID типов цен. Если не задан, то выбираются все типы цен,
 * которые может просматривать пользователь.
 *
 *
 *
 * @param $VAT_INCLUD $E = 'Y' (Y/N) НДС включён.
 *
 *
 *
 * @param $arCurrencyParam $s = array() Массив параметров для показа цен в одной валюте. Если в
 * переданном массиве заполнено поле CURRENCY_ID, то произойдет
 * конвертация цен в валюту CURRENCY_ID по текущему курсу. Необязательный
 * параметр.
 *
 *
 *
 * @return mixed <p></p><br><br>
 *
 * @static
 * @link http://dev.1c-bitrix.ru/api_help/catalog/functions/cataloggetpricetableex.php
 * @author Bitrix
 */
function CatalogGetPriceTableEx($ID, $filterQauntity = 0, $arFilterType = array(), $VAT_INCLUDE = 'Y', $arCurrencyParams = array())
{
	global $USER;
	$ID = intval($ID);
	if ($ID <= 0)
		return False;

	$filterQauntity = intval($filterQauntity);

	if (!is_array($arFilterType))
		$arFilterType = array($arFilterType);

	$boolConvert = false;
	$strCurrencyID = '';
	$arCurrencyList = array();
	if (is_array($arCurrencyParams) && !empty($arCurrencyParams) && !empty($arCurrencyParams['CURRENCY_ID']))
	{
		$boolConvert = true;
		$strCurrencyID = $arCurrencyParams['CURRENCY_ID'];
	}

	$arResult = array();
	$arResult["ROWS"] = array();
	$arResult["COLS"] = array();
	$arResult["MATRIX"] = array();
	$arResult["CAN_BUY"] = array();
	$arResult["AVAILABLE"] = "N";

	$cacheTime = CATALOG_CACHE_DEFAULT_TIME;
	if (defined("CATALOG_CACHE_TIME"))
		$cacheTime = intval(CATALOG_CACHE_TIME);

	$arUserGroups = $USER->GetUserGroupArray();

	$arPriceGroups = CCatalogGroup::GetGroupsPerms($arUserGroups, array());

	if (empty($arPriceGroups["view"]))
		return $arResult;

	$currentQuantity = -1;
	$rowsCnt = -1;

	$arFilter = array("PRODUCT_ID" => $ID);
	if ($filterQauntity > 0)
	{
		$arFilter["+<=QUANTITY_FROM"] = $filterQauntity;
		$arFilter["+>=QUANTITY_TO"] = $filterQauntity;
	}
	if (!empty($arFilterType))
	{
		$arTmp = array();
		foreach ($arPriceGroups["view"] as &$intOneGroup)
		{
			if (in_array($intOneGroup, $arFilterType))
				$arTmp[] = $intOneGroup;
		}
		if (isset($intOneGroup))
			unset($intOneGroup);

		if (empty($arTmp))
			return $arResult;
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:include.php


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