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


PHP CCatalogProduct::CountPriceWithDiscount方法代码示例

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


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

示例1: getFavoriteProducts

/**
 * [getFavoriteProducts description]
 * @param  array $arFavorites
 * @return array products
 */
function getFavoriteProducts($arFavorites)
{
    global $USER;
    foreach ($arFavorites as $key => $id) {
        $arSelect = array();
        $arFilter = array("IBLOCK_ID" => 17, "ACTIVE" => "Y", "ID" => $id);
        $res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
        if ($ob = $res->GetNextElement()) {
            $arItems = $ob->GetFields();
            $arItems["PROPERTIES"] = $ob->GetProperties();
            $dbPrice = CPrice::GetList(array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC", "SORT" => "ASC"), array("PRODUCT_ID" => $arItems["ID"]), false, false, array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO"));
            if ($arPrice = $dbPrice->Fetch()) {
                $arDiscounts = CCatalogDiscount::GetDiscountByPrice($arPrice["ID"], $USER->GetUserGroupArray(), "N", SITE_ID);
                $discountPrice = CCatalogProduct::CountPriceWithDiscount($arPrice["PRICE"], $arPrice["CURRENCY"], $arDiscounts);
                $arPrice["DISCOUNT_VALUE"] = $discountPrice;
                $arItems["PRICES"] = $arPrice;
            }
        }
        if ($arItems) {
            $arFav[] = $arItems;
        }
    }
    return $arFav;
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:29,代码来源:functions.php

示例2: array

		    false,
		    false,
		    array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", 
		          "QUANTITY_FROM", "QUANTITY_TO")
		);
		while ($arPrice = $dbPrice->Fetch())
		{
		    $arDiscounts = CCatalogDiscount::GetDiscountByPrice(
		            $arPrice["ID"],
		            $USER->GetUserGroupArray(),
		            "N",
		            SITE_ID
		        );
		    if(count($arDiscounts)){
		    	$discountPrice = CCatalogProduct::CountPriceWithDiscount(
		            $arPrice["PRICE"],
		            $arPrice["CURRENCY"],
		            $arDiscounts
		        );
			    $arPrice["DISCOUNT_PRICE"] = $discountPrice;
		    }else{
		    	$arPrice["DISCOUNT_PRICE"] = $arPrice['PRICE'];
		    }

		    $arFields['PRICE_VALUE'] = $arPrice;
		}
		$arResult['ITEMS'][] = $arFields;
	}
}
$this->IncludeComponentTemplate();
?>
开发者ID:akniyev,项目名称:arteva.ru,代码行数:31,代码来源:component.php

示例3: CatalogGetPriceTable

function CatalogGetPriceTable($ID)
{
    global $USER;
    $ID = (int) $ID;
    if ($ID <= 0) {
        return false;
    }
    $arResult = array();
    $arPriceGroups = array();
    $cacheKey = LANGUAGE_ID . "_" . $USER->GetGroups();
    if (isset($GLOBALS["CATALOG_PRICE_GROUPS_CACHE"]) && is_array($GLOBALS["CATALOG_PRICE_GROUPS_CACHE"]) && isset($GLOBALS["CATALOG_PRICE_GROUPS_CACHE"][$cacheKey]) && is_array($GLOBALS["CATALOG_PRICE_GROUPS_CACHE"][$cacheKey])) {
        $arPriceGroups = $GLOBALS["CATALOG_PRICE_GROUPS_CACHE"][$cacheKey];
    } else {
        $dbPriceGroupsList = CCatalogGroup::GetList(array("SORT" => "ASC"), array("CAN_ACCESS" => "Y", "LID" => LANGUAGE_ID), array("ID", "NAME_LANG", "SORT"), false, array("ID", "NAME_LANG", "CAN_BUY", "SORT"));
        while ($arPriceGroupsList = $dbPriceGroupsList->Fetch()) {
            $arPriceGroups[] = $arPriceGroupsList;
            $GLOBALS["CATALOG_PRICE_GROUPS_CACHE"][$cacheKey][] = $arPriceGroupsList;
        }
    }
    if (empty($arPriceGroups)) {
        return false;
    }
    $arBorderMap = array();
    $arPresentGroups = array();
    $bMultiQuantity = False;
    $dbPrice = CPrice::GetList(array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC", "SORT" => "ASC"), array("PRODUCT_ID" => $ID), false, false, array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO", "ELEMENT_IBLOCK_ID", "SORT"));
    while ($arPrice = $dbPrice->Fetch()) {
        CCatalogDiscountSave::Disable();
        $arDiscounts = CCatalogDiscount::GetDiscount($ID, $arPrice["ELEMENT_IBLOCK_ID"], $arPrice["CATALOG_GROUP_ID"], $USER->GetUserGroupArray(), "N", SITE_ID, array());
        CCatalogDiscountSave::Enable();
        $discountPrice = CCatalogProduct::CountPriceWithDiscount($arPrice["PRICE"], $arPrice["CURRENCY"], $arDiscounts);
        $arPrice["DISCOUNT_PRICE"] = $discountPrice;
        if (array_key_exists($arPrice["QUANTITY_FROM"] . "-" . $arPrice["QUANTITY_TO"], $arBorderMap)) {
            $jnd = $arBorderMap[$arPrice["QUANTITY_FROM"] . "-" . $arPrice["QUANTITY_TO"]];
        } else {
            $jnd = count($arBorderMap);
            $arBorderMap[$arPrice["QUANTITY_FROM"] . "-" . $arPrice["QUANTITY_TO"]] = $jnd;
        }
        $arResult[$jnd]["QUANTITY_FROM"] = DoubleVal($arPrice["QUANTITY_FROM"]);
        $arResult[$jnd]["QUANTITY_TO"] = DoubleVal($arPrice["QUANTITY_TO"]);
        if (DoubleVal($arPrice["QUANTITY_FROM"]) > 0 || DoubleVal($arPrice["QUANTITY_TO"]) > 0) {
            $bMultiQuantity = True;
        }
        $arResult[$jnd]["PRICE"][$arPrice["CATALOG_GROUP_ID"]] = $arPrice;
    }
    $numGroups = count($arPriceGroups);
    for ($i = 0; $i < $numGroups; $i++) {
        $bNeedKill = True;
        for ($j = 0, $intCount = count($arResult); $j < $intCount; $j++) {
            if (!array_key_exists($arPriceGroups[$i]["ID"], $arResult[$j]["PRICE"])) {
                $arResult[$j]["PRICE"][$arPriceGroups[$i]["ID"]] = False;
            }
            if ($arResult[$j]["PRICE"][$arPriceGroups[$i]["ID"]] != false) {
                $bNeedKill = False;
            }
        }
        if ($bNeedKill) {
            for ($j = 0, $intCount = count($arResult); $j < $intCount; $j++) {
                unset($arResult[$j]["PRICE"][$arPriceGroups[$i]["ID"]]);
            }
            unset($arPriceGroups[$i]);
        }
    }
    return array("COLS" => $arPriceGroups, "MATRIX" => $arResult, "MULTI_QUANTITY" => $bMultiQuantity ? "Y" : "N");
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:65,代码来源:include.php

示例4: GetItemPrices

	public static function GetItemPrices($IBLOCK_ID, $arCatalogPrices, $arItem, $bVATInclude = true, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
	{
		$arPrices = array();

		if (empty($arCatalogPrices) || !is_array($arCatalogPrices))
		{
			return $arPrices;
		}

		global $USER;
		static $arCurUserGroups = array();
		static $strBaseCurrency = '';

		if (self::$catalogIncluded === null)
			self::$catalogIncluded = \Freetrix\Main\Loader::includeModule('catalog');
		if (self::$catalogIncluded)
		{
			$USER_ID = intval($USER_ID);
			$intUserID = $USER_ID;
			if (0 >= $intUserID)
				$intUserID = $USER->GetID();
			if (!isset($arCurUserGroups[$intUserID]))
			{
				$arUserGroups = (0 < $USER_ID ? CUser::GetUserGroup($USER_ID) : $USER->GetUserGroupArray());
				CatalogClearArray($arUserGroups);
				$arCurUserGroups[$intUserID] = $arUserGroups;
			}
			else
			{
				$arUserGroups = $arCurUserGroups[$intUserID];
			}

			$boolConvert = false;
			$strCurrencyID = '';
			if (isset($arCurrencyParams['CURRENCY_ID']) && !empty($arCurrencyParams['CURRENCY_ID']))
			{
				$boolConvert = true;
				$strCurrencyID = $arCurrencyParams['CURRENCY_ID'];
			}
			if (!$boolConvert && '' == $strBaseCurrency)
				$strBaseCurrency = CCurrency::GetBaseCurrency();

			$strMinCode = '';
			$boolStartMin = true;
			$dblMinPrice = 0;
			$strMinCurrency = ($boolConvert ? $strCurrencyID : $strBaseCurrency);
			CCatalogDiscountSave::Disable();
			foreach($arCatalogPrices as $key => $value)
			{
				if($value["CAN_VIEW"] && strlen($arItem["CATALOG_PRICE_".$value["ID"]]) > 0)
				{
					// get final price with VAT included.
					if ($arItem['CATALOG_VAT_INCLUDED'] != 'Y')
					{
						$arItem['CATALOG_PRICE_'.$value['ID']] *= (1 + $arItem['CATALOG_VAT'] * 0.01);
					}
					// so discounts will include VAT
					$arDiscounts = CCatalogDiscount::GetDiscount(
						$arItem["ID"],
						$arItem["IBLOCK_ID"],
						array($value["ID"]),
						$arUserGroups,
						"N",
						$LID,
						array()
					);
					$discountPrice = CCatalogProduct::CountPriceWithDiscount(
						$arItem["CATALOG_PRICE_".$value["ID"]],
						$arItem["CATALOG_CURRENCY_".$value["ID"]],
						$arDiscounts
					);
					// get clear prices WO VAT
					$arItem['CATALOG_PRICE_'.$value['ID']] /= (1 + $arItem['CATALOG_VAT'] * 0.01);
					$discountPrice /= (1 + $arItem['CATALOG_VAT'] * 0.01);

					$vat_value_discount = $discountPrice * $arItem['CATALOG_VAT'] * 0.01;
					$vat_discountPrice = $discountPrice + $vat_value_discount;

					$vat_value = $arItem['CATALOG_PRICE_'.$value['ID']] * $arItem['CATALOG_VAT'] * 0.01;
					$vat_price = $arItem["CATALOG_PRICE_".$value["ID"]] + $vat_value;

					if ($boolConvert && $strCurrencyID != $arItem["CATALOG_CURRENCY_".$value["ID"]])
					{
						$strOrigCurrencyID = $arItem["CATALOG_CURRENCY_".$value["ID"]];
						$dblOrigNoVat = $arItem["CATALOG_PRICE_".$value["ID"]];
						$dblNoVat = CCurrencyRates::ConvertCurrency($dblOrigNoVat, $strOrigCurrencyID, $strCurrencyID);
						$dblVatPrice = CCurrencyRates::ConvertCurrency($vat_price, $strOrigCurrencyID, $strCurrencyID);
						$dblVatValue = CCurrencyRates::ConvertCurrency($vat_value, $strOrigCurrencyID, $strCurrencyID);
						$dblDiscountValueNoVat = CCurrencyRates::ConvertCurrency($discountPrice, $strOrigCurrencyID, $strCurrencyID);
						$dblVatDiscountPrice = CCurrencyRates::ConvertCurrency($vat_discountPrice, $strOrigCurrencyID, $strCurrencyID);
						$dblDiscountValueVat = CCurrencyRates::ConvertCurrency($vat_value_discount, $strOrigCurrencyID, $strCurrencyID);

						$arPrices[$key] = array(
							'ORIG_VALUE_NOVAT' => $dblOrigNoVat,
							"VALUE_NOVAT" => $dblNoVat,
							"PRINT_VALUE_NOVAT" => CCurrencyLang::CurrencyFormat($dblNoVat, $strCurrencyID, true),

							'ORIG_VALUE_VAT' => $vat_price,
							"VALUE_VAT" => $dblVatPrice,
							"PRINT_VALUE_VAT" => CCurrencyLang::CurrencyFormat($dblVatPrice, $strCurrencyID, true),
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:open_bx,代码行数:101,代码来源:comp_pricetools.php

示例5: GetItemPrices

	public static function GetItemPrices($IBLOCK_ID, $arCatalogPrices, $arItem, $bVATInclude = true, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
	{
		static $arCurUserGroups = array();

		global $USER;
		$arPrices = array();
		if(CModule::IncludeModule("catalog"))
		{
			$USER_ID = intval($USER_ID);
			$intUserID = $USER_ID;
			if (0 >= $intUserID)
				$intUserID = $USER->GetID();
			if (!array_key_exists($intUserID, $arCurUserGroups))
			{
				$arCurUserGroups[$intUserID] = (0 < $USER_ID ? CUser::GetUserGroup($USER_ID) : $USER->GetUserGroupArray());
			}
			$arUserGroups = $arCurUserGroups[$intUserID];

			$boolConvert = false;
			$strCurrencyID = '';
			if (is_array($arCurrencyParams) && !empty($arCurrencyParams) && !empty($arCurrencyParams['CURRENCY_ID']))
			{
				$boolConvert = true;
				$strCurrencyID = $arCurrencyParams['CURRENCY_ID'];
			}
			foreach($arCatalogPrices as $key => $value)
			{
				if($value["CAN_VIEW"] && strlen($arItem["CATALOG_PRICE_".$value["ID"]]) > 0)
				{
					// get final price with VAT included.
					if ($arItem['CATALOG_VAT_INCLUDED'] != 'Y')
					{
						$arItem['CATALOG_PRICE_'.$value['ID']] *= (1 + $arItem['CATALOG_VAT'] * 0.01);
					}
					CCatalogDiscountSave::Disable();
					// so discounts will include VAT
					$arDiscounts = CCatalogDiscount::GetDiscount(
						$arItem["ID"],
						$arItem["IBLOCK_ID"],
						array($value["ID"]),
						$arUserGroups,
						"N",
						$LID,
						array()
					);
					CCatalogDiscountSave::Enable();
					$discountPrice = CCatalogProduct::CountPriceWithDiscount(
						$arItem["CATALOG_PRICE_".$value["ID"]],
						$arItem["CATALOG_CURRENCY_".$value["ID"]],
						$arDiscounts
					);
					// get clear prices WO VAT
					$arItem['CATALOG_PRICE_'.$value['ID']] /= (1 + $arItem['CATALOG_VAT'] * 0.01);
					$discountPrice /= (1 + $arItem['CATALOG_VAT'] * 0.01);

					$vat_value_discount = $discountPrice * $arItem['CATALOG_VAT'] * 0.01;
					$vat_discountPrice = $discountPrice + $vat_value_discount;

					$vat_value = $arItem['CATALOG_PRICE_'.$value['ID']] * $arItem['CATALOG_VAT'] * 0.01;
					$vat_price = $arItem["CATALOG_PRICE_".$value["ID"]] + $vat_value;

					if ($boolConvert && $strCurrencyID != $arItem["CATALOG_CURRENCY_".$value["ID"]])
					{
						$strOrigCurrencyID = $arItem["CATALOG_CURRENCY_".$value["ID"]];
						$dblOrigNoVat = $arItem["CATALOG_PRICE_".$value["ID"]];
						$dblNoVat = CCurrencyRates::ConvertCurrency($dblOrigNoVat, $strOrigCurrencyID, $strCurrencyID);
						$dblVatPrice = CCurrencyRates::ConvertCurrency($vat_price, $strOrigCurrencyID, $strCurrencyID);
						$dblVatValue = CCurrencyRates::ConvertCurrency($vat_value, $strOrigCurrencyID, $strCurrencyID);
						$dblDiscountValueNoVat = CCurrencyRates::ConvertCurrency($discountPrice, $strOrigCurrencyID, $strCurrencyID);
						$dblVatDiscountPrice = CCurrencyRates::ConvertCurrency($vat_discountPrice, $strOrigCurrencyID, $strCurrencyID);
						$dblDiscountValueVat = CCurrencyRates::ConvertCurrency($vat_value_discount, $strOrigCurrencyID, $strCurrencyID);

						$arPrices[$key] = array(
							'ORIG_VALUE_NOVAT' => $dblOrigNoVat,
							"VALUE_NOVAT" => $dblNoVat,
							"PRINT_VALUE_NOVAT" => FormatCurrency($dblNoVat, $strCurrencyID),

							'ORIG_VALUE_VAT' => $vat_price,
							"VALUE_VAT" => $dblVatPrice,
							"PRINT_VALUE_VAT" => FormatCurrency($dblVatPrice, $strCurrencyID),

							'ORIG_VATRATE_VALUE' => $vat_value,
							"VATRATE_VALUE" => $dblVatValue,
							"PRINT_VATRATE_VALUE" => FormatCurrency($dblVatValue, $strCurrencyID),

							'ORIG_DISCOUNT_VALUE_NOVAT' => $discountPrice,
							"DISCOUNT_VALUE_NOVAT" => $dblDiscountValueNoVat,
							"PRINT_DISCOUNT_VALUE_NOVAT" => FormatCurrency($dblDiscountValueNoVat, $strCurrencyID),

							"ORIG_DISCOUNT_VALUE_VAT" => $vat_discountPrice,
							"DISCOUNT_VALUE_VAT" => $dblVatDiscountPrice,
							"PRINT_DISCOUNT_VALUE_VAT" => FormatCurrency($dblVatDiscountPrice, $strCurrencyID),

							'ORIG_DISCOUNT_VATRATE_VALUE' => $vat_value_discount,
							'DISCOUNT_VATRATE_VALUE' => $dblDiscountValueVat,
							'PRINT_DISCOUNT_VATRATE_VALUE' => FormatCurrency($dblDiscountValueVat, $strCurrencyID),

							'ORIG_CURRENCY' => $strOrigCurrencyID,
							"CURRENCY" => $strCurrencyID,
						);
//.........这里部分代码省略.........
开发者ID:nProfessor,项目名称:Mytb,代码行数:101,代码来源:comp_pricetools.php

示例6: array

 $elementIterator = CIBlockElement::GetList(array(), array("ID" => array_keys($arResult), "IBLOCK_TYPE_ID" => $arParams["IBLOCK_TYPE_ID"]), false, array(), $arSelect);
 unset($arSelect);
 while ($el = $elementIterator->GetNext()) {
     $iProductId = $arResult[$el["ID"]];
     //Если запрос не вернул цену товара, то возможно это товар с торговым предложением, поэтому получаем его базовую цену этого товара
     if ($el["CATALOG_PURCHASING_PRICE"] == "") {
         $arPrice = CPrice::GetBasePrice($iProductId);
         $el["CATALOG_PURCHASING_PRICE"] = $arPrice["PRICE"];
         $el["CATALOG_PURCHASING_CURRENCY"] = $arPrice["CURRENCY"];
     }
     //получаем скидку для товара
     $arDiscounts = CCatalogDiscount::GetDiscountByProduct($iProductId, $USER->GetUserGroupArray(), "N", 1, SITE_ID);
     //получаем цену в зависимости от скидки
     $discountPrice = false;
     if ($arDiscounts) {
         $discountPrice = CCatalogProduct::CountPriceWithDiscount($el["CATALOG_PURCHASING_PRICE"], $el["CATALOG_PURCHASING_CURRENCY"], $arDiscounts);
     }
     // путь к директории, где хранятся изображения
     $imageId = empty($el["DETAIL_PICTURE"]) ? $el["PREVIEW_PICTURE"] : $el["DETAIL_PICTURE"];
     if (!empty($imageId)) {
         /*Неэффективный кусок кода*/
         $sPath = CFile::GetByID($imageId)->GetNext();
         /**********************************/
         $sPath = "/" . $strImageStorePath . "/" . $sPath["SUBDIR"] . "/" . $sPath["FILE_NAME"];
     } else {
         $sPath = "";
     }
     $price = CCurrencyLang::GetCurrencyFormat($el["CATALOG_PURCHASING_CURRENCY"], "ru")["FORMAT_STRING"];
     $arResult[$el["ID"]] = $el;
     $arResult[$el["ID"]]["PRICE"] = str_replace("#", $el["CATALOG_PURCHASING_PRICE"], $price);
     $arResult[$el["ID"]]["PRICE_WITH_DISCOUNT"] = $discountPrice ? str_replace("#", $discountPrice, $price) : "";
开发者ID:lenchv,项目名称:meblya,代码行数:31,代码来源:component.php

示例7: getSpecificationsList

/**
 * [getSpecificationsList description]
 * @param  int $idUser
 * @return array or false
 */
function getSpecificationsList($idUser)
{
    if (!CModule::IncludeModule('iblock')) {
        return false;
    }
    global $USER;
    if ($idUser) {
        $IBLOCK_ID = getIblockSpecifications();
        $rsUser = CUser::GetByID($idUser);
        $arUser = $rsUser->Fetch();
        $arSpecificationsId = $arUser["UF_SPECIFICATIONS"];
        foreach ($arSpecificationsId as $key => $id) {
            $arFilterSec = array('IBLOCK_ID' => $IBLOCK_ID, 'GLOBAL_ACTIVE' => 'Y', "ID" => $id);
            $db_list = CIBlockSection::GetList(array("TIMESTAMP_X" => "DESC"), $arFilterSec, true);
            if ($ar_result = $db_list->GetNext()) {
                $ar_result["ITEMS"] = array();
                $arSelect = array("NAME", "ID", "PROPERTY_PRODUCT", "PROPERTY_COUNT");
                $arFilter = array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y", "SECTION_ID" => $ar_result["ID"]);
                $res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
                while ($ob = $res->GetNextElement()) {
                    $arItem = $ob->GetFields();
                    $arProdSpec = getItemCart($arItem["PROPERTY_PRODUCT_VALUE"]);
                    if ($arProdSpec && $arItem["PROPERTY_PRODUCT_VALUE"]) {
                        $arItem["PRODUCT"] = $arProdSpec;
                        $dbPrice = CPrice::GetList(array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC", "SORT" => "ASC"), array("PRODUCT_ID" => $arItem["PROPERTY_PRODUCT_VALUE"]), false, false, array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO"));
                        if ($arPrice = $dbPrice->Fetch()) {
                            $arDiscounts = CCatalogDiscount::GetDiscountByPrice($arPrice["ID"], $USER->GetUserGroupArray(), "N", SITE_ID);
                            $discountPrice = CCatalogProduct::CountPriceWithDiscount($arPrice["PRICE"], $arPrice["CURRENCY"], $arDiscounts);
                            $arPrice["DISCOUNT_PRICE"] = $discountPrice;
                            $arItem["DISCOUNT"] = $arPrice;
                        }
                        $ar_result["ITEMS"][] = $arItem;
                    } elseif (!$arItem["PROPERTY_PRODUCT_VALUE"]) {
                        $arParams["product"] = $arItem["ID"];
                        removeItemSpecification($arParams);
                    }
                }
                $arSections[] = $ar_result;
            }
        }
        return $arSections;
    }
    return false;
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:49,代码来源:specifications.php

示例8: getSeoProducts

/**
 * [getSeoProducts description]
 * @param  array $arParams
 * @return array
 */
function getSeoProducts($arParams)
{
    global $USER;
    $arSelect = array();
    $arFilter = array("IBLOCK_ID" => 22, "ACTIVE" => "Y", "ID" => $arParams["ID"]);
    $res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
    if ($ob = $res->GetNextElement()) {
        $seo_items = $ob->GetFields();
        $seo_items["PROPERTIES"] = $ob->GetProperties();
        foreach ($seo_items["PROPERTIES"]["PRODUCTS"]["VALUE"] as $key => $idProd) {
            $arSelectProd = array("ID", "NAME", "PREVIEW_PICTURE", "PROPERTY_ARTIKUL", "PROPERTY_PRICE", "PROPERTY_OLD_PRICE", "PROPERTY_NEW", "PROPERTY_HIT", "PROPERTY_SALE", "DETAIL_PAGE_URL");
            $arFilterProd = array("IBLOCK_ID" => 17, "ACTIVE" => "Y", "ID" => $idProd);
            $resProd = CIBlockElement::GetList(array(), $arFilterProd, false, false, $arSelectProd);
            while ($obProd = $resProd->GetNextElement()) {
                $arItem = $obProd->GetFields();
                $dbPrice = CPrice::GetList(array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC", "SORT" => "ASC"), array("PRODUCT_ID" => $arItem["ID"]), false, false, array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO"));
                if ($arPrice = $dbPrice->Fetch()) {
                    $arDiscounts = CCatalogDiscount::GetDiscountByPrice($arPrice["ID"], $USER->GetUserGroupArray(), "N", SITE_ID);
                    $discountPrice = CCatalogProduct::CountPriceWithDiscount($arPrice["PRICE"], $arPrice["CURRENCY"], $arDiscounts);
                    $arPrice["DISCOUNT_VALUE"] = $discountPrice;
                    $arItem["PRICES"] = $arPrice;
                }
                $arProducts[] = $arItem;
            }
        }
        return $arProducts;
    }
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:33,代码来源:functions.php

示例9: getFinalPriceInCurrency

function getFinalPriceInCurrency($item_id, $sale_currency = 'UAH')
{
    global $USER;
    // Do item have offers?
    if (CCatalogSku::IsExistOffers($item_id)) {
        // Find price in offers
        $res = CIBlockElement::GetByID($item_id);
        if ($ar_res = $res->GetNext()) {
            if (isset($ar_res['IBLOCK_ID']) && $ar_res['IBLOCK_ID']) {
                // Find all offers
                $offers = CIBlockPriceTools::GetOffersArray(array('IBLOCK_ID' => $ar_res['IBLOCK_ID'], 'HIDE_NOT_AVAILABLE' => 'Y', 'CHECK_PERMISSIONS' => 'Y'), array($item_id), null, null, null, null, null, null, array('CURRENCY_ID' => $sale_currency), $USER->getId(), null);
                foreach ($offers as $offer) {
                    $price = CCatalogProduct::GetOptimalPrice($offer['ID'], 1, $USER->GetUserGroupArray(), 'N');
                    if (isset($price['PRICE'])) {
                        if ($price['PRICE']['CURRENCY'] != $sale_currency) {
                            $price['PRICE']['PRICE'] = CCurrencyRates::ConvertCurrency($price['PRICE']['PRICE'], $price['PRICE']['CURRENCY'], $sale_currency);
                            $price['PRICE']['CURRENCY'] = $sale_currency;
                        }
                        $price['PRICE']['PRICE_WITH_DISCOUNT'] = $price['PRICE']['PRICE'];
                        $currency_code = $price['PRICE']['CURRENCY'];
                        // Find discounts and calculate price with discounts
                        $arDiscounts = CCatalogDiscount::GetDiscountByProduct($item_id, $USER->GetUserGroupArray(), "N");
                        if (is_array($arDiscounts) && sizeof($arDiscounts) > 0) {
                            $price['PRICE']['PRICE_WITH_DISCOUNT'] = CCatalogProduct::CountPriceWithDiscount($price['PRICE']['PRICE_WITH_DISCOUNT'], $sale_currency, $arDiscounts);
                        }
                        // Stop cycle, use found value
                        break;
                    }
                }
            }
        }
    } else {
        // Simple product, not trade offers
        $price = CCatalogProduct::GetOptimalPrice($item_id, 1, $USER->GetUserGroupArray(), 'N');
        // Got price?
        if (!$price || !isset($price['PRICE'])) {
            return false;
        }
        if ($price['PRICE']['CURRENCY'] != $sale_currency) {
            $price['PRICE']['PRICE'] = CCurrencyRates::ConvertCurrency($price['PRICE']['PRICE'], $price['PRICE']['CURRENCY'], $sale_currency);
            $price['DISCOUNT_PRICE'] = CCurrencyRates::ConvertCurrency($price['DISCOUNT_PRICE'], $price['PRICE']['CURRENCY'], $sale_currency);
            $price['PRICE']['CURRENCY'] = $sale_currency;
        }
        // Change currency code if found
        if (isset($price['CURRENCY'])) {
            $currency_code = $price['CURRENCY'];
        }
        if (isset($price['PRICE']['CURRENCY'])) {
            $currency_code = $price['PRICE']['CURRENCY'];
        }
        // Get final price
        $price['PRICE']['PRICE_WITH_DISCOUNT'] = $price['DISCOUNT_PRICE'];
        // Find discounts and calculate price with discounts
        $arDiscounts = CCatalogDiscount::GetDiscountByProduct($item_id, $USER->GetUserGroupArray(), "N", 2);
        if (is_array($arDiscounts) && sizeof($arDiscounts) > 0) {
            $price['PRICE']['PRICE_WITH_DISCOUNT'] = CCatalogProduct::CountPriceWithDiscount($price['PRICE']['PRICE_WITH_DISCOUNT'], $sale_currency, $arDiscounts);
        }
    }
    // Convert to sale currency if needed
    if ($currency_code != $sale_currency) {
        $price['PRICE']['PRICE_WITH_DISCOUNT'] = CCurrencyRates::ConvertCurrency($price['PRICE']['PRICE_WITH_DISCOUNT'], $sale_currency, $sale_currency);
    }
    return $price;
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:64,代码来源:complects.php


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