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

PHP CPrice类代码示例

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

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



在下文中一共展示了CPrice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: Add

 function Add($arFields, $boolRecalc = false)
 {
     global $DB;
     $boolBase = false;
     $arFields['RECALC'] = $boolRecalc === true;
     foreach (GetModuleEvents("catalog", "OnBeforePriceAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arFields));
     }
     if (!CPrice::CheckFields("ADD", $arFields, 0)) {
         return false;
     }
     if (isset($arFields['RECALC']) && $arFields['RECALC'] === true) {
         CPrice::ReCountFromBase($arFields, $boolBase);
         if (!$boolBase && $arFields['EXTRA_ID'] <= 0) {
             return false;
         }
     }
     $arInsert = $DB->PrepareInsert("b_catalog_price", $arFields);
     $strSql = "INSERT INTO b_catalog_price(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $ID = (int) $DB->LastID();
     if ($ID > 0 && $boolBase) {
         CPrice::ReCountForBase($arFields);
     }
     foreach (GetModuleEvents("catalog", "OnPriceAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     // strange copy-paste bug
     foreach (GetModuleEvents("sale", "OnPriceAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     return $ID;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:price.php


示例2: Add

 function Add($arFields, $boolRecalc = false)
 {
     global $DB;
     if (!CPrice::CheckFields("ADD", $arFields, 0)) {
         return false;
     }
     $boolBase = false;
     $arFields['RECALC'] = $boolRecalc === true ? true : false;
     $events = GetModuleEvents("catalog", "OnBeforePriceAdd");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array(&$arFields));
     }
     if (!empty($arFields['RECALC']) && $arFields['RECALC'] === true) {
         CPrice::ReCountFromBase($arFields, $boolBase);
     }
     $arInsert = $DB->PrepareInsert("b_catalog_price", $arFields);
     $strSql = "INSERT INTO b_catalog_price(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $ID = IntVal($DB->LastID());
     if ($ID > 0 && $boolBase == true) {
         CPrice::ReCountForBase($arFields);
     }
     $events = GetModuleEvents("catalog", "OnPriceAdd");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     // strange copy-paste bug
     $events = GetModuleEvents("sale", "OnPriceAdd");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     return $ID;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:33,代码来源:price.php


示例3: executeComponent

 function executeComponent()
 {
     $arFilter = array('IBLOCK_ID' => $this->arParams['IBLOCK_ID'], 'ACTIVE' => 'Y');
     if (true || $this->StartResultCache()) {
         $CIBlockElement = new CIBlockElement();
         $CFile = new \CFile();
         $aElts = array();
         $eltsSelectFields = array_merge(array('ID', 'NAME', 'CODE', 'PREVIEW_PICTURE', 'DETAIL_PICTURE', 'DETAIL_PAGE_URL'), $this->getIBlockProperties($this->arParams['IBLOCK_ID']));
         $rsElts = $CIBlockElement->GetList(array('SORT' => 'asc', 'date_active_from' => 'DESC'), $arFilter, false, false, array('ID', 'NAME'));
         if (intval($rsElts->SelectedRowsCount())) {
             while ($arElt = $rsElts->Fetch()) {
                 $aElts[] = array('ID' => $arElt['ID'], 'NAME' => $arElt['NAME']);
             }
             $arElt = $CIBlockElement->GetList(array('SORT' => 'asc', 'ID' => 'DESC'), array_merge($arFilter, array('ID' => $aElts[0]['ID'])), false, false, $eltsSelectFields)->GetNext();
             if ($arElt['DETAIL_PICTURE']) {
                 $arElt['DETAIL_PICTURE'] = $CFile->GetPath($arElt['DETAIL_PICTURE']);
             } elseif ($arElt['PREVIEW_PICTURE']) {
                 $arElt['DETAIL_PICTURE'] = $CFile->GetPath($arElt['PREVIEW_PICTURE']);
             }
             $arPrice = CPrice::GetList(array(), array("PRODUCT_ID" => $arElt['ID']))->Fetch();
             $arElt['PRICE'] = $arPrice['PRICE'];
             $this->arResult['ITEMS'] = $aElts;
             $this->arResult['ITEM'] = $arElt;
             $this->IncludeComponentTemplate();
         }
     }
 }
开发者ID:AlexPrya,项目名称:redvent.ru,代码行数:27,代码来源:class.php


示例4: loadFromDatabase

 protected function loadFromDatabase()
 {
     if (!isset($this->fields)) {
         $pricesList = \CPrice::getListEx(array(), array("=PRODUCT_ID" => $this->id, "+<=QUANTITY_FROM" => 1, "+>=QUANTITY_TO" => 1), false, false, array("PRICE", "CURRENCY", "CATALOG_GROUP_ID", "CATALOG_GROUP_CODE"));
         $this->fields = array();
         while ($priceInfo = $pricesList->fetch()) {
             $price_id = $priceInfo["CATALOG_GROUP_ID"];
             $price = \FormatCurrency($priceInfo["PRICE"], $priceInfo["CURRENCY"]);
             $this->addField($price_id, $price_id, $price);
             $this->addField($priceInfo["CATALOG_GROUP_CODE"], $price_id, $price);
         }
     }
     return is_array($this->fields);
 }
开发者ID:ASDAFF,项目名称:open_bx,代码行数:14,代码来源:elementprice.php


示例5: setExtra

 private function setExtra($productId, $priceTypeId, $extraId)
 {
     $list = CPrice::GetList(array(), array('PRODUCT_ID' => $productId, 'CATALOG_GROUP_ID' => $priceTypeId), false, false, array('ID', 'EXTRA_ID'));
     $arFields = array('PRODUCT_ID' => $productId, 'CATALOG_GROUP_ID' => $priceTypeId, 'EXTRA_ID' => $extraId, 'CURRENCY' => 'USD');
     if ($res = $list->Fetch()) {
         if ($res['EXTRA_ID'] != $extraId) {
             CPrice::Update($res['ID'], $arFields, true);
         }
     } else {
         CPrice::Add($arFields, true);
     }
     unset($list);
     unset($res);
     unset($resultUp);
 }
开发者ID:ASDAFF,项目名称:module.markup,代码行数:15,代码来源:CQuetzalMarkupPriceUpdate.php


示例6: Update

 function Update($ID, $arFields)
 {
     global $DB;
     $ID = intval($ID);
     if (!CExtra::CheckFields('UPDATE', $arFields, $ID)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_extra", $arFields);
     $strSql = "UPDATE b_catalog_extra SET " . $strUpdate . " WHERE ID = '" . intval($ID) . "'";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if (!empty($arFields["RECALCULATE"]) && $arFields["RECALCULATE"] == "Y") {
         CPrice::ReCalculate("EXTRA", $ID, $arFields["PERCENTAGE"]);
     }
     unset($GLOBALS["MAIN_EXTRA_LIST_CACHE"]);
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:16,代码来源:extra.php


示例7: add_element

function add_element($iblock_id, $section_id, $NAME, $PRICE_EUR, $P, $DETAIL_PICTURE)
{
    $el = new CIBlockElement();
    //test_dump($P);
    $arFields = array("IBLOCK_ID" => $iblock_id, "NAME" => $NAME, "CODE" => $P["ARTNUMBER"], "ACTIVE" => "Y", "IBLOCK_SECTION_ID" => $section_id, "DETAIL_TEXT" => $P["DESCRIPTION_TEXT"], "DETAIL_TEXT_TYPE" => "html", "PROPERTY_VALUES" => $P, "DETAIL_PICTURE" => $DETAIL_PICTURE);
    if ($last_el_id = $el->Add($arFields)) {
        echo "New ID: " . $last_el_id . "<br>";
        $arFields = array("ID" => $last_el_id, "VAT_INCLUDED" => "Y");
        if (CCatalogProduct::Add($arFields)) {
            echo "Добавили параметры товара к элементу каталога " . $last_el_id . "<br>";
            $arFields = array("PRODUCT_ID" => $last_el_id, "CATALOG_GROUP_ID" => 1, "PRICE" => $PRICE_EUR, "CURRENCY" => "EUR");
            CPrice::Add($arFields);
        } else {
            echo "Ошибка добавления параметров товаров";
        }
    } else {
        echo "Error: " . $el->LAST_ERROR . "<br>";
    }
}
开发者ID:akniyev,项目名称:tdpersona2,代码行数:19,代码来源:add_elements19.php


示例8: Update

 function Update($ID, $arFields)
 {
     global $DB;
     $ID = intval($ID);
     if (0 >= $ID) {
         return false;
     }
     if (!CExtra::CheckFields('UPDATE', $arFields, $ID)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_extra", $arFields);
     if (!empty($strUpdate)) {
         $strSql = "UPDATE b_catalog_extra SET " . $strUpdate . " WHERE ID = " . $ID;
         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if (isset($arFields['RECALCULATE']) && 'Y' == $arFields['RECALCULATE']) {
             CPrice::ReCalculate('EXTRA', $ID, $arFields['PERCENTAGE']);
         }
         CExtra::ClearCache();
     }
     return true;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:extra.php


示例9: 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


示例10: GetMessage

            echo GetMessage("C2IT_PRICE");
            ?>
</td>
					<td align="center"><?php 
            echo GetMessage("C2IT_CURRENCY");
            ?>
</td>
				</tr>
				</thead>
				<tbody id="container3_<?php 
            echo $arCatalogGroup["ID"];
            ?>
">
					<?php 
            $ind = -1;
            $dbPriceList = CPrice::GetList(array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC"), array("PRODUCT_ID" => $PRODUCT_ID, "CATALOG_GROUP_ID" => $arCatalogGroup["ID"]));
            $arPrice = $dbPriceList->Fetch();
            for ($i = 0, $intCount = count($arPriceBoundaries); $i < $intCount; $i++) {
                $boolExistPrice = false;
                $ind++;
                $str_CAT_QUANTITY_FROM = $arPriceBoundaries[$i]["FROM"];
                $str_CAT_QUANTITY_TO = $arPriceBoundaries[$i]["TO"];
                if ($arPrice && intval($arPrice["QUANTITY_FROM"]) == $arPriceBoundaries[$i]["FROM"]) {
                    $str_CAT_ID = $arPrice["ID"];
                    $str_CAT_EXTRA = $arPrice["EXTRA_ID"];
                    $str_CAT_PRICE = $arPrice["PRICE"];
                    $str_CAT_CURRENCY = $arPrice["CURRENCY"];
                    $arPrice = $dbPriceList->Fetch();
                } else {
                    $str_CAT_ID = 0;
                    $str_CAT_EXTRA = 0;
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:product_edit.php


示例11: array

                $killed_lines++;
            } else {
                $bDeactivationStarted = true;
                $el->Update($arr["ID"], array("ACTIVE" => "N", "TMP_ID" => $tmpid));
                $killed_lines++;
            }
            if (!($bAllLinesLoaded = CSVCheckTimeout($max_execution_time))) {
                break;
            }
        }
    }
    // delete 'not-in-file' element prices
    if ($bAllLinesLoaded && $bIBlockIsCatalog && 'Y' == $bUpdatePrice && $outFileAction == "D") {
        $res = CPrice::GetList(array(), array("ELEMENT_IBLOCK_ID" => $IBLOCK_ID, "!TMP_ID" => $tmpid), false, false, array("ID"));
        while ($arr = $res->Fetch()) {
            CPrice::Delete($arr["ID"]);
            if (!($bAllLinesLoaded = CSVCheckTimeout($max_execution_time))) {
                break;
            }
        }
    }
    if (!$bAllLinesLoaded) {
        $bAllDataLoaded = false;
        $INTERNAL_VARS_LIST = "tmpid,line_num,correct_lines,error_lines,killed_lines,arIBlockProperty,bThereIsGroups,arProductGroups,arIBlockPropertyValue,bDeactivationStarted,bUpdatePrice";
        $SETUP_VARS_LIST = "IBLOCK_ID,URL_DATA_FILE,fields_type,first_names_r,delimiter_r,delimiter_other_r,first_names_f,metki_f,PATH2IMAGE_FILES,outFileAction,inFileAction,max_execution_time,IMAGE_RESIZE,USE_TRANSLIT,TRANSLIT_LANG,CLEAR_EMPTY_PRICE,CML2_LINK_IS_XML";
        for ($i = 0; $i < $NUM_FIELDS; $i++) {
            $SETUP_VARS_LIST .= ",field_" . $i;
        }
        $CUR_FILE_POS = $csvFile->GetPos();
    }
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:csv_new_run.php


示例12: array

							elseif(!isset($CATALOG_EXTRA[$elID][$arCatalogGroup["ID"]]))
							{
								$arFields = array(
									"PRODUCT_ID" => $elID,
									"CATALOG_GROUP_ID" => $arCatalogGroup["ID"],
									"PRICE" => $arPrice[$arCatalogGroup["ID"]],
									"CURRENCY" => $arCurrency[$arCatalogGroup["ID"]],
									"QUANTITY_FROM" => $CATALOG_QUANTITY_FROM[$elID][$arCatalogGroup["ID"]],
									"QUANTITY_TO" => $CATALOG_QUANTITY_TO[$elID][$arCatalogGroup["ID"]]
								);
								if($arFields["PRICE"] < 0 || trim($arFields["PRICE"]) === '')
									CPrice::Delete($CATALOG_PRICE_ID[$elID][$arCatalogGroup["ID"]]);
								elseif(intval($CATALOG_PRICE_ID[$elID][$arCatalogGroup["ID"]])>0)
									CPrice::Update(intval($CATALOG_PRICE_ID[$elID][$arCatalogGroup["ID"]]), $arFields);
								elseif($arFields["PRICE"] >= 0)
									CPrice::Add($arFields);
							}
						}
					}
					unset($arCatalogGroup);
				}
			}
		}
	}
}


// Handle actions here
if(($arID = $lAdmin->GroupAction()))
{
	if($_REQUEST['action_target']=='selected')
开发者ID:nycmic,项目名称:bittest,代码行数:31,代码来源:iblock_list_admin.php


示例13: array

								{
									$img = CFile::GetFileArray($viewed[$fields['ID']]['DETAIL_PICTURE']);

									if($img)
										$viewed[$fields['ID']]['DETAIL_PICTURE'] = $img['SRC'];
									else
										$viewed[$fields['ID']]['DETAIL_PICTURE'] = false;
								}
								else
								{
									$viewed[$fields['ID']]['DETAIL_PICTURE'] = false;
								}
							}

							// Prices
							$priceIterator = CPrice::getList(array(), array("PRODUCT_ID" => $filter['ID']), false, false, array("PRODUCT_ID", "PRICE", "CURRENCY"));
							while($price = $priceIterator->fetch())
							{
								if(!isset($viewed[$price['PRODUCT_ID']]['PRICE']))
								{
									$viewed[$price['PRODUCT_ID']]['PRICE'] = $price['PRICE'];
									$viewed[$price['PRODUCT_ID']]['CURRENCY'] = $price['CURRENCY'];
								}
							}
						}
						//
						$arViewedResult = fDeleteDoubleProduct($viewed, $arFilterRecommended, 'N');
						if (empty($arViewedResult["ITEMS"]))
							$displayNoneViewed = "none";

						$tabBasket = "tabs";
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:order_new.php


示例14: 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;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:29,代码来源:exportoffer.php


示例15: getSkuPrices

 protected function getSkuPrices()
 {
     $result = array();
     if ($this->offers) {
         $ids = array();
         foreach ($this->offers as $id => $offers) {
             foreach ($offers as $offer) {
                 $ids[] = $offer['ID'];
             }
         }
         if ($ids) {
             $priceIds = $this->getVisiblePrices();
             foreach ($priceIds as $id) {
                 $dbPrice = \CPrice::getList(array(), array('PRODUCT_ID' => $ids, 'CATALOG_GROUP_ID' => $id), false, false, array('PRODUCT_ID', 'PRICE', 'CURRENCY'));
                 while ($arPrice = $dbPrice->fetch()) {
                     $result[$id][$arPrice["PRODUCT_ID"]] = array('PRICE' => $arPrice['PRICE'], 'CURRENCY' => $arPrice['CURRENCY']);
                 }
             }
         }
     }
     return $result;
 }
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:22,代码来源:class.php


示例16: exportElement

 function exportElement($arElement, $SECTION_MAP, $PROPERTY_MAP)
 {
     if (strlen($arElement["XML_ID"]) > 0) {
         $xml_id = $arElement["XML_ID"];
     } else {
         $xml_id = $arElement["ID"];
     }
     if ($this->PRODUCT_IBLOCK_ID > 0) {
         $arPropOrder = array("sort" => "asc", "id" => "asc", "enum_sort" => "asc", "value_id" => "asc");
         $rsLink = CIBlockElement::GetProperty($this->arIBlock["ID"], $arElement["ID"], $arPropOrder, array("ACTIVE" => "Y", "CODE" => "CML2_LINK"));
         $arLink = $rsLink->Fetch();
         if (is_array($arLink) && !is_array($arLink["VALUE"]) && $arLink["VALUE"] > 0) {
             $xml_id = $this->GetElementXML_ID($this->PRODUCT_IBLOCK_ID, $arLink["VALUE"]) . "#" . $xml_id;
         }
     }
     fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_ID") . ">" . htmlspecialcharsbx($xml_id) . "</" . GetMessage("IBLOCK_XML2_ID") . ">\n");
     if (!$this->only_price) {
         $this->exportElementFields($arElement, $SECTION_MAP);
         if ($this->next_step["catalog"] && !$this->bExtended) {
             fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_ITEM_ATTRIBUTES") . ">\n");
         } else {
             fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_PROPERTIES_VALUES") . ">\n");
         }
         $this->exportElementProperties($arElement, $PROPERTY_MAP);
         if ($this->next_step["catalog"] && !$this->bExtended) {
             fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_ITEM_ATTRIBUTES") . ">\n");
         } else {
             fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_PROPERTIES_VALUES") . ">\n");
         }
         if ($this->bExtended) {
             $elementTemplates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($this->arIBlock["ID"], $arElement["ID"]);
             $this->exportInheritedTemplates(4, $elementTemplates);
         }
     }
     if ($this->next_step["catalog"]) {
         $rsProduct = CCatalogProduct::GetList(array(), array("ID" => $arElement["ID"]));
         $arProduct = $rsProduct->Fetch();
         static $measure = null;
         if (!isset($measure)) {
             $measure = array();
             $rsBaseUnit = CCatalogMeasure::GetList(array(), array());
             while ($arIDUnit = $rsBaseUnit->Fetch()) {
                 $measure[$arIDUnit["ID"]] = $arIDUnit["CODE"];
             }
         }
         $xmlMeasure = GetMessage("IBLOCK_XML2_PCS");
         if ($arProduct["MEASURE"] > 0 && isset($measure[$arProduct["MEASURE"]])) {
             $xmlMeasure = $measure[$arProduct["MEASURE"]];
         }
         $arPrices = array();
         $rsPrices = CPrice::GetList(array(), array("PRODUCT_ID" => $arElement["ID"]));
         while ($arPrice = $rsPrices->Fetch()) {
             if (!$arPrice["QUANTITY_FROM"] && !$arPrice["QUANTITY_TO"]) {
                 $arPrices[] = array(GetMessage("IBLOCK_XML2_PRICE_TYPE_ID") => $this->prices[$arPrice["CATALOG_GROUP_ID"]], GetMessage("IBLOCK_XML2_PRICE_FOR_ONE") => $arPrice["PRICE"], GetMessage("IBLOCK_XML2_CURRENCY") => $arPrice["CURRENCY"], GetMessage("IBLOCK_XML2_MEASURE") => $xmlMeasure);
             }
         }
         if (count($arPrices) > 0) {
             fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_PRICES") . ">\n");
             foreach ($arPrices as $arPrice) {
                 fwrite($this->fp, "\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_PRICE") . ">\n");
                 foreach ($arPrice as $key => $value) {
                     fwrite($this->fp, "\t\t\t\t\t\t<" . $key . ">" . htmlspecialcharsbx($value) . "</" . $key . ">\n");
                 }
                 fwrite($this->fp, "\t\t\t\t\t</" . GetMessage("IBLOCK_XML2_PRICE") . ">\n");
             }
             fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_PRICES") . ">\n");
             $arCatalogProduct = CCatalogProduct::GetByID($arElement["ID"]);
             if ($arCatalogProduct) {
                 fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_AMOUNT") . ">" . htmlspecialcharsbx($arCatalogProduct["QUANTITY"]) . "</" . GetMessage("IBLOCK_XML2_AMOUNT") . ">\n");
             }
         }
     }
 }
开发者ID:nycmic,项目名称:bittest,代码行数:73,代码来源:cml2.php


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


示例18: addPriceProducts

	/**
	 * [addPriceProducts description]
	 * @param array $arParams
	 * @return bool
	 */
	protected function addPriceProducts($arParams){
		if (!CModule::IncludeModule("iblock") && !CModule::IncludeModule("catalog") && !CModule::IncludeModule("sale")):
			return false;
		endif;
		$PRICE_TYPE_ID = 1; // идентификатор типы базовой цены
		$arFields = Array(
		    "PRODUCT_ID" => $arParams["PRODUCT_ID"],
		    "CATALOG_GROUP_ID" => $PRICE_TYPE_ID,
		    "PRICE" => $arParams["OLD_PRICE"],
		    "CURRENCY" => "RUB",
		    "QUANTITY_FROM" => 1,
		);
		$res = CPrice::GetList(
		        array(),
		        array(
	                "PRODUCT_ID" => $arParams["PRODUCT_ID"],
	                "CATALOG_GROUP_ID" => $PRICE_TYPE_ID
	            )
		    );
		if ($arr = $res->Fetch()):
		    if (!CPrice::Update($arr["ID"], $arFields)):
		    	return false;
		    endif;
		else:
		    if (!CPrice::Add($arFields)):
		    	return false;
		    endif;
		endif;
		if (!$this->addCatalogProducts($arParams)):
			return false;
		endif;
		return true;
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:38,代码来源:addProductsPrice.php


示例19: htmlspecialcharsback

                            break;
                    }
                }
            }
            $arPropertySaveValues["CML2_LINK"] = $parentElement;
            $arIBlockElementAdd['PROPERTY_VALUES'] = $arPropertySaveValues;
            $sku = new \Bitrix\Iblock\Template\Entity\Element(0);
            $sku->setFields($arIBlockElementAdd);
            $arIBlockElementAdd["NAME"] = htmlspecialcharsback(\Bitrix\Iblock\Template\Engine::process($sku, $title));
            unset($arIBlockElementAdd['PROPERTY_VALUES']["CML2_LINK"]);
            $idNewElement = $obIBlockElement->Add($arIBlockElementAdd, false, true, true);
            if ($idNewElement) {
                $productData['ID'] = $idNewElement;
                CCatalogProduct::Add($productData, false);
                foreach ($arPriceGroup as $price) {
                    CPrice::Add(array("PRODUCT_ID" => $idNewElement, "CURRENCY" => $price["CURRENCY"], "PRICE" => $price["PRICE"], "CATALOG_GROUP_ID" => $price["TYPE"]));
                }
                $element = new \Bitrix\Iblock\InheritedProperty\ElementValues($subIBlockId, $idNewElement);
                $template = new \Bitrix\Iblock\InheritedProperty\BaseTemplate($element);
                $template->set(array("MY_TEMPLATE" => $title));
            } else {
                $errorMessage .= $obIBlockElement->LAST_ERROR;
                break;
            }
        }
        unset($productData);
        if ($idNewElement) {
            ?>
			<script type="text/javascript">
				top.BX.closeWait();
				if (!!top.BX.WindowManager.Get())
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:iblock_subelement_generator.php


示例20:

			"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()
		)->Fetch();
		$arItem["PRICE"] = $arPrice["PRICE"];
	}
}
开发者ID:AlexTimin,项目名称:sportangel,代码行数:31,代码来源:result_modifier.php



注:本文中的CPrice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP CProfile类代码示例发布时间:2022-05-23
下一篇:
PHP CPortlet类代码示例发布时间: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