本文整理汇总了PHP中CCatalogDiscount::GetDiscountByPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount::GetDiscountByPrice方法的具体用法?PHP CCatalogDiscount::GetDiscountByPrice怎么用?PHP CCatalogDiscount::GetDiscountByPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscount
的用法示例。
在下文中一共展示了CCatalogDiscount::GetDiscountByPrice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
}