本文整理汇总了PHP中CCatalogDiscount类的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount类的具体用法?PHP CCatalogDiscount怎么用?PHP CCatalogDiscount使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCatalogDiscount类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
if ($arSect = $dbSect->Fetch()) {
$sofasSectId = $arSect["ID"];
}
}
$dbSite = CSite::GetByID(WIZARD_SITE_ID);
if ($arSite = $dbSite->Fetch()) {
$lang = $arSite["LANGUAGE_ID"];
}
$defCurrency = "EUR";
if ($lang == "ru") {
$defCurrency = "RUB";
} elseif ($lang == "en") {
$defCurrency = "USD";
}
$arF = array("SITE_ID" => WIZARD_SITE_ID, "ACTIVE" => "Y", "RENEWAL" => "N", "NAME" => GetMessage("WIZ_DISCOUNT"), "SORT" => 100, "MAX_DISCOUNT" => 0, "VALUE_TYPE" => "P", "VALUE" => 10, "CURRENCY" => $defCurrency, "CONDITIONS" => array("CLASS_ID" => "CondGroup", "DATA" => array("All" => "OR", "True" => "True"), "CHILDREN" => array(array("CLASS_ID" => "CondIBSection", "DATA" => array("logic" => "Equal", "value" => $sofasSectId)))));
CCatalogDiscount::Add($arF);
}
//precet
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => "SALELEADER"));
$arFields = array();
while ($arProperty = $dbProperty->GetNext()) {
$arFields["find_el_property_" . $arProperty["ID"]] = "";
}
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => "NEWPRODUCT"));
while ($arProperty = $dbProperty->GetNext()) {
$arFields["find_el_property_" . $arProperty["ID"]] = "";
}
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => "SPECIALOFFER"));
while ($arProperty = $dbProperty->GetNext()) {
$arFields["find_el_property_" . $arProperty["ID"]] = "";
}
示例2: OnBasketAddHandler
function OnBasketAddHandler($ID, $arFields)
{
global $USER;
\Bitrix\Main\Loader::includeModule('catalog');
\Bitrix\Main\Loader::includeModule('sale');
if ($USER->IsAuthorized()) {
$arFilter = array("USER_ID" => $USER->GetID());
$db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
$arrCount = [];
while ($ar_sales = $db_sales->Fetch()) {
$arrCount[] = $ar_sales;
}
if (is_array($arrCount) == false) {
$res = CCatalogDiscount::SetCoupon('SL-CDUEA-HI8MMPY');
//3%
} else {
if (count($arrCount) >= 1) {
$resClean = CCatalogDiscount::ClearCoupon('SL-CDUEA-HI8MMPY');
$res5 = CCatalogDiscount::SetCoupon('SL-0JG2C-XIHBEYZ');
//5%
} else {
}
}
} else {
$res = CCatalogDiscountCoupon::SetCoupon('SL-CDUEA-HI8MMPY');
//3%
}
}
示例3: getAllDiscountByID
/**
* get all discount by product id
*/
function getAllDiscountByID($PRODUCT_ID)
{
global $DB;
global $APPLICATION;
$dbProductDiscounts = CCatalogDiscount::GetList(array("SORT" => "ASC"), array("+PRODUCT_ID" => $PRODUCT_ID, "ACTIVE" => "Y", "!>ACTIVE_FROM" => $DB->FormatDate(date("Y-m-d H:i:s"), "YYYY-MM-DD HH:MI:SS", CSite::GetDateFormat("FULL")), "!<ACTIVE_TO" => $DB->FormatDate(date("Y-m-d H:i:s"), "YYYY-MM-DD HH:MI:SS", CSite::GetDateFormat("FULL")), "COUPON" => ""), false, false, array("ID", "SITE_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "RENEWAL", "NAME", "SORT", "MAX_DISCOUNT", "VALUE_TYPE", "VALUE", "CURRENCY", "PRODUCT_ID"));
$arrAllDiscounts = array();
while ($arProductDiscounts = $dbProductDiscounts->Fetch()) {
$arrAllDiscounts[] = $arProductDiscounts;
}
return $arrAllDiscounts;
}
示例4: 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;
}
示例5: CAdminContextMenu
"WARNING" => "Y"
);
}
$context = new CAdminContextMenu($aMenu);
$context->Show();
if ($errorMessage !== '')
CAdminMessage::ShowMessage($errorMessage);
$filterDiscount = array();
if ($ID > 0)
$filterDiscount = array('ID' => $arCoupon['DISCOUNT_ID']);
$arDiscountList = array();
$rsDiscounts = CCatalogDiscount::GetList(
array("NAME" => "ASC"),
$filterDiscount,
false,
false,
array("ID", "SITE_ID", "NAME")
);
while ($arDiscount = $rsDiscounts->Fetch())
{
$arDiscountList[$arDiscount['ID']] = "[".$arDiscount["ID"]."] ".$arDiscount["NAME"]." (".$arDiscount["SITE_ID"].")";
}
$arTypeList = CCatalogDiscountCoupon::GetCoupontTypes(true);
$tabControl->BeginPrologContent();
$tabControl->EndPrologContent();
$tabControl->BeginEpilogContent();
echo GetFilterHiddens("filter_");?>
示例6: 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");
}
示例7: array
while($arFields = $res->GetNext())
{
$dbPrice = CPrice::GetList(
array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC",
"SORT" => "ASC"),
array("PRODUCT_ID" => $arFields['ID']),
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;
}
示例8: GetOptimalPrice
//.........这里部分代码省略.........
$quantity = doubleval($quantity);
if (0 >= $quantity)
{
$APPLICATION->ThrowException(GetMessage("BT_MOD_CATALOG_PROD_ERR_QUANTITY_ABSENT"), "NO_QUANTITY");
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;
$rsVAT = CCatalogProduct::GetVATInfo($intProductID);
if ($arVAT = $rsVAT->Fetch())
{
$arVAT['RATE'] = doubleval($arVAT['RATE'] * 0.01);
}
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,
示例9: while
while ($oneSite = $siteIterator->fetch()) {
$arSiteList[$oneSite['LID']] = $oneSite['LID'];
$arSiteLinkList[$oneSite['LID']] = '<a href="/bitrix/admin/site_edit.php?lang=' . LANGUAGE_ID . '&LID=' . $oneSite['LID'] . '" title="' . GetMessage('BT_CAT_DISCOUNT_ADM_MESS_SITE_ID') . '">' . $oneSite['LID'] . '</a>';
}
unset($oneSite, $siteIterator);
}
$arCurrencyList = array();
if ($arSelectFieldsMap['CURRENCY']) {
$currencyList = array_keys(Currency\CurrencyManager::getCurrencyList());
foreach ($currencyList as $currency) {
$arCurrencyList[$currency] = $currency;
}
unset($currencyList);
}
$arNavParams = isset($_REQUEST['mode']) && 'excel' == $_REQUEST["mode"] ? false : array("nPageSize" => CAdminResult::GetNavSize($sTableID));
$dbResultList = CCatalogDiscount::GetList(array($by => $order), $arFilter, false, $arNavParams, $arSelectFields);
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("DSC_NAV")));
$arUserList = array();
$arUserID = array();
$nameFormat = CSite::GetNameFormat(true);
$arRows = array();
while ($arDiscount = $dbResultList->Fetch()) {
$arDiscount['ID'] = (int) $arDiscount['ID'];
if ($arSelectFieldsMap['CREATED_BY']) {
$arDiscount['CREATED_BY'] = (int) $arDiscount['CREATED_BY'];
if ($arDiscount['CREATED_BY'] > 0) {
$arUserID[$arDiscount['CREATED_BY']] = true;
}
}
示例10: __OnElementDiscount
function __OnElementDiscount($arFields)
{
$ProductPrc = false;
$PropID = false;
$res = CIBlockElement::GetProperty($arFields['IBLOCK_ID'],$arFields['ID'], "sort", "asc", array("CODE" => "DISCOUNT", 'EMPTY' => 'N'));
if ($ob = $res->GetNext())
{
$PropID = $ob['ID'];
$ProductPrc = $ob['VALUE'];
}
if($ProductPrc)
{
CModule::IncludeModule('catalog');
$dbProductDiscounts = CCatalogDiscount::GetList(
array(),
array(
"ACTIVE" => "Y",
"VALUE" => $ProductPrc,
"XML_ID" => 'IB_PROPERTY_'.$ProductPrc,
),
false,
false,
array(
"ID", "VALUE"
)
);
if (!$dbProductDiscounts->Fetch())
{
$arDiscountFields = Array(
'SITE_ID' => 's1',
'ACTIVE' => 'Y',
'RENEWAL' => 'N',
'XML_ID' => 'IB_PROPERTY_'.$ProductPrc,
'NAME' => 'Скидка по свойству - '.$ProductPrc.'%',
'SORT' => 100,
'VALUE_TYPE' => 'P',
'VALUE' => $ProductPrc,
'CURRENCY' => 'RUB',
'PRIORITY' => 1,
'LAST_DISCOUNT' => 'N',
'GROUP_IDS' => Array(),
'CATALOG_GROUP_IDS' => Array(),
'CONDITIONS' => Array(
'CLASS_ID' => 'CondGroup',
'DATA' => Array(
'All' => 'AND',
'True' => 'True'
),
'CHILDREN' => Array(
Array(
'CLASS_ID' => 'CondIBIBlock',
'DATA' => Array(
'logic' => 'Equal',
'value' => $arFields['IBLOCK_ID']
)
),
Array(
'CLASS_ID' => 'CondIBProp:'.$arFields['IBLOCK_ID'].':'.$PropID,
'DATA' => Array(
'logic' => 'Equal',
'value' => $ProductPrc
)
)
)
)
);
$ID = CCatalogDiscount::Add($arDiscountFields);
}
}
}
示例11: __UpdateOldEntities
protected function __UpdateOldEntities($ID, &$arFields, $boolUpdate)
{
$ID = intval($ID);
if (0 >= $ID) {
return;
}
CCatalogDiscount::__UpdateOldOneEntity($ID, $arFields, array('ENTITY_ID' => 'IBLOCK_IDS', 'TABLE_ID' => 'b_catalog_discount2iblock', 'FIELD_ID' => 'IBLOCK_ID'), $boolUpdate);
CCatalogDiscount::__UpdateOldOneEntity($ID, $arFields, array('ENTITY_ID' => 'SECTION_IDS', 'TABLE_ID' => 'b_catalog_discount2section', 'FIELD_ID' => 'SECTION_ID'), $boolUpdate);
CCatalogDiscount::__UpdateOldOneEntity($ID, $arFields, array('ENTITY_ID' => 'PRODUCT_IDS', 'TABLE_ID' => 'b_catalog_discount2product', 'FIELD_ID' => 'PRODUCT_ID'), $boolUpdate);
}
示例12: 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,
);
//.........这里部分代码省略.........
示例13: CheckDiscount
public function CheckDiscount($arProduct, $arDiscount)
{
if (empty($arProduct) || !is_array($arProduct)) {
return false;
}
if (empty($arDiscount) || !is_array($arDiscount) || !isset($arDiscount['UNPACK'])) {
return false;
}
return CCatalogDiscount::__Unpack($arProduct, $arDiscount['UNPACK']);
}
示例14: getBitrixDiscounts
public function getBitrixDiscounts()
{
return \CCatalogDiscount::GetDiscountByProduct($this->getProduct()->id);
}
示例15: array
if (!empty($arResult)) {
$arIblockId = array();
$strImageStorePath = COption::GetOptionString("main", "upload_dir", "upload");
$arSelect = array("ID", "NAME", "IBLOCK_SECTION_ID", "IBLOCK_TYPE_ID", "IBLOCK_ID", "DETAIL_PAGE_URL", "CATALOG_GROUP_RETAIL", "PREVIEW_PICTURE", "DETAIL_PICTURE");
$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 = "";
}