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


PHP CCatalogMeasure::GetList方法代码示例

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


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

示例1: exportElement

 function exportElement($arElement, $SECTION_MAP, $PROPERTY_MAP)
 {
     if (strlen($arElement["XML_ID"]) > 0) {
         $xml_id = $arElement["XML_ID"];
     } else {
         $xml_id = $arElement["ID"];
     }
     if ($this->PRODUCT_IBLOCK_ID > 0) {
         $arPropOrder = array("sort" => "asc", "id" => "asc", "enum_sort" => "asc", "value_id" => "asc");
         $rsLink = CIBlockElement::GetProperty($this->arIBlock["ID"], $arElement["ID"], $arPropOrder, array("ACTIVE" => "Y", "CODE" => "CML2_LINK"));
         $arLink = $rsLink->Fetch();
         if (is_array($arLink) && !is_array($arLink["VALUE"]) && $arLink["VALUE"] > 0) {
             $xml_id = $this->GetElementXML_ID($this->PRODUCT_IBLOCK_ID, $arLink["VALUE"]) . "#" . $xml_id;
         }
     }
     fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_ID") . ">" . htmlspecialcharsbx($xml_id) . "</" . GetMessage("IBLOCK_XML2_ID") . ">\n");
     if (!$this->only_price) {
         $this->exportElementFields($arElement, $SECTION_MAP);
         if ($this->next_step["catalog"] && !$this->bExtended) {
             fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_ITEM_ATTRIBUTES") . ">\n");
         } else {
             fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_PROPERTIES_VALUES") . ">\n");
         }
         $this->exportElementProperties($arElement, $PROPERTY_MAP);
         if ($this->next_step["catalog"] && !$this->bExtended) {
             fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_ITEM_ATTRIBUTES") . ">\n");
         } else {
             fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_PROPERTIES_VALUES") . ">\n");
         }
         if ($this->bExtended) {
             $elementTemplates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($this->arIBlock["ID"], $arElement["ID"]);
             $this->exportInheritedTemplates(4, $elementTemplates);
         }
     }
     if ($this->next_step["catalog"]) {
         $rsProduct = CCatalogProduct::GetList(array(), array("ID" => $arElement["ID"]));
         $arProduct = $rsProduct->Fetch();
         static $measure = null;
         if (!isset($measure)) {
             $measure = array();
             $rsBaseUnit = CCatalogMeasure::GetList(array(), array());
             while ($arIDUnit = $rsBaseUnit->Fetch()) {
                 $measure[$arIDUnit["ID"]] = $arIDUnit["CODE"];
             }
         }
         $xmlMeasure = GetMessage("IBLOCK_XML2_PCS");
         if ($arProduct["MEASURE"] > 0 && isset($measure[$arProduct["MEASURE"]])) {
             $xmlMeasure = $measure[$arProduct["MEASURE"]];
         }
         $arPrices = array();
         $rsPrices = CPrice::GetList(array(), array("PRODUCT_ID" => $arElement["ID"]));
         while ($arPrice = $rsPrices->Fetch()) {
             if (!$arPrice["QUANTITY_FROM"] && !$arPrice["QUANTITY_TO"]) {
                 $arPrices[] = array(GetMessage("IBLOCK_XML2_PRICE_TYPE_ID") => $this->prices[$arPrice["CATALOG_GROUP_ID"]], GetMessage("IBLOCK_XML2_PRICE_FOR_ONE") => $arPrice["PRICE"], GetMessage("IBLOCK_XML2_CURRENCY") => $arPrice["CURRENCY"], GetMessage("IBLOCK_XML2_MEASURE") => $xmlMeasure);
             }
         }
         if (count($arPrices) > 0) {
             fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_PRICES") . ">\n");
             foreach ($arPrices as $arPrice) {
                 fwrite($this->fp, "\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_PRICE") . ">\n");
                 foreach ($arPrice as $key => $value) {
                     fwrite($this->fp, "\t\t\t\t\t\t<" . $key . ">" . htmlspecialcharsbx($value) . "</" . $key . ">\n");
                 }
                 fwrite($this->fp, "\t\t\t\t\t</" . GetMessage("IBLOCK_XML2_PRICE") . ">\n");
             }
             fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_PRICES") . ">\n");
             $arCatalogProduct = CCatalogProduct::GetByID($arElement["ID"]);
             if ($arCatalogProduct) {
                 fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_AMOUNT") . ">" . htmlspecialcharsbx($arCatalogProduct["QUANTITY"]) . "</" . GetMessage("IBLOCK_XML2_AMOUNT") . ">\n");
             }
         }
     }
 }
开发者ID:nycmic,项目名称:bittest,代码行数:73,代码来源:cml2.php

示例2: getProductDataToFillBasket

function getProductDataToFillBasket($productId, $quantity, $userId, $LID, $userColumns, $tmpId = "")
{
	if (!\Bitrix\Main\Loader::includeModule("catalog"))
		return array();

	$arParams = array();

	$productId = (int)$productId;
	if ($productId <= 0)
	{
		return $arParams;
	}
	$iblockId = (int)CIBlockElement::GetIBlockByID($productId);
	if ($iblockId <= 0)
	{
		return $arParams;
	}

	$arSku2Parent = array();
	$arElementId = array();

	$arElementId[] = $productId;
	$arParent = CCatalogSku::GetProductInfo($productId, $iblockId);
	if ($arParent)
	{
		$arElementId[] = $arParent["ID"];
		$arSku2Parent[$productId] = $arParent["ID"];
	}

	$arPropertyInfo = array();
	$userColumns = (string)$userColumns;
	$arUserColumns = ($userColumns != '') ? explode(",", $userColumns) : array();
	foreach ($arUserColumns as $key => $column)
	{
		if (strncmp($column, 'PROPERTY_', 9) != 0)
		{
			unset($arUserColumns[$key]);
		}
		else
		{
			$propertyCode = substr($column, 9);
			if ($propertyCode == '')
			{
				unset($arUserColumns[$key]);
				continue;
			}
			$dbres = CIBlockProperty::GetList(array(), array("CODE" => $propertyCode));
			if ($arPropData = $dbres->GetNext())
				$arPropertyInfo[$column] = $arPropData;
		}
	}

	$arSelect = array_merge(
		array("ID", "NAME", "LID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "DETAIL_PICTURE", "PREVIEW_PICTURE", "DETAIL_PAGE_URL", "XML_ID", "IBLOCK_XML_ID"),
		$arUserColumns
	);

	$arProductData = getProductProps($arElementId, $arSelect);

	$defaultMeasure = CCatalogMeasure::getDefaultMeasure(true, true);

	if (!empty($arProductData))
	{
		$arElementInfo = array();
		foreach ($arProductData as $elemId => &$arElement)
		{
			foreach ($arElement as $key => $value)
			{
				if (strncmp($key, 'PROPERTY_', 9) == 0 && substr($key, -6) == "_VALUE")
				{
					$columnCode = str_replace("_VALUE", "", $key);
					$arElement[$key] = getIblockPropInfo($value, $arPropertyInfo[$columnCode], array("WIDTH" => 90, "HEIGHT" => 90));
				}
			}
		}
		unset($arElement);

		if (isset($arProductData[$productId]))
			$arElementInfo = $arProductData[$productId];

		if (isset( $arSku2Parent[$productId]))
			$arParent = $arProductData[$arSku2Parent[$productId]];

		if (!empty($arSku2Parent)) // if sku element doesn't have value of some property - we'll show parent element value instead
		{
			foreach ($arUserColumns as $field)
			{
				$fieldVal = $field."_VALUE";
				$parentId = $arSku2Parent[$productId];

				if ((!isset($arElementInfo[$fieldVal]) || (isset($arElementInfo[$fieldVal]) && strlen($arElementInfo[$fieldVal]) == 0))
					&& (isset($arProductData[$parentId][$fieldVal]) && !empty($arProductData[$parentId][$fieldVal]))) // can be array or string
				{
					$arElementInfo[$fieldVal] = $arProductData[$parentId][$fieldVal];
				}
			}
			if (strpos($arElementInfo["~XML_ID"], '#') === false)
			{
				$arElementInfo["~XML_ID"] = $arParent['~XML_ID'].'#'.$arElementInfo["~XML_ID"];
			}
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:arteva.ru,代码行数:101,代码来源:admin_tool.php

示例3: getMeasures

function getMeasures($arBasketItems)
{
    if (Loader::includeModule('catalog')) {
        $arDefaultMeasure = CCatalogMeasure::getDefaultMeasure(true, true);
        $arElementId = array();
        $basketLinks = array();
        foreach ($arBasketItems as $keyBasket => $arItem) {
            $productID = (int) $arItem["PRODUCT_ID"];
            if (!isset($basketLinks[$productID])) {
                $basketLinks[$productID] = array();
            }
            $basketLinks[$productID][] = $keyBasket;
            $arElementId[] = $productID;
            $arBasketItems[$keyBasket]['MEASURE_TEXT'] = $arDefaultMeasure['~SYMBOL_RUS'];
            $arBasketItems[$keyBasket]['MEASURE'] = 0;
        }
        unset($productID, $keyBasket, $arItem);
        if (!empty($arElementId)) {
            $arBasket2Measure = array();
            $dbres = CCatalogProduct::GetList(array(), array("ID" => $arElementId), false, false, array("ID", "MEASURE"));
            while ($arRes = $dbres->Fetch()) {
                $arRes['ID'] = (int) $arRes['ID'];
                $arRes['MEASURE'] = (int) $arRes['MEASURE'];
                if (!isset($arBasket2Measure[$arRes['MEASURE']])) {
                    $arBasket2Measure[$arRes['MEASURE']] = array();
                }
                $arBasket2Measure[$arRes['MEASURE']][] = $arRes['ID'];
            }
            unset($arRes, $dbres);
            if (!empty($arBasket2Measure)) {
                $dbMeasure = CCatalogMeasure::GetList(array(), array("ID" => array_keys($arBasket2Measure)), false, false, array('ID', 'SYMBOL_RUS'));
                while ($arMeasure = $dbMeasure->Fetch()) {
                    $arMeasure['ID'] = (int) $arMeasure['ID'];
                    if (isset($arBasket2Measure[$arMeasure['ID']]) && !empty($arBasket2Measure[$arMeasure['ID']])) {
                        foreach ($arBasket2Measure[$arMeasure['ID']] as &$productID) {
                            if (isset($basketLinks[$productID]) && !empty($basketLinks[$productID])) {
                                foreach ($basketLinks[$productID] as &$keyBasket) {
                                    $arBasketItems[$keyBasket]['MEASURE_TEXT'] = $arMeasure['SYMBOL_RUS'];
                                    $arBasketItems[$keyBasket]['MEASURE'] = $arMeasure['ID'];
                                }
                                unset($keyBasket);
                            }
                        }
                        unset($productID);
                    }
                }
            }
        }
    }
    return $arBasketItems;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:51,代码来源:include.php

示例4: getProductDataToFillBasket

 /**
  * @param $productId
  * @param $quantity
  * @param $userId
  * @param $LID
  * @param $userColumns
  * @param string $tmpId we can suggest that this mean the set_item
  * @return array
  * @throws Main\LoaderException
  */
 protected function getProductDataToFillBasket($productId, $quantity, $userId, $LID, $userColumns, $tmpId = "")
 {
     $isSetItem = $tmpId != "";
     if (self::$catalogIncluded === null) {
         self::$catalogIncluded = Main\Loader::includeModule('catalog');
     }
     if (!self::$catalogIncluded) {
         return array();
     }
     $arParams = array();
     static $proxyIblockElement = array();
     static $proxyCatalogMeasure = array();
     static $proxyParent = array();
     static $proxyIblockProperty = array();
     static $proxyProductData = array();
     static $proxyCatalogProduct = array();
     static $proxyCatalogMeasureRatio = array();
     $productId = (int) $productId;
     if ($productId <= 0) {
         return $arParams;
     }
     if (!empty($proxyIblockElement[$productId])) {
         $iblockId = $proxyIblockElement[$productId];
     } else {
         $iblockId = (int) \CIBlockElement::getIBlockByID($productId);
         if ($iblockId > 0) {
             $proxyIblockElement[$productId] = $iblockId;
         }
     }
     if ($iblockId <= 0) {
         return $arParams;
     }
     $arSku2Parent = array();
     $arElementId = array();
     $arElementId[] = $productId;
     $proxyParentKey = $productId . "|" . $iblockId;
     if (!empty($proxyParent[$proxyParentKey]) && is_array($proxyParent[$proxyParentKey])) {
         $arParent = $proxyParent[$proxyParentKey];
     } else {
         $arParent = \CCatalogSku::getProductInfo($productId, $iblockId);
         $proxyParent[$proxyParentKey] = $arParent;
     }
     if ($arParent) {
         $arElementId[] = $arParent["ID"];
         $arSku2Parent[$productId] = $arParent["ID"];
     }
     $arPropertyInfo = array();
     $userColumns = (string) $userColumns;
     $arUserColumns = $userColumns != '' ? explode(",", $userColumns) : array();
     foreach ($arUserColumns as $key => $column) {
         if (strncmp($column, 'PROPERTY_', 9) != 0) {
             unset($arUserColumns[$key]);
         } else {
             $propertyCode = substr($column, 9);
             if ($propertyCode == '') {
                 unset($arUserColumns[$key]);
                 continue;
             }
             if (!empty($proxyIblockProperty[$propertyCode]) && is_array($proxyIblockProperty[$propertyCode])) {
                 $arPropertyInfo[$column] = $proxyIblockProperty[$propertyCode];
             } else {
                 $dbres = \CIBlockProperty::GetList(array(), array("CODE" => $propertyCode));
                 if ($arPropData = $dbres->GetNext()) {
                     $arPropertyInfo[$column] = $arPropData;
                     $proxyIblockProperty[$propertyCode] = $arPropData;
                 }
             }
         }
     }
     $arSelect = array_merge(array("ID", "NAME", "IBLOCK_ID", "IBLOCK_SECTION_ID", "DETAIL_PICTURE", "PREVIEW_PICTURE", "XML_ID", "IBLOCK_XML_ID"), $arUserColumns);
     $proxyProductDataKey = md5(join('|', $arElementId) . "_" . join('|', $arSelect));
     if (!empty($proxyProductData[$proxyProductDataKey]) && is_array($proxyProductData[$proxyProductDataKey])) {
         $arProductData = $proxyProductData[$proxyProductDataKey];
     } else {
         $arProductData = getProductProps($arElementId, $arSelect);
         $proxyProductData[$proxyProductDataKey] = $arProductData;
     }
     $defaultMeasure = \CCatalogMeasure::getDefaultMeasure(true, true);
     if (!empty($arProductData)) {
         $arElementInfo = array();
         foreach ($arProductData as $elemId => &$arElement) {
             foreach ($arElement as $key => $value) {
                 if (strncmp($key, 'PROPERTY_', 9) == 0 && substr($key, -6) == "_VALUE") {
                     $columnCode = str_replace("_VALUE", "", $key);
                     $arElement[$key] = getIblockPropInfo($value, $arPropertyInfo[$columnCode], array("WIDTH" => 90, "HEIGHT" => 90));
                 }
             }
         }
         unset($arElement);
         if (isset($arProductData[$productId])) {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:orderbasket.php

示例5: getMeasures

function getMeasures($arBasketItems)
{
    static $measures = array();
    $newMeasure = array();
    if (Loader::includeModule('catalog')) {
        $arDefaultMeasure = CCatalogMeasure::getDefaultMeasure(true, true);
        $arElementId = array();
        $basketLinks = array();
        foreach ($arBasketItems as $keyBasket => $arItem) {
            if (isset($arItem['MEASURE_NAME']) && strlen($arItem['MEASURE_NAME']) > 0) {
                $measureText = $arItem['MEASURE_NAME'];
                $measureCode = intval($arItem['MEASURE_CODE']);
            } else {
                $productID = (int) $arItem["PRODUCT_ID"];
                if (!isset($basketLinks[$productID])) {
                    $basketLinks[$productID] = array();
                }
                $basketLinks[$productID][] = $keyBasket;
                $arElementId[] = $productID;
                $measureText = $arDefaultMeasure['~SYMBOL_RUS'];
                $measureCode = 0;
            }
            $arBasketItems[$keyBasket]['MEASURE_TEXT'] = $measureText;
            $arBasketItems[$keyBasket]['MEASURE'] = $measureCode;
        }
        unset($productID, $keyBasket, $arItem);
        if (!empty($arElementId)) {
            $arBasket2Measure = array();
            $dbres = CCatalogProduct::GetList(array(), array("ID" => $arElementId), false, false, array("ID", "MEASURE"));
            while ($arRes = $dbres->Fetch()) {
                $arRes['ID'] = (int) $arRes['ID'];
                $arRes['MEASURE'] = (int) $arRes['MEASURE'];
                if (!isset($arBasket2Measure[$arRes['MEASURE']])) {
                    $arBasket2Measure[$arRes['MEASURE']] = array();
                }
                $arBasket2Measure[$arRes['MEASURE']][] = $arRes['ID'];
                if (!isset($measures[$arRes['MEASURE']]) && !in_array($arRes['MEASURE'], $newMeasure)) {
                    $newMeasure[] = $arRes['MEASURE'];
                }
            }
            unset($arRes, $dbres);
            if (!empty($newMeasure)) {
                $dbMeasure = CCatalogMeasure::GetList(array(), array("ID" => array_values($newMeasure)), false, false, array('ID', 'SYMBOL_RUS'));
                while ($arMeasure = $dbMeasure->Fetch()) {
                    $measures[$arMeasure['ID']] = $arMeasure;
                }
            }
            foreach ($arBasket2Measure as $measureId => $productIds) {
                foreach ($productIds as $productId) {
                    if (isset($basketLinks[$productId]) && !empty($basketLinks[$productId])) {
                        foreach ($basketLinks[$productId] as $keyBasket) {
                            $arBasketItems[$keyBasket]['MEASURE_TEXT'] = $measures[$measureId]['SYMBOL_RUS'];
                            $arBasketItems[$keyBasket]['MEASURE'] = $measures[$measureId]['ID'];
                        }
                    }
                }
            }
        }
    }
    return $arBasketItems;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:61,代码来源:include.php

示例6: GetMessage

        }
        $bVarsFromForm = true;
        $DB->Rollback();
    }
}
if ($ID > 0) {
    $APPLICATION->SetTitle(str_replace("#ID#", $ID, GetMessage("CAT_MEASURE_TITLE_EDIT")));
} elseif ($_REQUEST["OKEI"] == 'Y') {
    $APPLICATION->SetTitle(GetMessage("CAT_MEASURE_TITLE_OKEI"));
} else {
    $APPLICATION->SetTitle(GetMessage("CAT_MEASURE_TITLE_NEW"));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
if ($ID > 0) {
    $arSelect = array("ID", "CODE", "MEASURE_TITLE", "SYMBOL_RUS", "SYMBOL_INTL", "SYMBOL_LETTER_INTL", "IS_DEFAULT");
    $dbResult = CCatalogMeasure::GetList(array(), array('ID' => $ID), false, false, $arSelect);
    if (!$dbResult->ExtractFields("str_")) {
        $ID = 0;
    }
}
if ($bVarsFromForm) {
    $DB->InitTableVarsForEdit("b_catalog_measure", "", "str_");
}
$aMenu = array(array("TEXT" => GetMessage("CAT_MEASURE_LIST"), "ICON" => "btn_list", "LINK" => "/bitrix/admin/cat_measure_list.php?lang=" . LANG . "&" . GetFilterParams("filter_", false)));
if ($ID > 0 && !$bReadOnly) {
    $aMenu[] = array("SEPARATOR" => "Y");
    $aMenu[] = array("TEXT" => GetMessage("CAT_MEASURE_ADD"), "ICON" => "btn_new", "LINK" => "/bitrix/admin/cat_measure_edit.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
    $aMenu[] = array("TEXT" => GetMessage("CAT_MEASURE_DELETE"), "ICON" => "btn_delete", "LINK" => "javascript:if(confirm('" . GetMessage("CAT_MEASURE_DELETE_CONFIRM") . "')) window.location='/bitrix/admin/cat_measure_list.php?action=delete&ID[]=" . $ID . "&lang=" . LANG . "&" . bitrix_sessid_get() . "#tb';", "WARNING" => "Y");
}
$context = new CAdminContextMenu($aMenu);
$context->Show();
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:cat_measure_edit.php

示例7: CrmCheckPath

    return;
}
global $APPLICATION;
$arParams['PATH_TO_MEASURE_LIST'] = CrmCheckPath('PATH_TO_MEASURE_LIST', $arParams['PATH_TO_MEASURE_LIST'], '');
$arParams['PATH_TO_MEASURE_EDIT'] = CrmCheckPath('PATH_TO_MEASURE_EDIT', $arParams['PATH_TO_MEASURE_EDIT'], '?measure_id=#measure_id#&edit');
$elementID = isset($arParams['ELEMENT_ID']) ? intval($arParams['ELEMENT_ID']) : 0;
if ($elementID <= 0 && isset($_REQUEST['measure_id'])) {
    $elementID = intval($_REQUEST['measure_id']);
}
$arParams['ELEMENT_ID'] = $elementID;
$isEditMode = $elementID > 0;
if (!$isEditMode) {
    $fields = array('ID' => 0);
} else {
    $select = array('ID', 'CODE', 'MEASURE_TITLE', 'SYMBOL_RUS', 'SYMBOL_INTL', 'SYMBOL_LETTER_INTL', 'IS_DEFAULT');
    $dbResult = CCatalogMeasure::GetList(array(), array('ID' => $elementID), false, false, $select);
    $fields = $dbResult->GetNext();
    if (!is_array($fields)) {
        $arParams['ELEMENT_ID'] = 0;
        $fields = array('ID' => 0);
    }
}
$arResult['ELEMENT'] = $fields;
unset($fields);
if (check_bitrix_sessid()) {
    if ($_SERVER['REQUEST_METHOD'] === 'POST' && (isset($_POST['save']) || isset($_POST['saveAndView']) || isset($_POST['apply']))) {
        $errors = array();
        $code = isset($_REQUEST['CODE']) ? intval($_REQUEST['CODE']) : 0;
        if ($code <= 0) {
            $errors[] = GetMessage('CRM_MEASURE_ERR_CODE_EMPTY');
        }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


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