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


PHP getProductProps函数代码示例

本文整理汇总了PHP中getProductProps函数的典型用法代码示例。如果您正苦于以下问题:PHP getProductProps函数的具体用法?PHP getProductProps怎么用?PHP getProductProps使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getBasketItems

 public function getBasketItems()
 {
     global $APPLICATION;
     if (self::$catalogIncluded === null) {
         self::$catalogIncluded = Loader::includeModule('catalog');
     }
     self::$iblockIncluded = self::$catalogIncluded;
     CSaleBasket::UpdateBasketPrices(CSaleBasket::GetBasketUserID(), SITE_ID);
     $bShowReady = false;
     $bShowDelay = false;
     $bShowSubscribe = false;
     $bShowNotAvail = false;
     $allSum = 0;
     $allWeight = 0;
     $allCurrency = CSaleLang::GetLangCurrency(SITE_ID);
     $allVATSum = 0;
     $arParents = array();
     $arResult["ITEMS"]["AnDelCanBuy"] = array();
     $arResult["ITEMS"]["DelDelCanBuy"] = array();
     $arResult["ITEMS"]["nAnCanBuy"] = array();
     $arResult["ITEMS"]["ProdSubscribe"] = array();
     $DISCOUNT_PRICE_ALL = 0;
     // BASKET PRODUCTS (including measures, ratio, iblock properties data)
     $arImgFields = array("PREVIEW_PICTURE", "DETAIL_PICTURE");
     $arBasketItems = array();
     $basketKey = 0;
     $basketIds = array();
     $arSku2Parent = array();
     $arSetParentWeight = array();
     $arElementId = array();
     $dbItems = CSaleBasket::GetList(array("ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "NAME", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "DETAIL_PAGE_URL", "NOTES", "CURRENCY", "VAT_RATE", "CATALOG_XML_ID", "PRODUCT_XML_ID", "SUBSCRIBE", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS", "TYPE", "SET_PARENT_ID"));
     while ($arItem = $dbItems->GetNext()) {
         $arItem['PROPS'] = array();
         $arBasketItems[$basketKey] = $arItem;
         $basketIds[$arItem['ID']] =& $arBasketItems[$basketKey];
         $basketKey++;
         if (CSaleBasketHelper::isSetItem($arItem)) {
             continue;
         }
         $arElementId[] = $arItem["PRODUCT_ID"];
     }
     if (!empty($arElementId) && self::$catalogIncluded) {
         $productList = CCatalogSKU::getProductList($arElementId);
         if (!empty($productList)) {
             foreach ($productList as $offerId => $offerInfo) {
                 $offerInfo['PRODUCT_ID'] = $offerInfo['ID'];
                 $arElementId[] = $offerInfo['ID'];
                 $arSku2Parent[$offerId] = $offerInfo['ID'];
                 $arParents[$offerId] = $offerInfo;
             }
             unset($offerInfo, $offerId);
         }
         unset($productList);
         // get measures, ratio, sku props data and available quantity
         $arBasketItems = getMeasures($arBasketItems);
         $arBasketItems = getRatio($arBasketItems);
         $arBasketItems = $this->getAvailableQuantity($arBasketItems);
         $propsIterator = CSaleBasket::GetPropsList(array('BASKET_ID' => 'ASC', 'SORT' => 'ASC', 'ID' => 'ASC'), array('BASKET_ID' => array_keys($basketIds)));
         while ($property = $propsIterator->GetNext()) {
             $property['CODE'] = (string) $property['CODE'];
             if ($property['CODE'] == 'CATALOG.XML_ID' || $property['CODE'] == 'PRODUCT.XML_ID') {
                 continue;
             }
             if (!isset($basketIds[$property['BASKET_ID']])) {
                 continue;
             }
             $basketIds[$property['BASKET_ID']]['PROPS'][] = $property;
         }
         unset($property, $propsIterator, $basketIds);
     }
     // get product properties data
     $arProductData = getProductProps($arElementId, array_merge(array("ID"), $arImgFields, $this->arCustomSelectFields));
     foreach ($arBasketItems as &$arItem) {
         $quantityIsFloat = false;
         if (number_format(doubleval($arItem['QUANTITY']), 2, '.', '') != intval($arItem['QUANTITY'])) {
             $quantityIsFloat = true;
         }
         $arItem["QUANTITY"] = $quantityIsFloat === false && $this->quantityFloat != "Y" ? intval($arItem['QUANTITY']) : number_format(doubleval($arItem['QUANTITY']), 2, '.', '');
         $arItem["PRICE_VAT_VALUE"] = $arItem["PRICE"] / ($arItem["VAT_RATE"] + 1) * $arItem["VAT_RATE"];
         $arItem["PRICE_FORMATED"] = CCurrencyLang::CurrencyFormat($arItem["PRICE"], $arItem["CURRENCY"], true);
         $arItem["WEIGHT"] = doubleval($arItem["WEIGHT"]);
         $arItem["WEIGHT_FORMATED"] = roundEx(doubleval($arItem["WEIGHT"] / $this->weightKoef), SALE_WEIGHT_PRECISION) . " " . $this->weightUnit;
         if (CSaleBasketHelper::isSetItem($arItem)) {
             $arSetParentWeight[$arItem["SET_PARENT_ID"]] += $arItem["WEIGHT"] * $arItem["QUANTITY"];
         }
         if (isset($arProductData[$arItem['PRODUCT_ID']]) && is_array($arProductData[$arItem['PRODUCT_ID']])) {
             foreach ($arProductData[$arItem["PRODUCT_ID"]] as $key => $value) {
                 if (strpos($key, "PROPERTY_") !== false || in_array($key, $arImgFields)) {
                     $arItem[$key] = $value;
                 }
             }
         }
         if (array_key_exists($arItem["PRODUCT_ID"], $arSku2Parent)) {
             $arFieldsToFill = array_merge($this->arCustomSelectFields, $arImgFields);
             // fields to be filled with parents' values if empty
             foreach ($arFieldsToFill as $field) {
                 $fieldVal = in_array($field, $arImgFields) ? $field : $field . "_VALUE";
                 $parentId = $arSku2Parent[$arItem["PRODUCT_ID"]];
                 if ((!isset($arItem[$fieldVal]) || isset($arItem[$fieldVal]) && strlen($arItem[$fieldVal]) == 0) && (isset($arProductData[$parentId][$fieldVal]) && !empty($arProductData[$parentId][$fieldVal]))) {
                     $arItem[$fieldVal] = $arProductData[$parentId][$fieldVal];
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:class.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: array

			$arCustomSelectFields[] = $columnCode;

			$dbres = CIBlockProperty::GetList(array(), array("CODE" => substr($columnCode, 9)));
			if ($arPropData = $dbres->GetNext())
				$arIblockProps[$columnCode] = $arPropData;

			$count++;
		}
	}
}

if (!empty($arElementId))
{
	$arSelect = array_merge(array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "IBLOCK_TYPE_ID", "PREVIEW_PICTURE", "DETAIL_PICTURE"), $arCustomSelectFields);

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

$productWeight = 0.0;
foreach ($arBasketItem as $key => &$arItem)
{
	if (!empty($arProductData[$arItem["PRODUCT_ID"]]))
	{
		if ($arItem["MODULE"] == "catalog" && $bUseIblock)
		{
			$arBasketItem[$key]["EDIT_PAGE_URL"] = CIBlock::GetAdminElementEditLink($arProductData[$arItem["PRODUCT_ID"]]["IBLOCK_ID"], $arItem["PRODUCT_ID"], array(
				"find_section_section" => $arProductData[$arItem["PRODUCT_ID"]]["IBLOCK_SECTION_ID"],
				'WF' => 'Y',
			));
		}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:30,代码来源:order_new.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: setImgSrc

 private function setImgSrc(&$arBasketItems, $arElementId, $arSku2Parent)
 {
     $arImgFields = array("PREVIEW_PICTURE", "DETAIL_PICTURE");
     $arProductData = getProductProps($arElementId, array("ID") + $arImgFields);
     foreach ($arBasketItems as &$arItem) {
         if (array_key_exists($arItem["PRODUCT_ID"], $arProductData) && is_array($arProductData[$arItem["PRODUCT_ID"]])) {
             foreach ($arProductData[$arItem["PRODUCT_ID"]] as $key => $value) {
                 if (strpos($key, "PROPERTY_") !== false || in_array($key, $arImgFields)) {
                     $arItem[$key] = $value;
                 }
             }
         }
         if (array_key_exists($arItem["PRODUCT_ID"], $arSku2Parent)) {
             foreach ($arImgFields as $field) {
                 $fieldVal = in_array($field, $arImgFields) ? $field : $field . "_VALUE";
                 $parentId = $arSku2Parent[$arItem["PRODUCT_ID"]];
                 if ((!isset($arItem[$fieldVal]) || isset($arItem[$fieldVal]) && strlen($arItem[$fieldVal]) == 0) && (isset($arProductData[$parentId][$fieldVal]) && !empty($arProductData[$parentId][$fieldVal]))) {
                     $arItem[$fieldVal] = $arProductData[$parentId][$fieldVal];
                 }
             }
         }
         $arItem["PICTURE_SRC"] = "";
         $arImage = null;
         if (isset($arItem["PREVIEW_PICTURE"]) && intval($arItem["PREVIEW_PICTURE"]) > 0) {
             $arImage = CFile::GetFileArray($arItem["PREVIEW_PICTURE"]);
         } elseif (isset($arItem["DETAIL_PICTURE"]) && intval($arItem["DETAIL_PICTURE"]) > 0) {
             $arImage = CFile::GetFileArray($arItem["DETAIL_PICTURE"]);
         }
         if ($arImage) {
             $arFileTmp = CFile::ResizeImageGet($arImage, array("width" => "70", "height" => "70"), BX_RESIZE_IMAGE_PROPORTIONAL, true);
             $arItem["PICTURE_SRC"] = $arFileTmp["src"];
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:34,代码来源:class.php

示例6: getSaleProductImage

function getSaleProductImage($product)
{
    $productImg = '';
    if ($product["INFO"]["PREVIEW_PICTURE"] != "") {
        $productImg = $product["INFO"]["PREVIEW_PICTURE"];
    } elseif ($product["INFO"]["DETAIL_PICTURE"] != "") {
        $productImg = $product["INFO"]["DETAIL_PICTURE"];
    }
    if (empty($productImg) && CModule::IncludeModule("catalog")) {
        $arParent = CCatalogSku::GetProductInfo($product["PRODUCT_ID"]);
        if (intval($arParent["ID"]) > 0) {
            $arProductData = getProductProps(array($arParent["ID"]), array("ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "IBLOCK_TYPE_ID", "IBLOCK_ID", "IBLOCK_SECTION_ID"));
            if (!empty($arProductData[$arParent["ID"]]["PREVIEW_PICTURE"])) {
                $productImg = $arProductData[$arParent["ID"]]["PREVIEW_PICTURE"];
            } elseif (!empty($arProductData[$arParent["ID"]]["DETAIL_PICTURE"])) {
                $productImg = $arProductData[$arParent["ID"]]["DETAIL_PICTURE"];
            }
        }
    }
    if ($productImg != "") {
        $arFile = CFile::GetFileArray($productImg);
        $productImg = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
    }
    return $productImg;
}
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:25,代码来源:template.php

示例7: getBasketItems

 public function getBasketItems()
 {
     global $APPLICATION;
     $bUseCatalog = CModule::IncludeModule("catalog");
     $bUseIblock = $bUseCatalog;
     $bShowReady = False;
     $bShowDelay = False;
     $bShowSubscribe = False;
     $bShowNotAvail = False;
     $allSum = 0;
     $allWeight = 0;
     $allCurrency = CSaleLang::GetLangCurrency($this->getSiteId());
     $allVATSum = 0;
     $arParents = array();
     $arResult["ITEMS"]["AnDelCanBuy"] = array();
     $arResult["ITEMS"]["DelDelCanBuy"] = array();
     $arResult["ITEMS"]["nAnCanBuy"] = array();
     $arResult["ITEMS"]["ProdSubscribe"] = array();
     $DISCOUNT_PRICE_ALL = 0;
     // BASKET PRODUCTS (including measures, ratio, iblock properties data)
     $arImgFields = array("PREVIEW_PICTURE", "DETAIL_PICTURE");
     $arBasketItems = array();
     $arSku2Parent = array();
     $arSetParentWeight = array();
     $basketItemsFilter = array("USER_ID" => $this->userId, "ORDER_ID" => "NULL");
     if ($this->showDelay != 'Y') {
         $basketItemsFilter['DELAY'] = 'N';
     }
     $dbItems = CSaleBasket::GetList(array("ID" => "ASC"), $basketItemsFilter, false, false, array("ID", "NAME", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "DETAIL_PAGE_URL", "NOTES", "CURRENCY", "VAT_RATE", "CATALOG_XML_ID", "PRODUCT_XML_ID", "SUBSCRIBE", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS", "TYPE", "SET_PARENT_ID"));
     while ($arItem = $dbItems->GetNext()) {
         $arBasketItems[] = $arItem;
         if (CSaleBasketHelper::isSetItem($arItem)) {
             continue;
         }
         $arElementId[] = $arItem["PRODUCT_ID"];
         if ($bUseCatalog) {
             $arParent = CCatalogSku::GetProductInfo($arItem["PRODUCT_ID"]);
             if ($arParent) {
                 $arElementId[] = $arParent["ID"];
                 $arSku2Parent[$arItem["PRODUCT_ID"]] = $arParent["ID"];
                 $arParents[$arItem["PRODUCT_ID"]]["PRODUCT_ID"] = $arParent["ID"];
                 $arParents[$arItem["PRODUCT_ID"]]["IBLOCK_ID"] = $arParent["IBLOCK_ID"];
             }
         }
     }
     // get measures, ratio, sku props data and available quantity
     if (!empty($arBasketItems) && $bUseCatalog) {
         $arBasketItems = getMeasures($arBasketItems);
         $arBasketItems = getRatio($arBasketItems);
         $arBasketItems = $this->getAvailableQuantity($arBasketItems);
     }
     // get product properties data
     $arProductData = getProductProps($arElementId, array_merge(array("ID"), $arImgFields, $this->arCustomSelectFields));
     foreach ($arBasketItems as &$arItem) {
         $quantityIsFloat = false;
         if (number_format(doubleval($arItem['QUANTITY']), 2, '.', '') != intval($arItem['QUANTITY'])) {
             $quantityIsFloat = true;
         }
         $arItem["QUANTITY"] = $quantityIsFloat === false && $this->quantityFloat != "Y" ? intval($arItem['QUANTITY']) : number_format(doubleval($arItem['QUANTITY']), 2, '.', '');
         $arItem["QUANTITY_FORMATED"] = $arItem["QUANTITY"] . " " . $arItem["MEASURE_TEXT"];
         $arItem["PROPS"] = array();
         $dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arItem["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
         while ($arProp = $dbProp->GetNext()) {
             $arItem["PROPS"][] = $arProp;
         }
         $arItem["PRICE_VAT_VALUE"] = $arItem["PRICE"] / ($arItem["VAT_RATE"] + 1) * $arItem["VAT_RATE"];
         $arItem["PRICE_FORMATED"] = $this->getSaleFormatCurrency($arItem["PRICE"], $arItem["CURRENCY"]);
         $arItem["WEIGHT"] = doubleval($arItem["WEIGHT"]);
         $arItem["WEIGHT_FORMATED"] = roundEx(doubleval($arItem["WEIGHT"] / $this->weightKoef), SALE_WEIGHT_PRECISION) . " " . $this->weightUnit;
         $arItem["DISCOUNT_FORMATED"] = $this->getSaleFormatCurrency($arItem["DISCOUNT_PRICE"], $arItem["CURRENCY"]);
         if (CSaleBasketHelper::isSetItem($arItem)) {
             $arSetParentWeight[$arItem["SET_PARENT_ID"]] += $arItem["WEIGHT"] * $arItem["QUANTITY"];
         }
         if (array_key_exists($arItem["PRODUCT_ID"], $arProductData) && is_array($arProductData[$arItem["PRODUCT_ID"]])) {
             foreach ($arProductData[$arItem["PRODUCT_ID"]] as $key => $value) {
                 if (strpos($key, "PROPERTY_") !== false || in_array($key, $arImgFields)) {
                     $arItem[$key] = $value;
                 }
             }
         }
         if (array_key_exists($arItem["PRODUCT_ID"], $arSku2Parent)) {
             $arFieldsToFill = array_merge($this->arCustomSelectFields, $arImgFields);
             // fields to be filled with parents' values if empty
             foreach ($arFieldsToFill as $field) {
                 $fieldVal = in_array($field, $arImgFields) ? $field : $field . "_VALUE";
                 $parentId = $arSku2Parent[$arItem["PRODUCT_ID"]];
                 if ((!isset($arItem[$fieldVal]) || isset($arItem[$fieldVal]) && strlen($arItem[$fieldVal]) == 0) && (isset($arProductData[$parentId][$fieldVal]) && !empty($arProductData[$parentId][$fieldVal]))) {
                     $arItem[$fieldVal] = $arProductData[$parentId][$fieldVal];
                 }
             }
         }
         foreach ($arItem as $key => $value) {
             if (strpos($key, "PROPERTY_", 0) === 0 && strrpos($key, "_VALUE") == strlen($key) - 6) {
                 $code = str_replace(array("PROPERTY_", "_VALUE"), "", $key);
                 $propData = $this->arIblockProps[$code];
                 $arItem[$key] = CSaleHelper::getIblockPropInfo($value, $propData);
             }
         }
         $arItem["PREVIEW_PICTURE_SRC"] = "";
         if (isset($arItem["PREVIEW_PICTURE"]) && intval($arItem["PREVIEW_PICTURE"]) > 0) {
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:101,代码来源:class.php

示例8: getBasketItems

	public function getBasketItems()
	{
		global $APPLICATION;
		$bUseCatalog = CModule::IncludeModule("catalog");
		$bUseIblock = $bUseCatalog;

		CSaleBasket::UpdateBasketPrices(CSaleBasket::GetBasketUserID(), SITE_ID);

		$bShowReady = False;
		$bShowDelay = False;
		$bShowSubscribe = False;
		$bShowNotAvail = False;
		$allSum = 0;
		$allWeight = 0;
		$allCurrency = CSaleLang::GetLangCurrency(SITE_ID);
		$allVATSum = 0;
		$arParents = array();

		$arResult["ITEMS"]["AnDelCanBuy"] = array();
		$arResult["ITEMS"]["DelDelCanBuy"] = array();
		$arResult["ITEMS"]["nAnCanBuy"] = array();
		$arResult["ITEMS"]["ProdSubscribe"] = array();
		$DISCOUNT_PRICE_ALL = 0;

		// BASKET PRODUCTS (including measures, ratio, iblock properties data)

		$arImgFields = array("PREVIEW_PICTURE", "DETAIL_PICTURE");
		$arBasketItems = array();
		$arSku2Parent = array();
		$arSetParentWeight = array();
		$dbItems = CSaleBasket::GetList(
			array("ID" => "ASC"),
			array(
				"FUSER_ID" => CSaleBasket::GetBasketUserID(),
				"LID" => SITE_ID,
				"ORDER_ID" => "NULL"
			),
			false,
			false,
			array(
				"ID", "NAME", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY",
				"PRICE", "WEIGHT", "DETAIL_PAGE_URL", "NOTES", "CURRENCY", "VAT_RATE", "CATALOG_XML_ID",
				"PRODUCT_XML_ID", "SUBSCRIBE", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS", "TYPE", "SET_PARENT_ID"
			)
		);
		while ($arItem = $dbItems->GetNext())
		{
			$arBasketItems[] = $arItem;

			if (CSaleBasketHelper::isSetItem($arItem))
				continue;

			$arElementId[] = $arItem["PRODUCT_ID"];

			if ($bUseCatalog)
			{
				$arParent = CCatalogSku::GetProductInfo($arItem["PRODUCT_ID"]);

				if ($arParent)
				{
					$arElementId[] = $arParent["ID"];
					$arSku2Parent[$arItem["PRODUCT_ID"]] = $arParent["ID"];

					$arParents[$arItem["PRODUCT_ID"]]["PRODUCT_ID"] = $arParent["ID"];
					$arParents[$arItem["PRODUCT_ID"]]["IBLOCK_ID"] = $arParent["IBLOCK_ID"];
				}
			}
		}

		// get measures, ratio, sku props data and available quantity
		if (!empty($arBasketItems) && $bUseCatalog)
		{
			$arBasketItems = getMeasures($arBasketItems);
			$arBasketItems = getRatio($arBasketItems);
			$arBasketItems = $this->getAvailableQuantity($arBasketItems);
		}

		// get product properties data
		$arProductData = getProductProps($arElementId, array_merge(array("ID"), $arImgFields, $this->arCustomSelectFields));

		foreach ($arBasketItems as &$arItem)
		{

			$quantityIsFloat = false;
			if (number_format(doubleval($arItem['QUANTITY']), 2, '.', '') != intval($arItem['QUANTITY']))
			{
				$quantityIsFloat = true;
			}

			$arItem["QUANTITY"] = ($quantityIsFloat === false && $this->quantityFloat != "Y") ? intval($arItem['QUANTITY']) : number_format(doubleval($arItem['QUANTITY']), 2, '.', '');

			$arItem["PROPS"] = array();

			$dbProp = CSaleBasket::GetPropsList(
				array("SORT" => "ASC", "ID" => "ASC"),
				array("BASKET_ID" => $arItem["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID"))
			);
			while ($arProp = $dbProp->GetNext())
				$arItem["PROPS"][] = $arProp;

//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:class.php


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