本文整理汇总了PHP中CCatalogGroup::GetListArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogGroup::GetListArray方法的具体用法?PHP CCatalogGroup::GetListArray怎么用?PHP CCatalogGroup::GetListArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogGroup
的用法示例。
在下文中一共展示了CCatalogGroup::GetListArray方法的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;
}
示例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;
}
示例3: CatalogGetPriceTableEx
//.........这里部分代码省略.........
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();
$discountPrice = CCatalogProduct::CountPriceWithDiscount($arPrice["PRICE"], $arPrice["CURRENCY"], $arDiscounts);
$arPrice["DISCOUNT_PRICE"] = $discountPrice;
$arPrice["QUANTITY_FROM"] = doubleval($arPrice["QUANTITY_FROM"]);
if ($currentQuantity != $arPrice["QUANTITY_FROM"]) {
$rowsCnt++;
$arResult["ROWS"][$rowsCnt]["QUANTITY_FROM"] = $arPrice["QUANTITY_FROM"];
$arResult["ROWS"][$rowsCnt]["QUANTITY_TO"] = doubleval($arPrice["QUANTITY_TO"]);
$currentQuantity = $arPrice["QUANTITY_FROM"];
}
if ($boolConvert && $strCurrencyID != $arPrice["CURRENCY"]) {
$arResult["MATRIX"][intval($arPrice["CATALOG_GROUP_ID"])][$rowsCnt] = array("ID" => $arPrice["ID"], "ORIG_PRICE" => $arPrice["PRICE"], "ORIG_DISCOUNT_PRICE" => $arPrice["DISCOUNT_PRICE"], "ORIG_CURRENCY" => $arPrice["CURRENCY"], "ORIG_VAT_RATE" => $arPrice["VAT_RATE"], 'PRICE' => CCurrencyRates::ConvertCurrency($arPrice["PRICE"], $arPrice["CURRENCY"], $strCurrencyID), 'DISCOUNT_PRICE' => CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT_PRICE"], $arPrice["CURRENCY"], $strCurrencyID), 'CURRENCY' => $strCurrencyID, 'VAT_RATE' => CCurrencyRates::ConvertCurrency($arPrice["VAT_RATE"], $arPrice["CURRENCY"], $strCurrencyID));
$arCurrencyList[] = $arPrice["CURRENCY"];
} else {
$arResult["MATRIX"][intval($arPrice["CATALOG_GROUP_ID"])][$rowsCnt] = array("ID" => $arPrice["ID"], "PRICE" => $arPrice["PRICE"], "DISCOUNT_PRICE" => $arPrice["DISCOUNT_PRICE"], "CURRENCY" => $arPrice["CURRENCY"], "VAT_RATE" => $arPrice["VAT_RATE"]);
}
}
$arCatalogGroups = CCatalogGroup::GetListArray();
foreach ($arCatalogGroups as $key => $value) {
if (isset($arResult["MATRIX"][$key])) {
$arResult["COLS"][$value["ID"]] = $value;
}
}
$arResult["CAN_BUY"] = $arPriceGroups["buy"];
$arResult["AVAILABLE"] = 0 >= $arProduct['QUANTITY'] && 'Y' == $arProduct['QUANTITY_TRACE'] && 'N' == $arProduct['CAN_BUY_ZERO'] ? 'N' : 'Y';
if ($boolConvert) {
if (!empty($arCurrencyList)) {
$arCurrencyList[] = $strCurrencyID;
}
$arResult['CURRENCY_LIST'] = $arCurrencyList;
}
return $arResult;
}
示例4: CatalogGetPriceTableEx
//.........这里部分代码省略.........
{
$fVatRate = floatval($arVatInfo['RATE'] * 0.01);
$bVatIncluded = $arVatInfo['VAT_INCLUDED'] == 'Y';
}
else
{
$fVatRate = 0.00;
$bVatIncluded = 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", "PRODUCT_QUANTITY", "PRODUCT_QUANTITY_TRACE", "PRODUCT_CAN_BUY_ZERO", "ELEMENT_IBLOCK_ID")
);
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, $arPrice["ELEMENT_IBLOCK_ID"], $arPrice["CATALOG_GROUP_ID"], $arUserGroups, "N", SITE_ID);
CCatalogDiscountSave::Enable();
$discountPrice = CCatalogProduct::CountPriceWithDiscount($arPrice["PRICE"], $arPrice["CURRENCY"], $arDiscounts);
$arPrice["DISCOUNT_PRICE"] = $discountPrice;
$productQuantity = $arPrice["PRODUCT_QUANTITY"];
$productQuantityTrace = $arPrice["PRODUCT_QUANTITY_TRACE"];
$productUseStoreFlag = $arPrice["PRODUCT_CAN_BUY_ZERO"];
$arPrice["QUANTITY_FROM"] = DoubleVal($arPrice["QUANTITY_FROM"]);
if ($currentQuantity != $arPrice["QUANTITY_FROM"])
{
$rowsCnt++;
$arResult["ROWS"][$rowsCnt]["QUANTITY_FROM"] = $arPrice["QUANTITY_FROM"];
$arResult["ROWS"][$rowsCnt]["QUANTITY_TO"] = DoubleVal($arPrice["QUANTITY_TO"]);
$currentQuantity = $arPrice["QUANTITY_FROM"];
}
if ($boolConvert && $strCurrencyID != $arPrice["CURRENCY"])
{
$arResult["MATRIX"][intval($arPrice["CATALOG_GROUP_ID"])][$rowsCnt] = array(
"ID" => $arPrice["ID"],
"ORIG_PRICE" => $arPrice["PRICE"],
"ORIG_DISCOUNT_PRICE" => $arPrice["DISCOUNT_PRICE"],
"ORIG_CURRENCY" => $arPrice["CURRENCY"],
"ORIG_VAT_RATE" => $arPrice["VAT_RATE"],
'PRICE' => CCurrencyRates::ConvertCurrency($arPrice["PRICE"], $arPrice["CURRENCY"], $strCurrencyID),
'DISCOUNT_PRICE' => CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT_PRICE"], $arPrice["CURRENCY"], $strCurrencyID),
'CURRENCY' => $strCurrencyID,
'VAT_RATE' => CCurrencyRates::ConvertCurrency($arPrice["VAT_RATE"], $arPrice["CURRENCY"], $strCurrencyID),
);
$arCurrencyList[] = $arPrice["CURRENCY"];
}
else
{
$arResult["MATRIX"][intval($arPrice["CATALOG_GROUP_ID"])][$rowsCnt] = array(
"ID" => $arPrice["ID"],
"PRICE" => $arPrice["PRICE"],
"DISCOUNT_PRICE" => $arPrice["DISCOUNT_PRICE"],
"CURRENCY" => $arPrice["CURRENCY"],
"VAT_RATE" => $arPrice["VAT_RATE"]
);
}
}
$colsCnt = -1;
$arCatalogGroups = CCatalogGroup::GetListArray();
foreach ($arCatalogGroups as $key => $value)
{
if (array_key_exists($key, $arResult["MATRIX"]))
$arResult["COLS"][$value["ID"]] = $value;
}
$arResult["CAN_BUY"] = $arPriceGroups["buy"];
$arResult["AVAILABLE"] = (($productUseStoreFlag == 'Y' || ($productQuantityTrace == "N" || $productQuantityTrace == "Y" && $productQuantity > 0)) ? "Y" : "N");
if ($boolConvert)
{
if (!empty($arCurrencyList))
$arCurrencyList[] = $strCurrencyID;
$arResult['CURRENCY_LIST'] = $arCurrencyList;
}
return $arResult;
}