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


PHP CCatalogMeasureRatio类代码示例

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


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

示例1: array

	$arResult["SET_ITEMS"]["DEFAULT"] = array();
	$arResult["SET_ITEMS"]["OTHER"] = array();
	$arResult["SET_ITEMS"]["PRICE"] = 0;
	$arResult["SET_ITEMS"]["OLD_PRICE"] = 0;
	$arResult["SET_ITEMS"]["PRICE_DISCOUNT_DIFFERENCE"] = 0;

	$arSetItemsRatio = array();
	foreach ($arSetItemsID as $key=>$itemID)
	{
		$arSetItemsRatio[$itemID] = 1;
	}
	$rsRatios = CCatalogMeasureRatio::getList(
		array(),
		array('PRODUCT_ID' => $arSetItemsID),
		false,
		false,
		array('PRODUCT_ID', 'RATIO')
	);
	while ($arRatio = $rsRatios->Fetch())
	{
		if (in_array($arRatio['PRODUCT_ID'], $arSetItemsID))
		{
			$intRatio = (int)$arRatio['RATIO'];
			$dblRatio = (float)($arRatio['RATIO']);
			$arSetItemsRatio[$arRatio['PRODUCT_ID']] = ($dblRatio > $intRatio ? $dblRatio : $intRatio);
			$arSetItemsRatio[$arRatio['PRODUCT_ID']] = ($arSetItemsRatio[$arRatio['PRODUCT_ID']] > 0) ? $arSetItemsRatio[$arRatio['PRODUCT_ID']] : 1;
		}
	}
	$arResult["ITEMS_RATIO"] = $arSetItemsRatio;
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:29,代码来源:component.php

示例2: unset

             }
             if ($bGetProductProperties) {
                 $arItem["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($arParams["IBLOCK_ID"], $arItem["ID"], $arParams["PRODUCT_PROPERTIES"], $arItem["PROPERTIES"]);
                 if (!empty($arItem["PRODUCT_PROPERTIES"])) {
                     $arItem['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($arItem['PRODUCT_PROPERTIES']);
                 }
             }
         }
     }
     if (isset($arItem)) {
         unset($arItem);
     }
 }
 if ($bIBlockCatalog) {
     if (!empty($arResult["ELEMENTS"])) {
         $rsRatios = CCatalogMeasureRatio::getList(array(), array('PRODUCT_ID' => $arResult["ELEMENTS"]), false, false, array('PRODUCT_ID', 'RATIO'));
         while ($arRatio = $rsRatios->Fetch()) {
             $arRatio['PRODUCT_ID'] = (int) $arRatio['PRODUCT_ID'];
             if (isset($arElementLink[$arRatio['PRODUCT_ID']])) {
                 $intRatio = (int) $arRatio['RATIO'];
                 $dblRatio = doubleval($arRatio['RATIO']);
                 $mxRatio = $dblRatio > $intRatio ? $dblRatio : $intRatio;
                 if (CATALOG_VALUE_EPSILON > abs($mxRatio)) {
                     $mxRatio = 1;
                 } elseif (0 > $mxRatio) {
                     $mxRatio = 1;
                 }
                 $arElementLink[$arRatio['PRODUCT_ID']]['CATALOG_MEASURE_RATIO'] = $mxRatio;
             }
         }
     }
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例3: GetMessage

        }
        ?>
			</td>
		</tr>
	<?php 
        if (!empty($arAllMeasure)) {
            ?>
		<tr>
			<td width="40%"><?php 
            echo GetMessage("C2IT_MEASURE_RATIO");
            ?>
:</td>
			<td width="60%"><?php 
            $str_CAT_MEASURE_RATIO = 1;
            $CAT_MEASURE_RATIO_ID = 0;
            $db_CAT_MEASURE_RATIO = CCatalogMeasureRatio::getList(array(), array("PRODUCT_ID" => $PRODUCT_ID));
            if ($ar_CAT_MEASURE_RATIO = $db_CAT_MEASURE_RATIO->Fetch()) {
                $str_CAT_MEASURE_RATIO = $ar_CAT_MEASURE_RATIO["RATIO"];
                $CAT_MEASURE_RATIO_ID = $ar_CAT_MEASURE_RATIO["ID"];
            }
            if ($bVarsFromForm) {
                $str_CAT_MEASURE_RATIO = $CAT_MEASURE_RATIO;
            }
            ?>
				<input type="text" <?php 
            if ($bReadOnly || $productIsSet) {
                echo "disabled readonly";
            }
            ?>
 id="CAT_MEASURE_RATIO" name="CAT_MEASURE_RATIO" value="<?php 
            echo htmlspecialcharsbx($str_CAT_MEASURE_RATIO);
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:product_edit.php

示例4: getProductDataToFillBasket


//.........这里部分代码省略.........
					'CODE' => $val['CODE']
				);
			}
			unset($val);
		}
		$arSkuData[] = array(
			"NAME" => "Product XML_ID",
			"CODE" => "PRODUCT.XML_ID",
			"VALUE" => $arElementInfo["~XML_ID"]
		);

		// currency
		$arCurFormat = CCurrencyLang::GetCurrencyFormat($arElementInfo["CURRENCY"]);
		$priceValutaFormat = str_replace("#", "", $arCurFormat["FORMAT_STRING"]);

		$arElementInfo["WEIGHT"] = $arProduct["WEIGHT"];

		// measure
		$arElementInfo["MEASURE_TEXT"] = "";
		if ((int)$arProduct["MEASURE"] > 0)
		{
			$dbMeasure = CCatalogMeasure::GetList(array(), array("ID" => intval($arProduct["MEASURE"])), false, false, array("ID", "SYMBOL_RUS", "SYMBOL_INTL"));
			if ($arMeasure = $dbMeasure->Fetch())
				$arElementInfo["MEASURE_TEXT"] = ($arMeasure["SYMBOL_RUS"] != '' ? $arMeasure["SYMBOL_RUS"] : $arMeasure["SYMBOL_INTL"]);
		}
		if ($arElementInfo["MEASURE_TEXT"] == '')
		{
			$arElementInfo["MEASURE_TEXT"] = ($defaultMeasure["SYMBOL_RUS"] != '' ? $defaultMeasure["SYMBOL_RUS"] : $defaultMeasure["SYMBOL_INTL"]);
		}


		// ratio
		$arElementInfo["RATIO"] = 1;
		$dbratio = CCatalogMeasureRatio::GetList(array(), array("PRODUCT_ID" => $productId));
		if ($arRatio = $dbratio->Fetch())
			$arElementInfo["RATIO"] = $arRatio["RATIO"];

		// image
		if ($arElementInfo["PREVIEW_PICTURE"] > 0)
			$imgCode = $arElementInfo["PREVIEW_PICTURE"];
		elseif ($arElementInfo["DETAIL_PICTURE"] > 0)
			$imgCode = $arElementInfo["DETAIL_PICTURE"];

		if ($imgCode == "" && count($arParent) > 0)
		{
			if ($arParent["PREVIEW_PICTURE"] > 0)
				$imgCode = $arParent["PREVIEW_PICTURE"];
			elseif ($arParent["DETAIL_PICTURE"] > 0)
				$imgCode = $arParent["DETAIL_PICTURE"];
		}

		if ($imgCode > 0)
		{
			$arFile = CFile::GetFileArray($imgCode);
			$arImgProduct = CFile::ResizeImageGet($arFile, array('width'=>80, 'height'=>80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
			if (is_array($arImgProduct))
				$imgUrl = $arImgProduct["src"];
		}

		$arSetInfo = array();
		$arStores = array();

		/** @var $productProvider IBXSaleProductProvider */
		if ($productProvider = CSaleBasket::GetProductProvider(array("MODULE" => $arElementInfo["MODULE"], "PRODUCT_PROVIDER_CLASS" => $arElementInfo["PRODUCT_PROVIDER_CLASS"])))
		{
			// get set items if it is set
开发者ID:akniyev,项目名称:arteva.ru,代码行数:67,代码来源:admin_tool.php

示例5: array

				{
					if ($showCatalogWithOffers || $arRows['E'.$intID]->arRes['CATALOG_TYPE'] != CCatalogProduct::TYPE_SKU)
						$arRows['E'.$intID]->AddViewField('CATALOG_MEASURE', $strMeasure);
					else
						$arRows['E'.$intID]->AddViewField('CATALOG_MEASURE', ' ');
				}
			}
		}
	}
	if (isset($arVisibleColumnsMap['CATALOG_MEASURE_RATIO']))
	{
		$arRatioList = array();
		$rsRatios = CCatalogMeasureRatio::getList(
			array(),
			array('@PRODUCT_ID' => $arElemID),
			false,
			false,
			array('ID', 'PRODUCT_ID', 'RATIO')
		);
		while ($arRatio = $rsRatios->Fetch())
		{
			$arRatio['PRODUCT_ID'] = (int)$arRatio['PRODUCT_ID'];
			$arRatioList[$arRatio['PRODUCT_ID']] = $arRatio['RATIO'];
		}
		if (!empty($arRatioList))
		{
			foreach ($arElemID as &$intOneElemID)
			{
				$arRows['E'.$intOneElemID]->arRes['CATALOG_MEASURE_RATIO'] = (isset($arRatioList[$intOneElemID]) ? $arRatioList[$intOneElemID] : 1);
				if ($showCatalogWithOffers || $arRows['E'.$intOneElemID]->arRes['CATALOG_TYPE'] != CCatalogProduct::TYPE_SKU)
				{
开发者ID:nycmic,项目名称:bittest,代码行数:31,代码来源:iblock_list_admin.php

示例6: doubleval

                        $strError = "Не все модификаторы товара, добавляемые в корзину, заполнены";
                        $successfulAdd = false;
                    }
                }

                if (isset($_REQUEST[$arParams["PRODUCT_QUANTITY_VARIABLE"]]))
                {
                    $QUANTITY = doubleval($_REQUEST[$arParams["PRODUCT_QUANTITY_VARIABLE"]]);
                }

                if (!$QUANTITY)
                {
                    $rsRatios = CCatalogMeasureRatio::getList(
                        array(),
                        array('PRODUCT_ID' => $productID),
                        false,
                        false,
                        array('PRODUCT_ID', 'RATIO')
                    );
                    if ($arRatio = $rsRatios->Fetch())
                    {
                        $intRatio = (int) $arRatio['RATIO'];
                        $dblRatio = doubleval($arRatio['RATIO']);
                        $QUANTITY = ($dblRatio > $intRatio ? $dblRatio : $intRatio);
                    }
                }

                if (!$QUANTITY)
                {
                    $QUANTITY = 1;
                }
开发者ID:phwb,项目名称:ugraweb.iiko,代码行数:31,代码来源:basket_add.php

示例7: array

 $newRatio = true;
 $currentRatioID = 0;
 if (isset($_POST['CAT_MEASURE_RATIO_ID'])) {
     $currentRatioID = (int) $_POST['CAT_MEASURE_RATIO_ID'];
     if ($currentRatioID > 0) {
         $ratioIterator = CCatalogMeasureRatio::getList(array(), array('ID' => $currentRatioID, 'PRODUCT_ID' => $PRODUCT_ID), false, false, array('ID', 'PRODUCT_ID'));
         if ($currentRatio = $ratioIterator->Fetch()) {
             $newRatio = false;
         }
         unset($currentRatio, $ratioIterator);
     }
 }
 if ($newRatio) {
     CCatalogMeasureRatio::add($arMeasureRatio);
 } else {
     CCatalogMeasureRatio::update($currentRatioID, $arMeasureRatio);
 }
 unset($currentRatioID, $newRatio, $arMeasureRatio);
 $intCountBasePrice = count($arCatalogBasePrices);
 for ($i = 0; $i < $intCountBasePrice; $i++) {
     if (strlen($arCatalogBasePrices[$i]["PRICE"]) > 0) {
         $arCatalogFields = array("EXTRA_ID" => false, "PRODUCT_ID" => $PRODUCT_ID, "CATALOG_GROUP_ID" => $arCatalogBaseGroup["ID"], "PRICE" => DoubleVal($arCatalogBasePrices[$i]["PRICE"]), "CURRENCY" => $arCatalogBasePrices[$i]["CURRENCY"], "QUANTITY_FROM" => $arCatalogBasePrices[$i]["QUANTITY_FROM"] > 0 ? $arCatalogBasePrices[$i]["QUANTITY_FROM"] : false, "QUANTITY_TO" => $arCatalogBasePrices[$i]["QUANTITY_TO"] > 0 ? $arCatalogBasePrices[$i]["QUANTITY_TO"] : false);
         if ($arCatalogBasePrices[$i]["ID"] > 0) {
             $arCatalogPrice = CPrice::GetByID($arCatalogBasePrices[$i]["ID"]);
             if ($arCatalogPrice && $arCatalogPrice["PRODUCT_ID"] == $PRODUCT_ID) {
                 $arUpdatedIDs[] = $arCatalogBasePrices[$i]["ID"];
                 if (!CPrice::Update($arCatalogBasePrices[$i]["ID"], $arCatalogFields)) {
                     $strWarning .= str_replace("#ID#", $arCatalogBasePrices[$i]["ID"], GetMessage("C2IT_ERROR_PRPARAMS")) . "<br>";
                 }
             } else {
                 $ID_tmp = CPrice::Add($arCatalogFields);
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:product_edit_action.php

示例8: GetOffersArray


//.........这里部分代码省略.........
				}

				if($element_id > 0)
				{
					$arOffer["LINK_ELEMENT_ID"] = intval($element_id);
					$arOffer["PROPERTIES"] = array();
					$arOffer["DISPLAY_PROPERTIES"] = array();

					$arOffer['CHECK_QUANTITY'] = ('Y' == $arOffer['CATALOG_QUANTITY_TRACE'] && 'N' == $arOffer['CATALOG_CAN_BUY_ZERO']);
					$arOffer['CATALOG_TYPE'] = CCatalogProduct::TYPE_OFFER;
					$arOffer['CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
					$arOffer['~CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
					$arOffer["CATALOG_MEASURE_RATIO"] = 1;
					if (!isset($arOffer['CATALOG_MEASURE']))
						$arOffer['CATALOG_MEASURE'] = 0;
					$arOffer['CATALOG_MEASURE'] = intval($arOffer['CATALOG_MEASURE']);
					if (0 > $arOffer['CATALOG_MEASURE'])
						$arOffer['CATALOG_MEASURE'] = 0;
					if (0 < $arOffer['CATALOG_MEASURE'])
					{
						if (!isset($arMeasureMap[$arOffer['CATALOG_MEASURE']]))
							$arMeasureMap[$arOffer['CATALOG_MEASURE']] = array();
						$arMeasureMap[$arOffer['CATALOG_MEASURE']][] = $intKey;
					}

					$arOfferIDs[] = $arOffer['ID'];
					$arResult[$intKey] = $arOffer;
					$arOffersLink[$arOffer['ID']] = &$arResult[$intKey];
					$intKey++;
				}
			}
			if (!empty($arOfferIDs))
			{
				$rsRatios = CCatalogMeasureRatio::getList(
					array(),
					array('PRODUCT_ID' => $arOfferIDs),
					false,
					false,
					array('PRODUCT_ID', 'RATIO')
				);
				while ($arRatio = $rsRatios->Fetch())
				{
					$arRatio['PRODUCT_ID'] = intval($arRatio['PRODUCT_ID']);
					if (isset($arOffersLink[$arRatio['PRODUCT_ID']]))
					{
						$intRatio = intval($arRatio['RATIO']);
						$dblRatio = doubleval($arRatio['RATIO']);
						$mxRatio = ($dblRatio > $intRatio ? $dblRatio : $intRatio);
						if (CATALOG_VALUE_EPSILON > abs($mxRatio))
							$mxRatio = 1;
						elseif (0 > $mxRatio)
							$mxRatio = 1;
						$arOffersLink[$arRatio['PRODUCT_ID']]['CATALOG_MEASURE_RATIO'] = $mxRatio;
					}
				}

				if (!empty($arSelectProperties))
				{
					CIBlockElement::GetPropertyValuesArray($arOffersLink, $intOfferIBlockID, $arFilter);
					foreach ($arResult as &$arOffer)
					{
						CCatalogDiscount::SetProductPropertiesCache($arOffer['ID'], $arOffer["PROPERTIES"]);
						foreach ($arSelectProperties as $pid)
						{
							if (!isset($arOffer["PROPERTIES"][$pid]))
								continue;
开发者ID:ASDAFF,项目名称:open_bx,代码行数:67,代码来源:comp_pricetools.php

示例9: getRatio

function getRatio($arBasketItems)
{
    if (Loader::includeModule('catalog')) {
        $map = array();
        $arElementId = array();
        foreach ($arBasketItems as $key => $arItem) {
            $arElementId[$arItem["PRODUCT_ID"]] = $arItem["PRODUCT_ID"];
            if (!isset($map[$arItem["PRODUCT_ID"]])) {
                $map[$arItem["PRODUCT_ID"]] = array();
            }
            $map[$arItem["PRODUCT_ID"]][] = $key;
        }
        if (!empty($arElementId)) {
            $dbRatio = CCatalogMeasureRatio::getList(array(), array('PRODUCT_ID' => $arElementId), false, false, array('PRODUCT_ID', 'RATIO'));
            while ($arRatio = $dbRatio->Fetch()) {
                if (empty($map[$arRatio["PRODUCT_ID"]])) {
                    continue;
                }
                foreach ($map[$arRatio["PRODUCT_ID"]] as $key) {
                    $arBasketItems[$key]["MEASURE_RATIO"] = $arRatio["RATIO"];
                }
            }
        }
        unset($arElementId, $map);
    }
    return $arBasketItems;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:27,代码来源:include.php

示例10: getProductDataToFillBasket


//.........这里部分代码省略.........
         if (!empty($arSkuProperty)) {
             foreach ($arSkuProperty as &$val) {
                 $arSkuData[] = array('NAME' => $val['NAME'], 'VALUE' => $val['VALUE'], 'CODE' => $val['CODE']);
             }
             unset($val);
         }
         $arSkuData[] = array("NAME" => "Product XML_ID", "CODE" => "PRODUCT.XML_ID", "VALUE" => $arElementInfo["~XML_ID"]);
         $arElementInfo["WEIGHT"] = $arProduct["WEIGHT"];
         // measure
         $arElementInfo["MEASURE_TEXT"] = "";
         $arElementInfo["MEASURE_CODE"] = 0;
         if ((int) $arProduct["MEASURE"] > 0) {
             if (!empty($proxyCatalogMeasure[$arProduct["MEASURE"]]) && is_array($proxyCatalogMeasure[$arProduct["MEASURE"]])) {
                 $arMeasure = $proxyCatalogMeasure[$arProduct["MEASURE"]];
             } else {
                 $dbMeasure = \CCatalogMeasure::GetList(array(), array("ID" => intval($arProduct["MEASURE"])), false, false, array("ID", "SYMBOL_RUS", "SYMBOL_INTL"));
                 if ($arMeasure = $dbMeasure->Fetch()) {
                     $proxyCatalogMeasure[$arProduct["MEASURE"]] = $arMeasure;
                 }
             }
             if (!empty($arMeasure) && is_array($arMeasure)) {
                 $arElementInfo["MEASURE_TEXT"] = $arMeasure["SYMBOL_RUS"] != '' ? $arMeasure["SYMBOL_RUS"] : $arMeasure["SYMBOL_INTL"];
                 $arElementInfo["MEASURE_CODE"] = $arMeasure["CODE"];
             }
         }
         if ($arElementInfo["MEASURE_TEXT"] == '') {
             $arElementInfo["MEASURE_TEXT"] = $defaultMeasure["SYMBOL_RUS"] != '' ? $defaultMeasure["SYMBOL_RUS"] : $defaultMeasure["SYMBOL_INTL"];
         }
         // ratio
         $arElementInfo["RATIO"] = 1;
         if (!empty($proxyCatalogMeasureRatio[$productId]) && is_array($proxyCatalogMeasureRatio[$productId])) {
             $arRatio = $proxyCatalogMeasureRatio[$productId];
         } else {
             $dbratio = \CCatalogMeasureRatio::GetList(array(), array("PRODUCT_ID" => $productId));
             if ($arRatio = $dbratio->Fetch()) {
                 $proxyCatalogMeasureRatio[$productId] = $arRatio;
             }
         }
         if (!empty($arRatio) && is_array($arRatio)) {
             $arElementInfo["RATIO"] = $arRatio["RATIO"];
         }
         // image
         $imgCode = '';
         $imgUrl = '';
         if ($arElementInfo["PREVIEW_PICTURE"] > 0) {
             $imgCode = $arElementInfo["PREVIEW_PICTURE"];
         } elseif ($arElementInfo["DETAIL_PICTURE"] > 0) {
             $imgCode = $arElementInfo["DETAIL_PICTURE"];
         }
         if ($imgCode == "" && count($arParent) > 0) {
             if ($arParent["PREVIEW_PICTURE"] > 0) {
                 $imgCode = $arParent["PREVIEW_PICTURE"];
             } elseif ($arParent["DETAIL_PICTURE"] > 0) {
                 $imgCode = $arParent["DETAIL_PICTURE"];
             }
         }
         if ($imgCode > 0) {
             $arFile = \CFile::GetFileArray($imgCode);
             $arImgProduct = \CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
             if (is_array($arImgProduct)) {
                 $imgUrl = $arImgProduct["src"];
             }
         }
         $arSetInfo = array();
         $arStores = array();
         /** @var $productProvider IBXSaleProductProvider */
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:orderbasket.php

示例11: setItemsMeasure

 /**
  * Sets measure for all viewed products.
  * @return void
  */
 protected function setItemsMeasure()
 {
     if (!count($this->productIdsMap)) {
         return;
     }
     $measures = $this->data['MEASURE'];
     foreach ($this->items as &$item) {
         if (array_key_exists($item['CATALOG_MEASURE'], $measures)) {
             $measure = $measures[$item['CATALOG_MEASURE']];
             $item['~CATALOG_MEASURE_NAME'] = LANGUAGE_ID == "ru" ? $measure["SYMBOL_RUS"] : $measure["SYMBOL_INTL"];
             $item['CATALOG_MEASURE_NAME'] = String::htmlEncode($item['~CATALOG_MEASURE_NAME']);
         }
     }
     // Ratios
     $ratioIterator = CCatalogMeasureRatio::getList(array(), array('@PRODUCT_ID' => array_values($this->productIdsMap)), false, false, array('PRODUCT_ID', 'RATIO'));
     while ($ratio = $ratioIterator->fetch()) {
         if (isset($this->items[$ratio['PRODUCT_ID']])) {
             $intRatio = intval($ratio['RATIO']);
             $dblRatio = doubleval($ratio['RATIO']);
             $mxRatio = $dblRatio > $intRatio ? $dblRatio : $intRatio;
             if (CATALOG_VALUE_EPSILON > abs($mxRatio)) {
                 $mxRatio = 1;
             } elseif (0 > $mxRatio) {
                 $mxRatio = 1;
             }
             $this->items[$ratio['PRODUCT_ID']]['CATALOG_MEASURE_RATIO'] = $mxRatio;
         }
     }
 }
开发者ID:akniyev,项目名称:arteva.ru,代码行数:33,代码来源:class.php

示例12: GetOffersArray


//.........这里部分代码省略.........
                 $arOffer["DISPLAY_PROPERTIES"] = array();
                 $arOffer['CHECK_QUANTITY'] = 'Y' == $arOffer['CATALOG_QUANTITY_TRACE'] && 'N' == $arOffer['CATALOG_CAN_BUY_ZERO'];
                 $arOffer['CATALOG_TYPE'] = CCatalogProduct::TYPE_OFFER;
                 $arOffer['CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
                 $arOffer['~CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
                 $arOffer["CATALOG_MEASURE_RATIO"] = 1;
                 if (!isset($arOffer['CATALOG_MEASURE'])) {
                     $arOffer['CATALOG_MEASURE'] = 0;
                 }
                 $arOffer['CATALOG_MEASURE'] = (int) $arOffer['CATALOG_MEASURE'];
                 if (0 > $arOffer['CATALOG_MEASURE']) {
                     $arOffer['CATALOG_MEASURE'] = 0;
                 }
                 if (0 < $arOffer['CATALOG_MEASURE']) {
                     if (!isset($arMeasureMap[$arOffer['CATALOG_MEASURE']])) {
                         $arMeasureMap[$arOffer['CATALOG_MEASURE']] = array();
                     }
                     $arMeasureMap[$arOffer['CATALOG_MEASURE']][] = $intKey;
                 }
                 $arOfferIDs[] = $arOffer['ID'];
                 $arResult[$intKey] = $arOffer;
                 if (!isset($arOffersLink[$arOffer['ID']])) {
                     $arOffersLink[$arOffer['ID']] =& $arResult[$intKey];
                 } else {
                     if (!isset($extPrices[$arOffer['ID']])) {
                         $extPrices[$arOffer['ID']] = array();
                     }
                     $extPrices[$arOffer['ID']][] =& $arResult[$intKey];
                 }
                 $intKey++;
             }
         }
         if (!empty($arOfferIDs)) {
             $rsRatios = CCatalogMeasureRatio::getList(array(), array('@PRODUCT_ID' => $arOfferIDs), false, false, array('PRODUCT_ID', 'RATIO'));
             while ($arRatio = $rsRatios->Fetch()) {
                 $arRatio['PRODUCT_ID'] = (int) $arRatio['PRODUCT_ID'];
                 if (isset($arOffersLink[$arRatio['PRODUCT_ID']])) {
                     $intRatio = (int) $arRatio['RATIO'];
                     $dblRatio = (double) $arRatio['RATIO'];
                     $mxRatio = $dblRatio > $intRatio ? $dblRatio : $intRatio;
                     if (CATALOG_VALUE_EPSILON > abs($mxRatio)) {
                         $mxRatio = 1;
                     } elseif (0 > $mxRatio) {
                         $mxRatio = 1;
                     }
                     $arOffersLink[$arRatio['PRODUCT_ID']]['CATALOG_MEASURE_RATIO'] = $mxRatio;
                 }
             }
             if (!empty($arSelectProperties)) {
                 CIBlockElement::GetPropertyValuesArray($arOffersLink, $intOfferIBlockID, $arFilter);
                 foreach ($arResult as &$arOffer) {
                     if (self::$needDiscountCache) {
                         CCatalogDiscount::SetProductPropertiesCache($arOffer['ID'], $arOffer["PROPERTIES"]);
                     }
                     foreach ($arSelectProperties as $pid) {
                         if (!isset($arOffer["PROPERTIES"][$pid])) {
                             continue;
                         }
                         $prop =& $arOffer["PROPERTIES"][$pid];
                         $boolArr = is_array($prop["VALUE"]);
                         if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                             $arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
                         }
                         unset($prop);
                     }
                 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:comp_pricetools.php

示例13: getRatio

function getRatio($arBasketItems)
{
	if (CModule::IncludeModule("catalog"))
	{
		$arElementId = array();
		foreach ($arBasketItems as $arItem)
			$arElementId[] = $arItem["PRODUCT_ID"];

		if (!empty($arElementId))
		{
			$dbRatio = CCatalogMeasureRatio::GetList(array(), array_unique($arElementId));
			while ($arRatio = $dbRatio->GetNext())
			{
				foreach ($arBasketItems as &$basketItem)
				{
					if ($arRatio["PRODUCT_ID"] == $basketItem["PRODUCT_ID"])
						$basketItem["MEASURE_RATIO"] = $arRatio["RATIO"];
				}
			}
			unset($basketItem);

			return $arBasketItems;
		}
	}
}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:25,代码来源:include.php

示例14: array

				if ($arCatalog["SUBSCRIPTION"] == "Y")
				{
					$arFields["PRICE_TYPE"] = $CAT_PRICE_TYPE;
					$arFields["RECUR_SCHEME_TYPE"] = $CAT_RECUR_SCHEME_TYPE;
					$arFields["RECUR_SCHEME_LENGTH"] = $CAT_RECUR_SCHEME_LENGTH;
					$arFields["TRIAL_PRICE_ID"] = $CAT_TRIAL_PRICE_ID;
					$arFields["WITHOUT_ORDER"] = $CAT_WITHOUT_ORDER;
				}
				CCatalogProduct::Add($arFields);

				$arMeasureRatio = array("PRODUCT_ID" => $PRODUCT_ID, "RATIO" => $CAT_MEASURE_RATIO);
				if(isset($CAT_MEASURE_RATIO_ID) && intval($CAT_MEASURE_RATIO_ID) > 0)
					CCatalogMeasureRatio::update($CAT_MEASURE_RATIO_ID, $arMeasureRatio);
				else
					CCatalogMeasureRatio::add($arMeasureRatio);

				$intCountBasePrice = count($arCatalogBasePrices);
				for ($i = 0; $i < $intCountBasePrice; $i++)
				{
					if (strlen($arCatalogBasePrices[$i]["PRICE"]) > 0)
					{
						$arCatalogFields = array(
							"EXTRA_ID" => false,
							"PRODUCT_ID" => $PRODUCT_ID,
							"CATALOG_GROUP_ID" => $arCatalogBaseGroup["ID"],
							"PRICE" => DoubleVal($arCatalogBasePrices[$i]["PRICE"]),
							"CURRENCY" => $arCatalogBasePrices[$i]["CURRENCY"],
							"QUANTITY_FROM" => ($arCatalogBasePrices[$i]["QUANTITY_FROM"] > 0 ? $arCatalogBasePrices[$i]["QUANTITY_FROM"] : False),
							"QUANTITY_TO" => ($arCatalogBasePrices[$i]["QUANTITY_TO"] > 0 ? $arCatalogBasePrices[$i]["QUANTITY_TO"] : False)
						);
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:30,代码来源:product_edit_action.php

示例15: getRatio

function getRatio($arBasketItems)
{
    if (Loader::includeModule('catalog')) {
        static $cacheRatio = array();
        $map = array();
        $arElementId = array();
        foreach ($arBasketItems as $key => $arItem) {
            $hash = md5((!empty($arItem['PRODUCT_PROVIDER_CLASS']) ? $arItem['PRODUCT_PROVIDER_CLASS'] : "") . "|" . (!empty($arItem['MODULE']) ? $arItem['MODULE'] : "") . "|" . $arItem["PRODUCT_ID"]);
            if (array_key_exists($hash, $cacheRatio)) {
                $arBasketItems[$key]["MEASURE_RATIO"] = $cacheRatio[$hash];
            } else {
                $arElementId[$arItem["PRODUCT_ID"]] = $arItem["PRODUCT_ID"];
            }
            if (!isset($map[$arItem["PRODUCT_ID"]])) {
                $map[$arItem["PRODUCT_ID"]] = array();
            }
            $map[$arItem["PRODUCT_ID"]][] = $key;
        }
        if (!empty($arElementId)) {
            $dbRatio = CCatalogMeasureRatio::getList(array(), array('@PRODUCT_ID' => $arElementId), false, false, array('PRODUCT_ID', 'RATIO'));
            while ($arRatio = $dbRatio->Fetch()) {
                if (empty($map[$arRatio["PRODUCT_ID"]])) {
                    continue;
                }
                foreach ($map[$arRatio["PRODUCT_ID"]] as $key) {
                    $arBasketItems[$key]["MEASURE_RATIO"] = $arRatio["RATIO"];
                    $itemData = $arBasketItems[$key];
                    $hash = md5((!empty($itemData['PRODUCT_PROVIDER_CLASS']) ? $itemData['PRODUCT_PROVIDER_CLASS'] : "") . "|" . (!empty($itemData['MODULE']) ? $itemData['MODULE'] : "") . "|" . $itemData["PRODUCT_ID"]);
                    $cacheRatio[$hash] = $arRatio["RATIO"];
                }
                unset($key);
            }
            unset($arRatio, $dbRatio);
        }
        unset($arElementId, $map);
    }
    return $arBasketItems;
}
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:38,代码来源:include.php


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