本文整理汇总了PHP中CPrice::GetBasePrice方法的典型用法代码示例。如果您正苦于以下问题:PHP CPrice::GetBasePrice方法的具体用法?PHP CPrice::GetBasePrice怎么用?PHP CPrice::GetBasePrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPrice
的用法示例。
在下文中一共展示了CPrice::GetBasePrice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateAll
public static function updateAll($page = 0, &$total, $perPage = CAutoPriceUpdater::LIMIT)
{
$list = CCatalogProduct::GetList(array(), array('IBLOCK_ID' => self::enabledCatalogs()), false, array('iNumPage' => $page + 1, 'nPageSize' => $perPage), array('ID'));
$total = $list->NavPageCount;
if ($page + 1 > $list->NavPageCount) {
return false;
}
$priceType = COption::GetOptionInt('autoprice', 'priceTypes', 0);
while ($res = $list->Fetch()) {
$price = CPrice::GetBasePrice($res['ID'], false, false);
$priseRub = floatval($price * self::$usdRate);
if ($priseRub < 1000 && self::$extras[0]) {
self::setExtra($res['ID'], $priceType, self::$extras[0]);
} elseif ($priseRub < 10000 && self::$extras[1]) {
self::setExtra($res['ID'], $priceType, self::$extras[1]);
} elseif ($priseRub < 100000 && self::$extras[2]) {
self::setExtra($res['ID'], $priceType, self::$extras[2]);
}
}
return $page + 1 < $total;
}
示例2: array
$bError = false;
if ($strSaveWithoutPrice != 'Y')
{
if (isset($arPrice[$arBaseGroup['ID']]))
{
if ($arPrice[$arBaseGroup['ID']] < 0)
{
$bError = true;
$lAdmin->AddUpdateError(GetMessage('IBLIST_A_NO_BASE_PRICE', array("#ID#" => $elID)), $elID);
}
}
else
{
$arBasePrice = CPrice::GetBasePrice(
$elID,
$CATALOG_QUANTITY_FROM[$elID][$arBaseGroup['ID']],
$CATALOG_QUANTITY_FROM[$elID][$arBaseGroup['ID']],
false
);
if (!is_array($arBasePrice) || $arBasePrice['PRICE'] < 0)
{
$bError = true;
$lAdmin->AddUpdateError(GetMessage('IBLIST_A_NO_BASE_PRICE', array("#ID#" => $elID)), $elID);
}
}
}
if($bError)
continue;
$arCurrency = $CATALOG_CURRENCY[$elID];
示例3: AuthtorizeAfterAds
//.........这里部分代码省略.........
if($arFields["PROPERTY_VALUES"][81][0]==40){
$test_ads="TEST_VIP";
}
while ($arBasketItems = $dbBasketItems->Fetch())
{
$dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arBasketItems["ID"]));
if($arProp = $dbProp -> GetNext())
{
$props[] = $arProp;
$dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arBasketItems["ID"]));
if($arProp = $dbProp -> GetNext())
{
if($arProp['CODE']==$test_ads){
$ELEMENT_ID = intval($arProp['VALUE']);
if($ELEMENT_ID==$_REQUEST['CODE']){
$vip=true;
}
}
}
}
}
}
}
//var_dump($vip);die();
if(!$vip){
$arPropsBasket = array();
if($arFields["PROPERTY_VALUES"][81][0]==46){
$code_price="up-ads";
$arPropsBasket[] = array(
"NAME" => "Название: ".$arFields['NAME'],
"CODE" => "TEST_ADSUP",
"VALUE" => $arFields['ID']
);
}
if($arFields["PROPERTY_VALUES"][81][0]==40){
$code_price="vip-ads";
$arPropsBasket[] = array(
"NAME" => "Название: ".$arFields['NAME'],
"CODE" => "TEST_VIP",
"VALUE" => $arFields['ID']
);
}
$arSelect2 = Array("ID", "IBLOCK_ID", "NAME","PROPERTY_*");
$arFilter2 = Array("IBLOCK_ID"=>17, "CODE"=>$code_price, "ACTIVE"=>"Y");
$res2 = CIBlockElement::GetList(Array(), $arFilter2, false, Array("nPageSize"=>1), $arSelect2);
while($ob2 = $res2->GetNextElement()){
$arFieldIdAds = $ob2->GetFields();
if (CModule::IncludeModule("sale"))
{
$base_price=CPrice::GetBasePrice($arFieldIdAds['ID']);
$arFieldsB = array(
"PRODUCT_ID" => $arFieldIdAds['ID'],
"PRICE" => $base_price['PRICE'],
"CURRENCY" => "RUB",
"QUANTITY" => 1,
"LID" => LANG,
"NAME" => $arFieldIdAds['NAME'],
);
$arFieldsB["PROPS"] = $arPropsBasket;
$id_basket = CSaleBasket::Add($arFieldsB);
$db_res = CSaleBasket::GetPropsList(
array(
"SORT" => "ASC",
"NAME" => "ASC"
),
array("BASKET_ID" => $id_basket)
);
while ($ar_res = $db_res->Fetch())
{
$_SESSION['order_fields_after'][]= $ar_res["NAME"]."=".$ar_res["VALUE"]."<br>";
}
}
}
}
unset($_SESSION['NEW_USER_ID']);
LocalRedirect('/personal/cart/');
}
if(($arFields["IBLOCK_ID"] == 16)&&($arFields["PROPERTY_VALUES"][81][0]==47)){
$_SESSION['ELEMENT_ADS_ID']=$arFields['ID'];
}
}
示例4:
array(
"SORT" => "ASC"
),
array(
"IBLOCK_ID" => "3",
"PROPERTY_CML2_LINK" => $arItem["ID"]
),
false,
array(
"nTopCount" => 1
),
array()
);
if ($arQuery = $dbQuery->Fetch())
{
$arPrice = CPrice::GetBasePrice($arQuery["ID"]);
$arItem["PRICE"] = $arPrice["PRICE"];
}
else
{
$arPrice = CPrice::GetList(
array(),
array(
"PRODUCT_ID" => $arItem["ID"]
),
false,
array(
"nTopCount" => 1
),
array()
示例5: SetBasePrice
function SetBasePrice($ProductID, $Price, $Currency, $quantityFrom = false, $quantityTo = false, $bGetID = false)
{
$bGetID = $bGetID == true;
$arFields = array();
$arFields["PRICE"] = (double) $Price;
$arFields["CURRENCY"] = $Currency;
$arFields["QUANTITY_FROM"] = $quantityFrom == false ? false : (int) $quantityFrom;
$arFields["QUANTITY_TO"] = $quantityTo == false ? false : (int) $quantityTo;
$arFields["EXTRA_ID"] = false;
if ($arBasePrice = CPrice::GetBasePrice($ProductID, $quantityFrom, $quantityTo, false)) {
$ID = CPrice::Update($arBasePrice["ID"], $arFields);
} else {
$arBaseGroup = CCatalogGroup::GetBaseGroup();
$arFields["CATALOG_GROUP_ID"] = $arBaseGroup["ID"];
$arFields["PRODUCT_ID"] = $ProductID;
$ID = CPrice::Add($arFields);
}
if (!$ID) {
return false;
}
return $bGetID ? $ID : true;
}
示例6: switch
CModule::IncludeModule("catalog");
CModule::IncludeModule("iblock");
switch ($_REQUEST["action"]) {
case "add":
if (intval($_REQUEST["productid"]) > 0) {
//добавление товара в корзину
//$allproducts = explode("-", $_REQUEST["productid"]);
//foreach ($allproducts as $product) {
$product = intval($_REQUEST["productid"]);
//$product = intval($_POST["add2basket"]);
//проверим
$res = CIBlockElement::GetByID($product);
if ($ar_res = $res->GetNext()) {
$arProps = array();
$PRODUCT = $ar_res;
$ar_res = CPrice::GetBasePrice($PRODUCT[ID]);
$price = $ar_res["PRICE"];
if (intval($price) == 0) {
$price = 0;
$arFields = array("PRODUCT_ID" => $PRODUCT[ID], "QUANTITY" => $quantity, "PRODUCT_XML_ID" => $PRODUCT[ID], "PRICE" => $price, "CURRENCY" => "RUB", "LID" => "s1", "NAME" => $PRODUCT[NAME]);
$basket_id = CSaleBasket::Add($arFields);
$arItem = CSaleBasket::GetByID($basket_id);
if ($arItem["QUANTITY"] != $quantity) {
$arFields = array("QUANTITY" => $arItem["QUANTITY"] + $quantity);
CSaleBasket::Update($basket_id, $arFields);
}
} else {
$basket_id = Add2BasketByProductID($product, $quantity);
}
}
}
示例7: switch
switch ($_REQUEST['action']) {
case "properties":
$arUpdate = array();
foreach($fields as $code => $field) {
if($_REQUEST[$code]) {
$arUpdate[$code] = $_REQUEST[$code];
}
}
foreach ($props as $prop) {
if($_REQUEST['props'][$prop["ID"]]) {
CIBlockElement::SetPropertyValuesEx($ID, $IBLOCK_ID, array($prop["ID"] => $_REQUEST['props'][$prop["ID"]]));
}
}
if($bCatalog && $_REQUEST['base_price_multiplier'] && isset($_REQUEST['base_price_add']) ) {
$arr = CPrice::GetBasePrice($ID);
$price = $arr["PRICE"];
$price = $price * $_REQUEST['base_price_multiplier'];
$price = $price + $_REQUEST['base_price_add'];
CPrice::SetBasePrice($ID, $price, $arr["CURRENCY"]);
}
if(count($arUpdate)) {
$el = new CIBlockElement;
$el->Update($ID, $arUpdate);
}
break;
case "delete":
if (CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_delete")) {
@set_time_limit(0);
$DB->StartTransaction();
$APPLICATION->ResetException();
示例8: foreach
<?php
}
?>
</p>
</div>
</div>
<div class="searchBooksWrap">
<div class="searchWidthWrapper">
<?php
foreach ($arResult["SEARCH"] as $arSearch) {
//arshow($arSearch);
$item = CIBlockElement::GetList(array(), array("ID" => $arSearch["ITEM_ID"]), false, false, array("ID", "PROPERTY_AUTHORS", "DETAIL_PICTURE"))->Fetch();
//arshow($item);
$price = CPrice::GetBasePrice($arSearch["ITEM_ID"]);
$pict = CFile::ResizeImageGet($item["DETAIL_PICTURE"], array('width' => 165, 'height' => 233), BX_RESIZE_IMAGE_EXACT, true);
?>
<div class="searchBook">
<div>
<a href="<?php
echo $arSearch["URL"];
?>
">
<img src="<?php
echo $pict["src"];
?>
">
</a>
</div>
<div class="descrWrap">
示例9: array
$viewedIterator = \Bitrix\Catalog\CatalogViewedProductTable::getList(array('order' => array("DATE_VISIT" => "DESC"), 'filter' => $arFilterV, 'select' => array("ELEMENT_ID", "PRODUCT_ID"), 'limit' => $arParams["PAGE_ELEMENT_COUNT"]));
while ($arItems = $viewedIterator->fetch()) {
$arResult[$arItems["ELEMENT_ID"]] = $arItems["PRODUCT_ID"];
}
unset($arItems, $viewedIterator);
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();
示例10: foreach
<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<?
foreach($arResult["ITEMS"]["AnDelCanBuy"] as &$item){
$ar_res = CCatalogProduct::GetByIDEx($item['PRODUCT_ID']);
$item['DETAIL_PAGE_URL'] = $ar_res['DETAIL_PAGE_URL'];
$item['TOTAL'] = $item['PRICE']*$item['QUANTITY'];
$item['BASE_PRICE'] = CPrice::GetBasePrice($item['PRODUCT_ID']);
$item["BASE_PRICE"]['PRICE'] = ceil($item["BASE_PRICE"]['PRICE']);
$item['PRICE'] = ceil($item['PRICE']);
if($ar_res['IBLOCK_CODE']=='tyres'){
$rsProp = CIBlockProperty::GetByID('model', false, 'tyres');
if($arProp = $rsProp->GetNext()){
$rsElement = CIBlockElement::GetList(array(), array('IBLOCK_ID'=>$arProp['LINK_IBLOCK_ID'], 'ID'=>$ar_res['PROPERTIES']['model']['VALUE'], 'ACTIVE'=>'Y'), false, array('nTopCount'=>1), array('ID', 'IBLOCK_ID', 'PREVIEW_PICTURE'));
if ($obElement = $rsElement->GetNextElement()) {
$arFields = $obElement->GetFields();
$arProps = $obElement->GetProperties(false, array('CODE'=>array('model_season', 'model_type', 'model_pin')));
$item['IBLOCK_CODE']='tyres';
$item['PREVIEW_PICTURE'] = CFile::ResizeImageGet($arFields['PREVIEW_PICTURE'], array('width'=>43, 'height'=>60), BX_RESIZE_IMAGE_PROPORTIONAL, true);
$item['PROPERTIES'] = $arProps;
}
}
}elseif($ar_res['IBLOCK_CODE']=='wheels'){
$rsProp = CIBlockProperty::GetByID('model', false, 'wheels');
if($arProp = $rsProp->GetNext()){
$rsElement = CIBlockElement::GetList(array(), array('IBLOCK_ID'=>$arProp['LINK_IBLOCK_ID'], 'ID'=>$ar_res['PROPERTIES']['model']['VALUE'], 'ACTIVE'=>'Y'), false, array('nTopCount'=>1), array('ID', 'IBLOCK_ID', 'PREVIEW_PICTURE'));
if ($obElement = $rsElement->GetNextElement()) {
$arFields = $obElement->GetFields();
$item['IBLOCK_CODE']='wheels';
示例11: getBasePriceArray
public function getBasePriceArray()
{
if (!class_exists('\\CPrice')) {
\CModule::IncludeModule('catalog');
}
return \CPrice::GetBasePrice($this->id);
}
示例12: loadItemInfo
/**
* Получает информацию о товаре из Битрикса
*/
public function loadItemInfo()
{
if (!$this->id) {
return;
}
$elementManager = new \CIBlockElement();
if ($info = $elementManager->GetByID($this->id)->GetNext(true, false)) {
$this->setName($info['NAME']);
$this->setPreviewPicture($info['PREVIEW_PICTURE']);
$this->setDetailPicture($info['DETAIL_PICTURE']);
$this->setUrl($info['DETAIL_PAGE_URL']);
}
if (Loader::includeModule('sale')) {
$priceManager = new \CPrice();
$price = $priceManager->GetBasePrice($this->id);
$this->setPrice($price['PRICE']);
}
if (Loader::includeModule('catalog') && !$this->quantity) {
$parameters = ['filter' => ['ID' => $this->id], 'select' => ['ID', 'QUANTITY']];
$storeDb = ProductTable::getList($parameters);
while ($arData = $storeDb->fetch()) {
$this->quantity += (int) $arData['QUANTITY'];
}
}
if ($this->quantity < 0) {
$this->quantity = 0;
}
}
示例13: GetList
}
$res = CIBlockElement :: GetList ($arSort, $arFilter, false,false, $arSelect);
$current_count_element=0;
$res_el = array();
while($ob = $res->GetNextElement())
{
$current_count_element++;
if($arParams["ELEMENT_COUNT"]!="")
{
if($current_count_element>$arParams["ELEMENT_COUNT"])
{
break;
}
}
$arFields = $ob->GetFields();
$res_el["ID"]=$arFields["ID"];
$res_el["NAME"]=$arFields["NAME"];
$res_el["DETAIL_PAGE_URL"]=$arFields["DETAIL_PAGE_URL"];
$res_el["DETAIL_PICTURE"]=$arFields["DETAIL_PICTURE"];
$res_el["PRICE"] = CPrice::GetBasePrice($arFields["ID"]);
$res_el["ANOUNCE"] = $arFields["PREVIEW_TEXT"];
array_push($arResult, $res_el);
}
$this->IncludeComponentTemplate();
$cache->EndDataCache();
}
?>
示例14: GetMessage
}
echo CCurrency::SelectBox("CAT_PURCHASING_CURRENCY", $arBaseProduct['PURCHASING_CURRENCY'], "", true, "", "id='CAT_PURCHASING_CURRENCY' {$isDisabled}");
?>
</td>
</tr>
<?php
}
?>
<tr id="tr_BASE_PRICE" style="display: <?php
echo $bUseExtendedPrice ? 'none' : 'table-row';
?>
;">
<td width="40%">
<?php
$arBaseGroup = CCatalogGroup::GetBaseGroup();
$arBasePrice = CPrice::GetBasePrice($PRODUCT_ID, $arPriceBoundaries[0]["FROM"], $arPriceBoundaries[0]["TO"]);
echo GetMessage("BASE_PRICE");
?>
(<?php
echo GetMessage('C2IT_PRICE_TYPE');
?>
"<?php
echo htmlspecialcharsbx(!empty($arBaseGroup['NAME_LANG']) ? $arBaseGroup['NAME_LANG'] : $arBaseGroup["NAME"]);
?>
"):
</td>
<td width="60%">
<script type="text/javascript">
var arExtra = [], arExtraPrc = [];
<?php
$db_extras = CExtra::GetList($by3 = "NAME", $order3 = "ASC");
示例15: foreach
<div class="row">
<div class="carousel slide" id="myCarousel<?php
echo $arResult["ID"];
?>
">
<div class="carousel-inner">
<?php
foreach ($arResult['ITEMS'] as $key => $arItem) {
$this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], $strElementEdit);
$this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], $strElementDelete, $arElementDeleteParams);
$strMainID = $this->GetEditAreaId($arItem['ID']);
$arItemIDs = array('ID' => $strMainID, 'PICT' => $strMainID . '_pict', 'SECOND_PICT' => $strMainID . '_secondpict', 'STICKER_ID' => $strMainID . '_sticker', 'SECOND_STICKER_ID' => $strMainID . '_secondsticker', 'QUANTITY' => $strMainID . '_quantity', 'QUANTITY_DOWN' => $strMainID . '_quant_down', 'QUANTITY_UP' => $strMainID . '_quant_up', 'QUANTITY_MEASURE' => $strMainID . '_quant_measure', 'BUY_LINK' => $strMainID . '_buy_link', 'BASKET_ACTIONS' => $strMainID . '_basket_actions', 'NOT_AVAILABLE_MESS' => $strMainID . '_not_avail', 'SUBSCRIBE_LINK' => $strMainID . '_subscribe', 'COMPARE_LINK' => $strMainID . '_compare_link', 'PRICE' => $strMainID . '_price', 'DSC_PERC' => $strMainID . '_dsc_perc', 'SECOND_DSC_PERC' => $strMainID . '_second_dsc_perc', 'PROP_DIV' => $strMainID . '_sku_tree', 'PROP' => $strMainID . '_prop_', 'DISPLAY_PROP_DIV' => $strMainID . '_sku_prop', 'BASKET_PROP_DIV' => $strMainID . '_basket_prop');
$strObName = 'ob' . preg_replace("/[^a-zA-Z0-9_]/", "x", $strMainID);
$productTitle = isset($arItem['IPROPERTY_VALUES']['ELEMENT_PAGE_TITLE']) && $arItem['IPROPERTY_VALUES']['ELEMENT_PAGE_TITLE'] != '' ? $arItem['IPROPERTY_VALUES']['ELEMENT_PAGE_TITLE'] : $arItem['NAME'];
$imgTitle = isset($arItem['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_TITLE']) && $arItem['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_TITLE'] != '' ? $arItem['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_TITLE'] : $arItem['NAME'];
$itemPrice = CPrice::GetBasePrice($arItem['ID'])["PRICE"];
//for carousel
if ($itemnum == 0) {
$itemclass = "item active";
$itemnum = 1;
} else {
$itemclass = "item";
}
?>
<?php
if ($itemnum == 1) {
?>
<div class="<?php
echo $itemclass;
?>