• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CCatalogDiscount类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了CCatalogDiscount类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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"]] = "";
 }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:catalog3.php


示例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%
    }
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:28,代码来源:CCatalogDiscount.php


示例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;
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:14,代码来源:getAllDiscountByID.php


示例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;
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:29,代码来源:functions.php


示例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_");?>
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:cat_discount_coupon_edit.php


示例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");
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:65,代码来源:include.php


示例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;
		}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:32,代码来源:component.php


示例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,
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:product.php


示例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;
        }
    }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:cat_discount_admin.php


示例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);
		}
	}
}
开发者ID:screate,项目名称:discount,代码行数:72,代码来源:discounts.php


示例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);
 }
开发者ID:rasuldev,项目名称:torino,代码行数:10,代码来源:discount.php


示例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,
						);
//.........这里部分代码省略.........
开发者ID:nProfessor,项目名称:Mytb,代码行数:101,代码来源:comp_pricetools.php


示例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']);
 }
开发者ID:rasuldev,项目名称:torino,代码行数:10,代码来源:discount.php


示例14: getBitrixDiscounts

 public function getBitrixDiscounts()
 {
     return \CCatalogDiscount::GetDiscountByProduct($this->getProduct()->id);
 }
开发者ID:AlexSmerw,项目名称:domino,代码行数:4,代码来源:CartItem.class.php


示例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 = "";
         }
开发者ID:lenchv,项目名称:meblya,代码行数:31,代码来源:component.php


示例16: getItems

 /**
  * Get items for view.
  * @return mixed[]  array('ID' => array(), 'ID' => array(), ...)
  */
 protected function getItems()
 {
     if (empty($this->productIdsMap) || empty($this->arParams['SHOW_PRODUCTS'])) {
         return array();
     }
     $elementIterator = CIBlockElement::GetList(array(), $this->filter, false, false, $this->selectFields);
     $elementIterator->SetUrlTemplates($this->arParams["DETAIL_URL"]);
     $defaultMeasure = $this->data['DEFAULT_MEASURE'];
     $items = array();
     while ($elementObj = $elementIterator->GetNextElement()) {
         $item = $elementObj->GetFields();
         $item['ID'] = intval($item['ID']);
         $item['ACTIVE_FROM'] = $item['DATE_ACTIVE_FROM'];
         $item['ACTIVE_TO'] = $item['DATE_ACTIVE_TO'];
         // Inherited Properties
         $ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($item["IBLOCK_ID"], $item["ID"]);
         $item["IPROPERTY_VALUES"] = $ipropValues->getValues();
         $item["PREVIEW_PICTURE"] = 0 < $item["PREVIEW_PICTURE"] ? CFile::GetFileArray($item["PREVIEW_PICTURE"]) : false;
         if ($item["PREVIEW_PICTURE"]) {
             $item["PREVIEW_PICTURE"]["ALT"] = $item["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"];
             if ($item["PREVIEW_PICTURE"]["ALT"] == "") {
                 $item["PREVIEW_PICTURE"]["ALT"] = $item["NAME"];
             }
             $item["PREVIEW_PICTURE"]["TITLE"] = $item["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"];
             if ($item["PREVIEW_PICTURE"]["TITLE"] == "") {
                 $item["PREVIEW_PICTURE"]["TITLE"] = $item["NAME"];
             }
         }
         $item["DETAIL_PICTURE"] = 0 < $item["DETAIL_PICTURE"] ? CFile::GetFileArray($item["DETAIL_PICTURE"]) : false;
         if ($item["DETAIL_PICTURE"]) {
             $item["DETAIL_PICTURE"]["ALT"] = $item["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"];
             if ($item["DETAIL_PICTURE"]["ALT"] == "") {
                 $item["DETAIL_PICTURE"]["ALT"] = $item["NAME"];
             }
             $item["DETAIL_PICTURE"]["TITLE"] = $item["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"];
             if ($item["DETAIL_PICTURE"]["TITLE"] == "") {
                 $item["DETAIL_PICTURE"]["TITLE"] = $item["NAME"];
             }
         }
         $itemIblockId = (int) $item['IBLOCK_ID'];
         $needItemProperties = isset($this->arParams['PROPERTY_CODE'][$itemIblockId]) && !empty($this->arParams['PROPERTY_CODE'][$itemIblockId]) || isset($this->arParams['ADDITIONAL_PICT_PROP'][$itemIblockId]) || isset($this->arParams['LABEL_PROP'][$itemIblockId]);
         $item["PROPERTIES"] = array();
         $item["DISPLAY_PROPERTIES"] = array();
         if ($needItemProperties) {
             $item["PROPERTIES"] = $elementObj->getProperties();
             CCatalogDiscount::SetProductPropertiesCache($item['ID'], $item["PROPERTIES"]);
         }
         if (isset($this->arParams['PROPERTY_CODE'][$item['IBLOCK_ID']])) {
             $properties = $this->arParams['PROPERTY_CODE'][$item['IBLOCK_ID']];
             foreach ($properties as $propertyName) {
                 if (!isset($item["PROPERTIES"][$propertyName])) {
                     continue;
                 }
                 $prop =& $item["PROPERTIES"][$propertyName];
                 $boolArr = is_array($prop["VALUE"]);
                 if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                     $item["DISPLAY_PROPERTIES"][$propertyName] = CIBlockFormatProperties::GetDisplayValue($item, $prop, "catalog_out");
                 }
             }
         }
         $item["PRODUCT_PROPERTIES"] = array();
         $item['PRODUCT_PROPERTIES_FILL'] = array();
         if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($this->arParams['CART_PROPERTIES'][$item['IBLOCK_ID']])) {
             $item["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($item['IBLOCK_ID'], $item["ID"], $this->arParams['CART_PROPERTIES'][$item['IBLOCK_ID']], $item["PROPERTIES"]);
             if (!empty($item["PRODUCT_PROPERTIES"])) {
                 $item['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($item['PRODUCT_PROPERTIES']);
             }
         }
         if (!isset($item["CATALOG_MEASURE_RATIO"])) {
             $item["CATALOG_MEASURE_RATIO"] = 1;
         }
         if (!isset($item['CATALOG_MEASURE'])) {
             $item['CATALOG_MEASURE'] = 0;
         }
         $item['CATALOG_MEASURE'] = intval($item['CATALOG_MEASURE']);
         if (0 > $item['CATALOG_MEASURE']) {
             $item['CATALOG_MEASURE'] = 0;
         }
         if (!isset($item['CATALOG_MEASURE_NAME'])) {
             $item['CATALOG_MEASURE_NAME'] = '';
         }
         $item['CATALOG_MEASURE_NAME'] = $defaultMeasure['SYMBOL_RUS'];
         $item['~CATALOG_MEASURE_NAME'] = $defaultMeasure['~SYMBOL_RUS'];
         $items[$item['ID']] = $item;
     }
     return $items;
 }
开发者ID:akniyev,项目名称:arteva.ru,代码行数:91,代码来源:class.php


示例17: array

			echo CAdminCalendar::CalendarPeriodCustom("ACTIVE_FROM", "ACTIVE_TO", $arDiscount['ACTIVE_FROM'], $arDiscount['ACTIVE_TO'], true, 19, true, array(
				CAdminCalendar::PERIOD_EMPTY => GetMessage('BT_CAT_DISCOUNT_EDIT_CALENDARE_PERIOD_EMPTY'),
				CAdminCalendar::PERIOD_INTERVAL => GetMessage('BT_CAT_DISCOUNT_EDIT_CALENDARE_PERIOD_INTERVAL')
			));
		?></td>
	</tr><?
	$tabControl->EndCustomField("PERIOD",
		'<input type="hidden" name="ACTIVE_FROM" value="'.htmlspecialcharsbx($arDiscount['ACTIVE_FROM']).'">'.
		'<input type="hidden" name="ACTIVE_TO" value="'.htmlspecialcharsbx($arDiscount['ACTIVE_FROM']).'">'
	);
	$tabControl->BeginCustomField("VALUE_TYPE", GetMessage('DSC_TYPE').":",true);
	?><tr id="tr_VALUE_TYPE" class="adm-detail-required-field">
		<td width="40%"><? echo $tabControl->GetCustomLabelHTML(); ?></td>
		<td width="60%">
			<select name="VALUE_TYPE" id="ob_value_type"><?
				foreach (CCatalogDiscount::GetDiscountTypes(true) as $key => $value)
				{
					?><option value="<? echo htmlspecialcharsbx($key); ?>"<?if ($arDiscount['VALUE_TYPE'] == $key) echo " selected";?>><? echo htmlspecialcharsex($value); ?></option><?
				}
			?></select>
		</td>
	</tr><?
	$tabControl->EndCustomField("VALUE_TYPE",
		'<input type="hidden" name="VALUE_TYPE" value="'.htmlspecialcharsbx($arDiscount['VALUE_TYPE']).'">'
	);
	$tabControl->AddEditField("VALUE", GetMessage("DSC_VALUE").":", true, array('size' => 20, 'maxlength' => 20), roundEx($arDiscount['VALUE'], CATALOG_VALUE_PRECISION));
	$tabControl->AddDropDownField("CURRENCY", GetMessage('DSC_CURRENCY').':', true, $arCurrencyList, $arDiscount['CURRENCY']);
	$tabControl->BeginCustomField("MAX_DISCOUNT", GetMessage('DSC_MAX_SUM').":",false);
	?><tr id="tr_MAX_DISCOUNT" style="display: <? echo 'P' == $arDiscount['VALUE_TYPE'] ? 'table-row' : 'none'; ?>;">
		<td width="40%"><? echo $tabControl->GetCustomLabelHTML(); ?></td>
		<td width="60%"><input id="ob_max_discount" type="text" name="MAX_DISCOUNT" size="20" maxlength="20" value="<?php 
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:cat_discount_edit.php


示例18: getItems

 /**
  * Get items for view.
  * @return mixed[]  array('ID' => array(), 'ID' => array(), ...)
  */
 protected function getItems()
 {
     if (empty($this->productIdsMap) || empty($this->arParams['SHOW_PRODUCTS'])) {
         return array();
     }
     $this->separateItemsByIblock();
     $defaultMeasure = $this->data['DEFAULT_MEASURE'];
     $items = array();
     foreach (array_keys($this->arParams['SHOW_PRODUCTS']) as $iblock) {
         $this->linkItems = array();
         if (empty($this->iblockItems[$iblock])) {
             continue;
         }
         $filter = $this->filter;
         $filter['IBLOCK_ID'] = $iblock;
         $filter['ID'] = $this->iblockItems[$iblock];
         $elementIterator = CIBlockElement::GetList(array(), $filter, false, false, $this->selectFields);
         $elementIterator->SetUrlTemplates($this->arParams['DETAIL_URL']);
         while ($element = $elementIterator->GetNext()) {
             $element['ID'] = (int) $element['ID'];
             $element['ACTIVE_FROM'] = $element['DATE_ACTIVE_FROM'];
             $element['ACTIVE_TO'] = $element['DATE_ACTIVE_TO'];
             $buttons = CIBlock::GetPanelButtons($element['IBLOCK_ID'], $element['ID'], 0, array("SECTION_BUTTONS" => false, "SESSID" => false, "CATALOG" => true));
             $element['EDIT_LINK'] = $buttons['edit']['edit_element']['ACTION_URL'];
             $element['DELETE_LINK'] = $buttons['edit']['delete_element']['ACTION_URL'];
             $ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($element["IBLOCK_ID"], $element["ID"]);
             $element["IPROPERTY_VALUES"] = $ipropValues->getValues();
             $element["PREVIEW_PICTURE"] = $element["PREVIEW_PICTURE"] > 0 ? CFile::GetFileArray($element["PREVIEW_PICTURE"]) : false;
             if ($element["PREVIEW_PICTURE"]) {
                 $element["PREVIEW_PICTURE"]["ALT"] = $element["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"];
                 if ($element["PREVIEW_PICTURE"]["ALT"] == "") {
                     $element["PREVIEW_PICTURE"]["ALT"] = $element["NAME"];
                 }
                 $element["PREVIEW_PICTURE"]["TITLE"] = $element["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"];
                 if ($element["PREVIEW_PICTURE"]["TITLE"] == "") {
                     $element["PREVIEW_PICTURE"]["TITLE"] = $element["NAME"];
                 }
             }
             $element["DETAIL_PICTURE"] = $element["DETAIL_PICTURE"] > 0 ? CFile::GetFileArray($element["DETAIL_PICTURE"]) : false;
             if ($element["DETAIL_PICTURE"]) {
                 $element["DETAIL_PICTURE"]["ALT"] = $element["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"];
                 if ($element["DETAIL_PICTURE"]["ALT"] == "") {
                     $element["DETAIL_PICTURE"]["ALT"] = $element["NAME"];
                 }
                 $element["DETAIL_PICTURE"]["TITLE"] = $element["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"];
                 if ($element["DETAIL_PICTURE"]["TITLE"] == "") {
                     $element["DETAIL_PICTURE"]["TITLE"] = $element["NAME"];
                 }
             }
             $element["PROPERTIES"] = array();
             $element["DISPLAY_PROPERTIES"] = array();
             $element["PRODUCT_PROPERTIES"] = array();
             $element['PRODUCT_PROPERTIES_FILL'] = array();
             if (!isset($element["CATALOG_MEASURE_RATIO"])) {
                 $element["CATALOG_MEASURE_RATIO"] = 1;
             }
             if (!isset($element['CATALOG_MEASURE'])) {
                 $element['CATALOG_MEASURE'] = 0;
             }
             $element['CATALOG_MEASURE'] = (int) $element['CATALOG_MEASURE'];
             if ($element['CATALOG_MEASURE'] < 0) {
                 $element['CATALOG_MEASURE'] = 0;
             }
             if (!isset($ele 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CCatalogDiscountSave类代码示例发布时间:2022-05-23
下一篇:
PHP CCatalog类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap