本文整理汇总了PHP中CPrice::GetListEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CPrice::GetListEx方法的具体用法?PHP CPrice::GetListEx怎么用?PHP CPrice::GetListEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPrice
的用法示例。
在下文中一共展示了CPrice::GetListEx方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetOptimalPrice
//.........这里部分代码省略.........
else
{
$arVAT = array('RATE' => 0.0, 'VAT_INCLUDED' => 'N');
}
$renewal = (($renewal == "N") ? "N" : "Y");
if (false === $siteID)
$siteID = SITE_ID;
if (false === $arDiscountCoupons)
$arDiscountCoupons = CCatalogDiscountCoupon::GetCoupons();
$strBaseCurrency = CCurrency::GetBaseCurrency();
if (empty($strBaseCurrency))
{
$APPLICATION->ThrowException(GetMessage("BT_MOD_CATALOG_PROD_ERR_NO_BASE_CURRENCY"), "NO_BASE_CURRENCY");
return false;
}
$intIBlockID = intval(CIBlockElement::GetIBlockByID($intProductID));
if (0 >= $intIBlockID)
{
$APPLICATION->ThrowException(str_replace("#ID#", $intProductID, GetMessage('BT_MOD_CATALOG_PROD_ERR_ELEMENT_ID_NOT_FOUND')), "NO_ELEMENT");
return false;
}
if (!isset($arPrices) || !is_array($arPrices))
$arPrices = array();
if (empty($arPrices))
{
$arPrices = array();
$dbPriceList = CPrice::GetListEx(
array(),
array(
"PRODUCT_ID" => $intProductID,
"GROUP_GROUP_ID" => $arUserGroups,
"GROUP_BUY" => "Y",
"+<=QUANTITY_FROM" => $quantity,
"+>=QUANTITY_TO" => $quantity
),
false,
false,
array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY")
);
while ($arPriceList = $dbPriceList->Fetch())
{
$arPriceList['ELEMENT_IBLOCK_ID'] = $intIBlockID;
$arPrices[] = $arPriceList;
}
}
else
{
foreach ($arPrices as &$arOnePrice)
{
$arOnePrice['ELEMENT_IBLOCK_ID'] = $intIBlockID;
}
if (isset($arOnePrice))
unset($arOnePrice);
}
if (empty($arPrices))
return false;
// $boolDiscountVat = ('N' != COption::GetOptionString('catalog', 'discount_vat', 'Y'));
示例2: array
}
$arFields = array();
for ($j = 0; $j < $NUM_FIELDS; $j++) {
foreach ($arAvailValueFields_names as $key => $value) {
if (0 == strncmp(${"field_" . $j}, $key . "_", $value['field_name_size'] + 1)) {
$strTempKey = intval(substr(${"field_" . $j}, $value['field_name_size'] + 1));
if (!isset($arFields[$strTempKey])) {
$arFields[$strTempKey] = array("PRODUCT_ID" => $PRODUCT_ID, "CATALOG_GROUP_ID" => $strTempKey, "QUANTITY_FROM" => $quantityFrom, "QUANTITY_TO" => $quantityTo, "TMP_ID" => $tmpid);
}
$arFields[$strTempKey][$value["field"]] = trim($arRes[$j]);
}
}
}
foreach ($arFields as $key => $value) {
$strPriceErr = '';
$res = CPrice::GetListEx(array(), array("PRODUCT_ID" => $value['PRODUCT_ID'], "CATALOG_GROUP_ID" => $value['CATALOG_GROUP_ID'], "QUANTITY_FROM" => $value['QUANTITY_FROM'], "QUANTITY_TO" => $value['QUANTITY_TO']), false, false, array('ID'));
if ($arr = $res->Fetch()) {
$boolEraseClear = false;
if ('Y' == $CLEAR_EMPTY_PRICE) {
$boolEraseClear = isset($value['PRICE']) && '' === $value['PRICE'] && (isset($value['CURRENCY']) && '' === $value['CURRENCY']);
}
if ($boolEraseClear) {
if (!CPrice::Delete($arr["ID"])) {
$strPriceErr = GetMessage('CATI_ERR_PRICE_DELETE');
}
} else {
if (CPrice::Update($arr["ID"], $value)) {
$bUpdatePrice = 'Y';
} else {
if ($ex = $APPLICATION->GetException()) {
$strPriceErr = GetMessage('CATI_ERR_PRICE_UPDATE') . $ex->GetString();
示例3: ReCountFromBase
function ReCountFromBase(&$arFields, &$boolBase)
{
$arBaseGroup = CCatalogGroup::GetBaseGroup();
if (!empty($arBaseGroup))
{
if ($arFields['CATALOG_GROUP_ID'] == $arBaseGroup['ID'])
{
$boolBase = true;
}
else
{
if (!empty($arFields['EXTRA_ID']) && intval($arFields['EXTRA_ID']) > 0)
{
$arExtra = CExtra::GetByID($arFields['EXTRA_ID']);
if (!empty($arExtra))
{
$arFilter = array('PRODUCT_ID' => $arFields['PRODUCT_ID'],'CATALOG_GROUP_ID' => $arBaseGroup['ID']);
if (isset($arFields['QUANTITY_FROM']))
$arFilter['QUANTITY_FROM'] = $arFields['QUANTITY_FROM'];
if (isset($arFields['QUANTITY_TO']))
$arFilter['QUANTITY_TO'] = $arFields['QUANTITY_TO'];
$rsBasePrices = CPrice::GetListEx(
array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC"),
$arFilter,
false,
array('nTopCount' => 1),
array('PRICE','CURRENCY')
);
if ($arBasePrice = $rsBasePrices->Fetch())
{
$arFields['CURRENCY'] = $arBasePrice['CURRENCY'];
$arFields['PRICE'] = RoundEx($arBasePrice["PRICE"] * (1 + DoubleVal($arExtra["PERCENTAGE"])/100), CATALOG_VALUE_PRECISION);
}
else
{
$arFields['EXTRA_ID'] = 0;
}
}
else
{
$arFields['EXTRA_ID'] = 0;
}
}
}
}
}
示例4: getPrices
protected function getPrices($productId, $siteId)
{
$minPrice = 0;
$minPriceRUR = 0;
$minPriceGroup = 0;
$minPriceCurrency = "";
$baseCurrency = \CCurrency::GetBaseCurrency();
$RUR = $this->getRub();
if ($this->xmlData['PRICE'] > 0) {
$rsPrices = \CPrice::GetListEx(array(), array('PRODUCT_ID' => $productId, 'CATALOG_GROUP_ID' => $this->xmlData['PRICE'], 'CAN_BUY' => 'Y', 'GROUP_GROUP_ID' => array(2), '+<=QUANTITY_FROM' => 1, '+>=QUANTITY_TO' => 1));
if ($arPrice = $rsPrices->Fetch()) {
if ($arOptimalPrice = \CCatalogProduct::GetOptimalPrice($productId, 1, array(2), 'N', array($arPrice), $siteId)) {
$minPrice = $arOptimalPrice['DISCOUNT_PRICE'];
$minPriceCurrency = $baseCurrency;
$minPriceRUR = \CCurrencyRates::ConvertCurrency($minPrice, $baseCurrency, $RUR);
$minPriceGroup = $arOptimalPrice['PRICE']['CATALOG_GROUP_ID'];
}
}
} else {
if ($arPrice = \CCatalogProduct::GetOptimalPrice($productId, 1, array(2), 'N', array(), $siteId)) {
$minPrice = $arPrice['DISCOUNT_PRICE'];
$minPriceCurrency = $baseCurrency;
$minPriceRUR = \CCurrencyRates::ConvertCurrency($minPrice, $baseCurrency, $RUR);
$minPriceGroup = $arPrice['PRICE']['CATALOG_GROUP_ID'];
}
}
$result = array("MIN" => $minPrice, "MIN_RUB" => $minPriceRUR, "MIN_GROUP" => $minPriceGroup, "MIN_CURRENCY" => $minPriceCurrency);
return $result;
}
示例5: array
CPrice::Add($arFields);
}
$arPrFilter = array(
"PRODUCT_ID" => $elID,
);
if ($arPrice[$arCatalogGroup["ID"]] >= 0)
{
$arPrFilter["!CATALOG_GROUP_ID"] = $arCatalogGroup["ID"];
$arPrFilter["+QUANTITY_FROM"] = "1";
$arPrFilter["!EXTRA_ID"] = false;
}
$db_res = CPrice::GetListEx(
array(),
$arPrFilter,
false,
false,
array("ID", "PRODUCT_ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO", "EXTRA_ID")
);
while ($ar_res = $db_res->Fetch())
{
$arFields = array(
"PRICE" => $arPrice[$arCatalogGroup["ID"]]*(1+$arCatExtraUp[$ar_res["EXTRA_ID"]]/100) ,
"EXTRA_ID" => $ar_res["EXTRA_ID"],
"CURRENCY" => $arCurrency[$arCatalogGroup["ID"]],
"QUANTITY_FROM" => $ar_res["QUANTITY_FROM"],
"QUANTITY_TO" => $ar_res["QUANTITY_TO"]
);
if ($arFields["PRICE"] <= 0)
CPrice::Delete($ar_res["ID"]);
else
示例6: makeItemsFromDbResult
/**
* @param \CDBResult $dbResultList
* @return array
*/
protected function makeItemsFromDbResult(\CDBResult $dbResultList)
{
$arItemsResult = $arProductIds = array();
while ($arItem = $dbResultList->Fetch()) {
if ($arItem['TYPE'] != 'S') {
$arProductIds[] = $arItem['ID'];
$arItem['PROPERTIES'] = $this->getItemProperies($arItem['ID']);
$arItemsResult[$arItem['ID']] = $arItem;
} else {
$arItemsResult['S' . $arItem['ID']] = $arItem;
}
}
if (!empty($arProductIds)) {
$dbCatalogProduct = \CCatalogProduct::GetList(array(), array('@ID' => $arProductIds));
while ($arCatalogProduct = $dbCatalogProduct->fetch()) {
$arItemsResult[$arCatalogProduct['ID']]['PRODUCT'] = $arCatalogProduct;
}
$offersExistsIds = \CCatalogSKU::getExistOffers($arProductIds, $this->getIblockId());
$noOffersIds = array();
if (empty($offersExistsIds)) {
$noOffersIds = $arProductIds;
} else {
$this->loadAllSku(array_keys(array_filter($offersExistsIds)));
foreach ($offersExistsIds as $id => $bExists) {
$arItem =& $arItemsResult[$id];
if ($bExists) {
$arItem['SKU_ITEMS'] = $this->getProductSku($arItem);
} else {
$noOffersIds[] = $id;
}
}
unset($id, $bExists);
}
if (!empty($noOffersIds)) {
$productRatioList = Catalog\ProductTable::getCurrentRatioWithMeasure($noOffersIds);
if (!empty($productRatioList)) {
foreach ($productRatioList as $productId => $productRatio) {
if (!isset($arItemsResult[$productId]['PRODUCT'])) {
continue;
}
$arItemsResult[$productId]['PRODUCT']['MEASURE_RATIO'] = $productRatio['RATIO'];
$arItemsResult[$productId]['PRODUCT']['MEASURE'] = $productRatio['MEASURE'];
}
unset($productRatio, $productId);
}
unset($productRatioList);
$priceIds = $this->getVisiblePrices();
foreach ($priceIds as $priceId) {
$dbPrice = \CPrice::GetListEx(array(), array('PRODUCT_ID' => $noOffersIds, 'CATALOG_GROUP_ID' => $priceId), false, false, array('PRODUCT_ID', 'PRICE', 'CURRENCY', 'QUANTITY_FROM', 'QUANTITY_TO'));
while ($arPrice = $dbPrice->fetch()) {
$arPrice['QUANTITY_FROM'] = (int) $arPrice['QUANTITY_FROM'];
$arPrice['QUANTITY_TO'] = (int) $arPrice['QUANTITY_TO'];
if (!isset($arItemsResult[$arPrice["PRODUCT_ID"]]['PRICES'][$priceId]) || $arItemsResult[$arPrice["PRODUCT_ID"]]['PRICES'][$priceId]['QUANTITY_FROM'] > $arPrice['QUANTITY_FROM']) {
$arItemsResult[$arPrice["PRODUCT_ID"]]['PRICES'][$priceId] = array('PRICE' => $arPrice['PRICE'], 'CURRENCY' => $arPrice['CURRENCY'], 'QUANTITY_FROM' => $arPrice['QUANTITY_FROM'], 'QUANTITY_TO' => $arPrice['QUANTITY_TO']);
}
}
unset($arPrice, $dbPrice);
}
if ($this->getStoreId()) {
$dbStoreProduct = \CCatalogStoreProduct::GetList(array(), array("PRODUCT_ID" => $noOffersIds, "STORE_ID" => $this->getStoreId()));
while ($arStoreProduct = $dbStoreProduct->Fetch()) {
$arItemsResult[$arStoreProduct["PRODUCT_ID"]]['PRODUCT']['STORE_AMOUNT'] = $arStoreProduct["AMOUNT"];
}
}
$groupsIterator = CCatalogProductSet::getList(array(), array('OWNER_ID' => $noOffersIds, 'SET_ID' => 0, 'TYPE' => \CCatalogProductSet::TYPE_GROUP), false, false, array('ID', 'OWNER_ID', 'ITEM_ID', 'SET_ID', 'TYPE'));
while ($group = $groupsIterator->Fetch()) {
if ($group['OWNER_ID'] == $group['ITEM_ID']) {
$arItemsResult[$group['OWNER_ID']]['PRODUCT']['IS_GROUP'] = true;
}
}
}
}
return $arItemsResult;
}
示例7: OnBeforePrologHandler
//.........这里部分代码省略.........
}
}
}
}
}
}
} elseif ($arProp['PROPERTY_TYPE'] == 'S' || $arProp['PROPERTY_TYPE'] == 'N') {
if ($arProp['MULTIPLE'] == 'Y') {
if (is_array($arProp['~VALUE'])) {
if ($arProp['WITH_DESCRIPTION'] == 'Y') {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']] = array();
foreach ($arProp['~VALUE'] as $propValueKey => $propValue) {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']][] = array('VALUE' => $propValue, 'DESCRIPTION' => $arProp['~DESCRIPTION'][$propValueKey]);
}
unset($propValue, $propValueKey);
} else {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']] = $arProp['~VALUE'];
}
}
} else {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']] = $arProp['WITH_DESCRIPTION'] == 'Y' ? array('VALUE' => $arProp['~VALUE'], 'DESCRIPTION' => $arProp['~DESCRIPTION']) : $arProp['~VALUE'];
}
} else {
$arSrc['PROPERTY_VALUES'][$arProp['CODE']] = $arProp['~VALUE'];
}
}
if (isset($arProp)) {
unset($arProp);
}
AddMessage2Log($arSrc['PROPERTY_VALUES']);
$intNewID = $el->Add($arSrc, true, true, true);
if ($intNewID) {
if ($boolCatalog && $boolCopyCatalog) {
$priceRes = CPrice::GetListEx(array(), array('PRODUCT_ID' => $ID), false, false, array('PRODUCT_ID', 'EXTRA_ID', 'CATALOG_GROUP_ID', 'PRICE', 'CURRENCY', 'QUANTITY_FROM', 'QUANTITY_TO'));
while ($arPrice = $priceRes->Fetch()) {
$arPrice['PRODUCT_ID'] = $intNewID;
CPrice::Add($arPrice);
}
}
if ($boolCatalog && $boolNewCatalog) {
$arProduct = array('ID' => $intNewID);
if ($boolCopyCatalog) {
$productRes = CCatalogProduct::GetList(array(), array('ID' => $ID), false, false, array('QUANTITY', 'QUANTITY_TRACE_ORIG', 'CAN_BUY_ZERO_ORIG', 'NEGATIVE_AMOUNT_TRACE_ORIG', 'SUBSCRIBE_ORIG', 'WEIGHT', 'PRICE_TYPE', 'RECUR_SCHEME_TYPE', 'RECUR_SCHEME_LENGTH', 'TRIAL_PRICE_ID', 'WITHOUT_ORDER', 'SELECT_BEST_PRICE', 'VAT_ID', 'VAT_INCLUDED', 'WIDTH', 'LENGTH', 'HEIGHT', 'PURCHASING_PRICE', 'PURCHASING_CURRENCY', 'MEASURE'));
if ($arCurProduct = $productRes->Fetch()) {
$arProduct = $arCurProduct;
$arProduct['ID'] = $intNewID;
$arProduct['QUANTITY_TRACE'] = $arProduct['QUANTITY_TRACE_ORIG'];
$arProduct['CAN_BUY_ZERO'] = $arProduct['CAN_BUY_ZERO_ORIG'];
$arProduct['NEGATIVE_AMOUNT_TRACE'] = $arProduct['NEGATIVE_AMOUNT_TRACE_ORIG'];
if (isset($arProduct['SUBSCRIBE_ORIG'])) {
$arProduct['SUBSCRIBE'] = $arProduct['SUBSCRIBE_ORIG'];
}
foreach ($arProduct as $productKey => $productValue) {
if ($productValue === null) {
unset($arProduct[$productKey]);
}
}
}
}
CCatalogProduct::Add($arProduct, false);
}
if ($_REQUEST['action'] == 'asd_move') {
if (CASDIblockRights::IsElementDelete($intSrcIBlockID, $ID)) {
$el->Delete($ID);
} else {
CASDiblock::$error .= '[' . $ID . '] ' . GetMessage('ASD_ACTION_ERR_DELETE_ELEMENT_RIGHTS') . "\n";
示例8: GetDiscountByPrice
public function GetDiscountByPrice($productPriceID, $arUserGroups = array(), $renewal = "N", $siteID = false, $arDiscountCoupons = false)
{
global $DB;
global $APPLICATION;
foreach (GetModuleEvents("catalog", "OnGetDiscountByPrice", true) as $arEvent) {
$mxResult = ExecuteModuleEventEx($arEvent, array($productPriceID, $arUserGroups, $renewal, $siteID, $arDiscountCoupons));
if (true !== $mxResult) {
return $mxResult;
}
}
$productPriceID = intval($productPriceID);
if ($productPriceID <= 0) {
$APPLICATION->ThrowException(GetMessage("BT_MOD_CATALOG_DISC_ERR_PRICE_ID_ABSENT"), "NO_PRICE_ID");
return false;
}
if (!is_array($arUserGroups) && intval($arUserGroups) . "|" == $arUserGroups . "|") {
$arUserGroups = array(intval($arUserGroups));
}
if (!is_array($arUserGroups)) {
$arUserGroups = array();
}
if (!in_array(2, $arUserGroups)) {
$arUserGroups[] = 2;
}
$renewal = $renewal == "N" ? "N" : "Y";
if ($siteID === false) {
$siteID = SITE_ID;
}
if ($arDiscountCoupons === false) {
$arDiscountCoupons = CCatalogDiscountCoupon::GetCoupons();
}
$dbPrice = CPrice::GetListEx(array(), array("ID" => $productPriceID), false, false, array("ID", "PRODUCT_ID", "CATALOG_GROUP_ID", "ELEMENT_IBLOCK_ID"));
if ($arPrice = $dbPrice->Fetch()) {
return CCatalogDiscount::GetDiscount($arPrice["PRODUCT_ID"], $arPrice["ELEMENT_IBLOCK_ID"], $arPrice["CATALOG_GROUP_ID"], $arUserGroups, $renewal, $siteID, $arDiscountCoupons);
} else {
$APPLICATION->ThrowException(str_replace("#ID#", $productPriceID, GetMessage("BT_MOD_CATALOG_DISC_ERR_PRICE_ID_NOT_FOUND")), "NO_PRICE");
return false;
}
}
示例9: CatalogGetPriceTableEx
function CatalogGetPriceTableEx($ID, $filterQauntity = 0, $arFilterType = array(), $VAT_INCLUDE = 'Y', $arCurrencyParams = array())
{
global $USER;
static $arPriceTypes = array();
$ID = (int) $ID;
if ($ID <= 0) {
return false;
}
$filterQauntity = (int) $filterQauntity;
if (!is_array($arFilterType)) {
$arFilterType = array($arFilterType);
}
$boolConvert = false;
$strCurrencyID = '';
$arCurrencyList = array();
if (!empty($arCurrencyParams) && is_array($arCurrencyParams) && !empty($arCurrencyParams['CURRENCY_ID'])) {
$boolConvert = true;
$strCurrencyID = $arCurrencyParams['CURRENCY_ID'];
}
$arResult = array();
$arResult["ROWS"] = array();
$arResult["COLS"] = array();
$arResult["MATRIX"] = array();
$arResult["CAN_BUY"] = array();
$arResult["AVAILABLE"] = "N";
$cacheTime = CATALOG_CACHE_DEFAULT_TIME;
if (defined("CATALOG_CACHE_TIME")) {
$cacheTime = intval(CATALOG_CACHE_TIME);
}
$arUserGroups = $USER->GetUserGroupArray();
CatalogClearArray($arUserGroups, true);
$strCacheID = 'UG_' . implode('_', $arUserGroups);
if (isset($arPriceTypes[$strCacheID])) {
$arPriceGroups = $arPriceTypes[$strCacheID];
} else {
$arPriceGroups = CCatalogGroup::GetGroupsPerms($arUserGroups, array());
$arPriceTypes[$strCacheID] = $arPriceGroups;
}
if (empty($arPriceGroups["view"])) {
return $arResult;
}
$currentQuantity = -1;
$rowsCnt = -1;
$arFilter = array("PRODUCT_ID" => $ID);
if ($filterQauntity > 0) {
$arFilter["+<=QUANTITY_FROM"] = $filterQauntity;
$arFilter["+>=QUANTITY_TO"] = $filterQauntity;
}
if (!empty($arFilterType)) {
$arTmp = array();
foreach ($arPriceGroups["view"] as &$intOneGroup) {
if (in_array($intOneGroup, $arFilterType)) {
$arTmp[] = $intOneGroup;
}
}
if (isset($intOneGroup)) {
unset($intOneGroup);
}
if (empty($arTmp)) {
return $arResult;
}
$arFilter["CATALOG_GROUP_ID"] = $arTmp;
} else {
$arFilter["CATALOG_GROUP_ID"] = $arPriceGroups["view"];
}
$productQuantity = 0;
$productQuantityTrace = "N";
$dbRes = CCatalogProduct::GetVATInfo($ID);
if ($arVatInfo = $dbRes->Fetch()) {
$fVatRate = floatval($arVatInfo['RATE'] * 0.01);
$bVatIncluded = $arVatInfo['VAT_INCLUDED'] == 'Y';
} else {
$fVatRate = 0.0;
$bVatIncluded = false;
}
$rsProducts = CCatalogProduct::GetList(array(), array('ID' => $ID), false, false, array('ID', 'CAN_BUY_ZERO', 'QUANTITY_TRACE', 'QUANTITY'));
if ($arProduct = $rsProducts->Fetch()) {
$intIBlockID = CIBlockElement::GetIBlockByID($arProduct['ID']);
if (!$intIBlockID) {
return false;
}
$arProduct['IBLOCK_ID'] = $intIBlockID;
} else {
return false;
}
$dbPrice = CPrice::GetListEx(array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC"), $arFilter, false, false, array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO"));
while ($arPrice = $dbPrice->Fetch()) {
if ($VAT_INCLUDE == 'N') {
if ($bVatIncluded) {
$arPrice['PRICE'] /= 1 + $fVatRate;
}
} else {
if (!$bVatIncluded) {
$arPrice['PRICE'] *= 1 + $fVatRate;
}
}
$arPrice['VAT_RATE'] = $fVatRate;
CCatalogDiscountSave::Disable();
$arDiscounts = CCatalogDiscount::GetDiscount($ID, $arProduct["IBLOCK_ID"], $arPrice["CATALOG_GROUP_ID"], $arUserGroups, "N", SITE_ID, array());
CCatalogDiscountSave::Enable();
//.........这里部分代码省略.........
示例10: array
$str_AVAILABLE = ' available="false"';
else
$str_AVAILABLE = ' available="true"';
$minPrice = 0;
$minPriceRUR = 0;
$minPriceGroup = 0;
$minPriceCurrency = "";
if ($XML_DATA['PRICE'] > 0)
{
$rsPrices = CPrice::GetListEx(array(),array(
'PRODUCT_ID' => $arItem['ID'],
'CATALOG_GROUP_ID' => $XML_DATA['PRICE'],
'CAN_BUY' => 'Y',
'GROUP_GROUP_ID' => array(2),
'+<=QUANTITY_FROM' => 1,
'+>=QUANTITY_TO' => 1,
)
);
if ($arPrice = $rsPrices->Fetch())
{
/* $dbVAT = CCatalogProduct::GetVATInfo($arItem['ID']);
if ($arVat = $dbVAT->Fetch())
{
$arVat['RATE'] = floatval($arVat['RATE'] * 0.01);
}
else
{
$arVat = array('RATE' => 0, 'VAT_INCLUDED' => 'N');
}
示例11: GetDiscountByPrice
public function GetDiscountByPrice($productPriceID, $arUserGroups = array(), $renewal = "N", $siteID = false, $arDiscountCoupons = false)
{
global $APPLICATION;
foreach (GetModuleEvents("catalog", "OnGetDiscountByPrice", true) as $arEvent) {
$mxResult = ExecuteModuleEventEx($arEvent, array($productPriceID, $arUserGroups, $renewal, $siteID, $arDiscountCoupons));
if (true !== $mxResult) {
return $mxResult;
}
}
$productPriceID = (int) $productPriceID;
if ($productPriceID <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("BT_MOD_CATALOG_DISC_ERR_PRICE_ID_ABSENT"), "NO_PRICE_ID");
return false;
}
$dbPrice = CPrice::GetListEx(array(), array("ID" => $productPriceID), false, false, array("ID", "PRODUCT_ID", "CATALOG_GROUP_ID", "ELEMENT_IBLOCK_ID"));
if ($arPrice = $dbPrice->Fetch()) {
return CCatalogDiscount::GetDiscount($arPrice["PRODUCT_ID"], $arPrice["ELEMENT_IBLOCK_ID"], $arPrice["CATALOG_GROUP_ID"], $arUserGroups, $renewal, $siteID, $arDiscountCoupons);
} else {
$APPLICATION->ThrowException(Loc::getMessage('BT_MOD_CATALOG_DISC_ERR_PRICE_ID_NOT_FOUND', array('#ID#' => $productPriceID)), 'NO_PRICE');
return false;
}
}
示例12: GetPrices
public static function GetPrices($arProductID = array(), $priceTypeId = false)
{
$dbRes = false;
if (is_array($arProductID) && !empty($arProductID)) {
if ($priceTypeId === false) {
$priceTypeId = self::getSelectedPriceTypeId();
}
if (intval($priceTypeId) > 0) {
$dbRes = CPrice::GetListEx(array('QUANTITY_FROM' => 'ASC', 'QUANTITY_TO' => 'ASC'), array('PRODUCT_ID' => $arProductID, 'CATALOG_GROUP_ID' => $priceTypeId), false, false, array('ID', 'PRODUCT_ID', 'PRICE', 'CURRENCY'));
}
}
return $dbRes;
}
示例13: GetOptimalPrice
//.........这里部分代码省略.........
return false;
}
if (!is_array($arUserGroups) && (int) $arUserGroups . '|' == (string) $arUserGroups . '|') {
$arUserGroups = array((int) $arUserGroups);
}
if (!is_array($arUserGroups)) {
$arUserGroups = array();
}
if (!in_array(2, $arUserGroups)) {
$arUserGroups[] = 2;
}
$renewal = $renewal == 'Y' ? 'Y' : 'N';
if ($siteID === false) {
$siteID = SITE_ID;
}
$resultCurrency = CCurrency::GetBaseCurrency();
if (empty($resultCurrency)) {
$APPLICATION->ThrowException(Loc::getMessage("BT_MOD_CATALOG_PROD_ERR_NO_BASE_CURRENCY"), "NO_BASE_CURRENCY");
return false;
}
if (self::$usedCurrency !== null) {
$resultCurrency = self::$usedCurrency;
}
$intIBlockID = (int) CIBlockElement::GetIBlockByID($intProductID);
if ($intIBlockID <= 0) {
$APPLICATION->ThrowException(Loc::getMessage('BT_MOD_CATALOG_PROD_ERR_ELEMENT_ID_NOT_FOUND', array('#ID#' => $intProductID)), 'NO_ELEMENT');
return false;
}
if (!isset($arPrices) || !is_array($arPrices)) {
$arPrices = array();
}
if (empty($arPrices)) {
$arPrices = array();
$dbPriceList = CPrice::GetListEx(array(), array("PRODUCT_ID" => $intProductID, "GROUP_GROUP_ID" => $arUserGroups, "GROUP_BUY" => "Y", "+<=QUANTITY_FROM" => $quantity, "+>=QUANTITY_TO" => $quantity), false, false, array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY"));
while ($arPriceList = $dbPriceList->Fetch()) {
$arPriceList['ELEMENT_IBLOCK_ID'] = $intIBlockID;
$arPrices[] = $arPriceList;
}
unset($arPriceList, $dbPriceList);
} else {
foreach ($arPrices as &$arOnePrice) {
$arOnePrice['ELEMENT_IBLOCK_ID'] = $intIBlockID;
}
unset($arOnePrice);
}
if (empty($arPrices)) {
return false;
}
$rsVAT = CCatalogProduct::GetVATInfo($intProductID);
if ($arVAT = $rsVAT->Fetch()) {
$arVAT['RATE'] = (double) $arVAT['RATE'] * 0.01;
} else {
$arVAT = array('RATE' => 0.0, 'VAT_INCLUDED' => 'N');
}
unset($rsVAT);
if (self::getUseDiscount()) {
if ($arDiscountCoupons === false) {
$arDiscountCoupons = CCatalogDiscountCoupon::GetCoupons();
}
}
// $boolDiscountVat = ('N' != COption::GetOptionString('catalog', 'discount_vat', 'Y'));
$boolDiscountVat = true;
$minPrice = false;
$basePrice = false;
$arMinPrice = array();
$arMinDiscounts = array();
示例14: CatalogGetPriceTableEx
//.........这里部分代码省略.........
foreach ($arPriceGroups["view"] as &$intOneGroup)
{
if (in_array($intOneGroup, $arFilterType))
$arTmp[] = $intOneGroup;
}
if (isset($intOneGroup))
unset($intOneGroup);
if (empty($arTmp))
return $arResult;
$arFilter["CATALOG_GROUP_ID"] = $arTmp;
}
else
{
$arFilter["CATALOG_GROUP_ID"] = $arPriceGroups["view"];
}
$productQuantity = 0;
$productQuantityTrace = "N";
$dbRes = CCatalogProduct::GetVATInfo($ID);
if ($arVatInfo = $dbRes->Fetch())
{
$fVatRate = floatval($arVatInfo['RATE'] * 0.01);
$bVatIncluded = $arVatInfo['VAT_INCLUDED'] == 'Y';
}
else
{
$fVatRate = 0.00;
$bVatIncluded = false;
}
$dbPrice = CPrice::GetListEx(
array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC"),
$arFilter,
false,
false,
array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "QUANTITY_FROM", "QUANTITY_TO", "PRODUCT_QUANTITY", "PRODUCT_QUANTITY_TRACE", "PRODUCT_CAN_BUY_ZERO", "ELEMENT_IBLOCK_ID")
);
while ($arPrice = $dbPrice->Fetch())
{
if ($VAT_INCLUDE == 'N')
{
if ($bVatIncluded)
$arPrice['PRICE'] /= (1 + $fVatRate);
}
else
{
if (!$bVatIncluded)
$arPrice['PRICE'] *= (1 + $fVatRate);
}
$arPrice['VAT_RATE'] = $fVatRate;
CCatalogDiscountSave::Disable();
$arDiscounts = CCatalogDiscount::GetDiscount($ID, $arPrice["ELEMENT_IBLOCK_ID"], $arPrice["CATALOG_GROUP_ID"], $arUserGroups, "N", SITE_ID);
CCatalogDiscountSave::Enable();
$discountPrice = CCatalogProduct::CountPriceWithDiscount($arPrice["PRICE"], $arPrice["CURRENCY"], $arDiscounts);
$arPrice["DISCOUNT_PRICE"] = $discountPrice;
$productQuantity = $arPrice["PRODUCT_QUANTITY"];
$productQuantityTrace = $arPrice["PRODUCT_QUANTITY_TRACE"];
$productUseStoreFlag = $arPrice["PRODUCT_CAN_BUY_ZERO"];