本文整理汇总了PHP中CIBlockPriceTools类的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockPriceTools类的具体用法?PHP CIBlockPriceTools怎么用?PHP CIBlockPriceTools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CIBlockPriceTools类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: productView
static function productView($arResult, $user_id = false)
{
if ($arResult["ID"] != "") {
$arResult["PRODUCT_ID"] = $arResult["ID"];
}
if (class_exists("DataManager")) {
return false;
}
if (self::contains($_SERVER["HTTP_USER_AGENT"], "facebook.com")) {
return;
}
$api_key = COption::GetOptionString(self::$MODULE_ID, "tracker_code", '');
if (!$api_key) {
return;
}
global $APPLICATION;
global $USER;
$visitor_uid = false;
if (!$user_id) {
$user_id = $USER->GetID();
}
$visitor_info = false;
if ($user_id && ($visitor_info = self::getVisitorInfo($user_id))) {
$visitor_uid = (int) $user_id;
}
$guest_uid = self::getUid($visitor_uid);
$tracker = new ConveadTracker($api_key, SITE_SERVER_NAME, $guest_uid, $visitor_uid, $visitor_info, false, SITE_SERVER_NAME);
$arProduct = CCatalogProduct::GetByIDEx($arResult["PRODUCT_ID"]);
if ($arProduct && strpos($APPLICATION->GetCurPage(), $arProduct["DETAIL_PAGE_URL"]) !== false) {
if (CCatalogSku::IsExistOffers($arResult["PRODUCT_ID"])) {
$arOffers = CIBlockPriceTools::GetOffersArray(array("IBLOCK_ID" => $arProduct["IBLOCK_ID"]), array($arResult["PRODUCT_ID"]), array(), array("ID", "ACTIVE"));
foreach ($arOffers as $array) {
if ($array["ACTIVE"] == "Y") {
$arResult["PRODUCT_ID"] = $array["ID"];
break;
}
}
}
$_SESSION["CONVEAD_PRODUCT_ID"] = $arResult["PRODUCT_ID"];
$_SESSION["CONVEAD_PRODUCT_NAME"] = str_replace("'", ''', $arProduct["NAME"]);
$_SESSION["CONVEAD_PRODUCT_URL"] = "http://" . SITE_SERVER_NAME . $arProduct["DETAIL_PAGE_URL"];
$product_id = $arResult["PRODUCT_ID"];
$product_name = $arProduct["NAME"];
$product_url = "http://" . SITE_SERVER_NAME . $arProduct["DETAIL_PAGE_URL"];
if ($_SESSION["LAST_VIEW_ID"] == $arResult["PRODUCT_ID"]) {
return false;
} else {
$_SESSION["LAST_VIEW_ID"] = $arResult["PRODUCT_ID"];
return true;
}
//$result = $tracker->eventProductView($product_id, $product_name, $product_url);
return true;
}
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:54,代码来源:cConveadTracker.php
示例2: setItemsOffers
/**
* Add offers for each catalog product.
* @return void
*/
protected function setItemsOffers()
{
// filter items to get only product type (not offers)
$productIblocks = array();
foreach ($this->data['CATALOG'] as $catalog) {
if ($catalog['CATALOG_TYPE'] == CCatalogSKU::TYPE_FULL || $catalog['CATALOG_TYPE'] == CCatalogSKU::TYPE_PRODUCT) {
$productIblocks[] = $catalog;
}
}
// Get total offers for all catalog products
foreach ($productIblocks as &$iblock) {
if (empty($this->iblockItems[$iblock['IBLOCK_ID']])) {
continue;
}
//if(empty($this->arParams['OFFER_TREE_PROPS'][$iblock['OFFERS_IBLOCK_ID']]) || empty($this->arParams['PROPERTY_CODE'][$iblock['OFFERS_IBLOCK_ID']]))
// continue;
if (!isset($this->arParams['PROPERTY_CODE'][$iblock['OFFERS_IBLOCK_ID']]) && !is_array($this->arParams['PROPERTY_CODE'][$iblock['OFFERS_IBLOCK_ID']])) {
$this->arParams['PROPERTY_CODE'][$iblock['OFFERS_IBLOCK_ID']] = array();
}
if (!isset($this->arParams['OFFER_TREE_PROPS'][$iblock['OFFERS_IBLOCK_ID']]) && !is_array($this->arParams['OFFER_TREE_PROPS'][$iblock['OFFERS_IBLOCK_ID']])) {
$this->arParams['OFFER_TREE_PROPS'][$iblock['OFFERS_IBLOCK_ID']] = array();
}
$selectProperties = array_merge($this->arParams['PROPERTY_CODE'][$iblock['OFFERS_IBLOCK_ID']], $this->arParams['OFFER_TREE_PROPS'][$iblock['OFFERS_IBLOCK_ID']]);
$offers = CIBlockPriceTools::GetOffersArray(array('IBLOCK_ID' => $iblock['IBLOCK_ID'], 'HIDE_NOT_AVAILABLE' => $this->arParams['HIDE_NOT_AVAILABLE']), $this->iblockItems[$iblock['IBLOCK_ID']], array(), array("ID", "CODE", "NAME", "SORT", "PREVIEW_PICTURE", "DETAIL_PICTURE"), $selectProperties, $this->arParams["OFFERS_LIMIT"], $this->data['CATALOG_PRICES'], $this->arParams['PRICE_VAT_INCLUDE'], $this->data['CONVERT_CURRENCY']);
if (empty($offers)) {
continue;
}
foreach ($offers as &$offer) {
$linkId = (int) $offer['LINK_ELEMENT_ID'];
if (!isset($this->linkItems[$linkId])) {
continue;
}
$offer['~BUY_URL'] = $this->urlTemplates['~BUY_URL_TEMPLATE'] . $offer['ID'];
$offer['BUY_URL'] = $this->urlTemplates['BUY_URL_TEMPLATE'] . $offer['ID'];
$offer['~ADD_URL'] = $this->urlTemplates['~ADD_URL_TEMPLATE'] . $offer['ID'];
$offer['ADD_URL'] = $this->urlTemplates['ADD_URL_TEMPLATE'] . $offer['ID'];
$offer['~COMPARE_URL'] = $this->urlTemplates['~COMPARE_URL_TEMPLATE'] . $offer['ID'];
$offer['COMPARE_URL'] = $this->urlTemplates['COMPARE_URL_TEMPLATE'] . $offer['ID'];
$offer['~SUBSCRIBE_URL'] = $this->urlTemplates['~SUBSCRIBE_URL_TEMPLATE'] . $offer['ID'];
$offer['SUBSCRIBE_URL'] = $this->urlTemplates['SUBSCRIBE_URL_TEMPLATE'] . $offer['ID'];
if (!isset($this->linkItems[$linkId]['OFFERS'])) {
$this->linkItems[$linkId]['OFFERS'] = array();
}
$this->linkItems[$linkId]['OFFERS'][] = $offer;
}
unset($offer);
}
unset($iblock);
// set selected flag
foreach ($this->items as $key => &$item) {
$index = 0;
if (empty($item['OFFERS'])) {
continue;
}
foreach ($item['OFFERS'] as $offerKey => &$offer) {
$offer['SELECTED'] = $offer['ID'] == $key;
if ($offer['SELECTED']) {
$index = $offerKey;
}
}
$item['OFFERS_SELECTED'] = $index;
}
unset($item, $offer);
}
开发者ID:Satariall,项目名称:izurit,代码行数:68,代码来源:class.php
示例3: array
if('Y' == $arCurrentValues['SHOW_SECTION_PICTURE']){
$arTemplateParameters['SECTION_PICTURE_WIDTH'] = array(
'PARENT' => 'LIST_SETTINGS',
'NAME' => getMessage('RS_SLINE.SECTION_PICTURE_WIDTH'),
'TYPE' => 'STRING',
'DEFAULT' => '',
);
$arTemplateParameters['SECTION_PICTURE_HEIGHT'] = array(
'PARENT' => 'LIST_SETTINGS',
'NAME' => getMessage('RS_SLINE.SECTION_PICTURE_HEIGHT'),
'TYPE' => 'STRING',
'DEFAULT' => '',
);
}
$arOffers = CIBlockPriceTools::GetOffersIBlock($IBLOCK_ID);
$OFFERS_IBLOCK_ID = is_array($arOffers) ? $arOffers['OFFERS_IBLOCK_ID']: 0;
if($OFFERS_IBLOCK_ID){
$arProperty_Offers = array();
$rsProp = CIBlockProperty::GetList(array('sort'=>'asc', 'name'=>'asc'), array('IBLOCK_ID'=>$OFFERS_IBLOCK_ID, 'ACTIVE'=>'Y'));
while($arr=$rsProp->Fetch()){
$arr['ID'] = intval($arr['ID']);
if ($arOffers['OFFERS_PROPERTY_ID'] == $arr['ID'])
continue;
$strPropName = '['.$arr['ID'].']'.('' != $arr['CODE'] ? '['.$arr['CODE'].']' : '').' '.$arr['NAME'];
if ('' == $arr['CODE'])
$arr['CODE'] = $arr['ID'];
$arProperty_Offers[$arr['CODE']] = $strPropName;
}
开发者ID:Andreyjktl,项目名称:test_mega_template,代码行数:30,代码来源:.parameters.php
示例4: array
if (!isset($arParams["OFFERS_PROPERTY_CODE"])) {
$arParams["OFFERS_PROPERTY_CODE"] = array();
} elseif (!is_array($arParams["OFFERS_PROPERTY_CODE"])) {
$arParams["OFFERS_PROPERTY_CODE"] = array($arParams["OFFERS_PROPERTY_CODE"]);
}
foreach ($arParams["OFFERS_PROPERTY_CODE"] as $key => $value) {
if ($value === "") {
unset($arParams["OFFERS_PROPERTY_CODE"][$key]);
}
}
if ($bCatalog && !empty($arResult["ELEMENTS"]) && (!empty($arParams["OFFERS_FIELD_CODE"]) || !empty($arParams["OFFERS_PROPERTY_CODE"]))) {
$offersFilter = array('IBLOCK_ID' => $arParams['IBLOCK_ID'], 'HIDE_NOT_AVAILABLE' => $arParams['HIDE_NOT_AVAILABLE']);
if (!$arParams["USE_PRICE_COUNT"]) {
$offersFilter['SHOW_PRICE_COUNT'] = $arParams['SHOW_PRICE_COUNT'];
}
$arOffers = CIBlockPriceTools::GetOffersArray($offersFilter, $arResult["ELEMENTS"], array($arParams["OFFERS_SORT_FIELD"] => $arParams["OFFERS_SORT_ORDER"], $arParams["OFFERS_SORT_FIELD2"] => $arParams["OFFERS_SORT_ORDER2"]), $arParams["OFFERS_FIELD_CODE"], $arParams["OFFERS_PROPERTY_CODE"], $arParams["OFFERS_LIMIT"], $arResult["PRICES"], $arParams['PRICE_VAT_INCLUDE'], $arConvertParams);
if (!empty($arOffers)) {
foreach ($arResult["ELEMENTS"] as $id) {
$arElementLink[$id]['OFFERS'] = array();
}
unset($id);
foreach ($arOffers as $arOffer) {
if (isset($arElementLink[$arOffer["LINK_ELEMENT_ID"]])) {
$arOffer['~BUY_URL'] = str_replace('#ID#', $arOffer["ID"], $arResult['~BUY_URL_TEMPLATE']);
$arOffer['BUY_URL'] = str_replace('#ID#', $arOffer["ID"], $arResult['BUY_URL_TEMPLATE']);
$arOffer['~ADD_URL'] = str_replace('#ID#', $arOffer["ID"], $arResult['~ADD_URL_TEMPLATE']);
$arOffer['ADD_URL'] = str_replace('#ID#', $arOffer["ID"], $arResult['ADD_URL_TEMPLATE']);
if ($arParams['DISPLAY_COMPARE']) {
$arOffer['~COMPARE_URL'] = str_replace('#ID#', $arOffer["ID"], $arResult['~COMPARE_URL_TEMPLATE']);
$arOffer['COMPARE_URL'] = str_replace('#ID#', $arOffer["ID"], $arResult['COMPARE_URL_TEMPLATE']);
}
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php
示例5:
{
if ($arPrice['MIN_PRICE'] == "Y")
{
$arItem["PRICE_CURRENCY"] = $arPrice["CURRENCY"];
$arItem["PRICE_DISCOUNT_VALUE"] = $arPrice["DISCOUNT_VALUE"];
$arItem["PRICE_PRINT_DISCOUNT_VALUE"] = $arPrice["PRINT_DISCOUNT_VALUE"];
$arItem["PRICE_VALUE"] = $arPrice["VALUE"];
$arItem["PRICE_PRINT_VALUE"] = $arPrice["PRINT_VALUE"];
$arItem["PRICE_DISCOUNT_DIFFERENCE_VALUE"] = $arPrice["DISCOUNT_DIFF"];
$arItem["PRICE_DISCOUNT_DIFFERENCE"] = $arPrice["PRINT_DISCOUNT_DIFF"];
$arItem["PRICE_DISCOUNT_PERCENT"] = $arPrice["DISCOUNT_DIFF_PERCENT"];
break;
}
}
$arItem["CAN_BUY"] = CIBlockPriceTools::CanBuy($arItem["IBLOCK_ID"], $arResult["PRICES"], $arItem);
}
if (defined("BX_COMP_MANAGED_CACHE"))
{
$CACHE_MANAGER->RegisterTag("iblock_id_".$arItem['IBLOCK_ID']);
}
if ($arItem["ID"] == $elementID)
{
$arResult["ELEMENT"] = $arItem;
$arResult["SET_ITEMS"]["PRICE"] += $arItem["PRICE_DISCOUNT_VALUE"];
$arResult["SET_ITEMS"]["OLD_PRICE"] += $arItem["PRICE_VALUE"];
$arResult["SET_ITEMS"]["PRICE_DISCOUNT_DIFFERENCE"] += $arItem["PRICE_DISCOUNT_DIFFERENCE_VALUE"];
}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:component.php
示例6: array
'SLIDER_COUNT' => $arOffer['MORE_PHOTO_COUNT'],
'BUY_URL' => $arOffer['~BUY_URL']
);
$arMatrix[$keyOffer] = $arOneRow;
}
if (-1 == $intSelected)
$intSelected = 0;
$arResult['JS_OFFERS'] = $arMatrix;
$arResult['OFFERS_SELECTED'] = $intSelected;
$arResult['OFFERS_IBLOCK'] = $arSKU['IBLOCK_ID'];
}
if ($arResult['MODULES']['catalog'] && $arResult['CATALOG'] && CCatalogProduct::TYPE_PRODUCT == $arResult['CATALOG_TYPE'])
{
CIBlockPriceTools::setRatioMinPrice($arResult, true);
}
if (!empty($arResult['DISPLAY_PROPERTIES']))
{
foreach ($arResult['DISPLAY_PROPERTIES'] as $propKey => $arDispProp)
{
if ('F' == $arDispProp['PROPERTY_TYPE'])
unset($arResult['DISPLAY_PROPERTIES'][$propKey]);
}
}
$arResult['SKU_PROPS'] = $arSKUPropList;
$arResult['DEFAULT_PICTURE'] = $arEmptyPreview;
$arResult['wish']['isWished'] = CIBlockElement::GetList(false, array(
开发者ID:ASDAFF,项目名称:mp,代码行数:31,代码来源:result_modifier.php
示例7:
$arItem['MIN_PRICE'] = CIBlockPriceTools::getMinPriceFromOffers(
$arItem['OFFERS'],
$boolConvert ? $arResult['CONVERT_CURRENCY']['CURRENCY_ID'] : $strBaseCurrency
);
}
}
if (
$arResult['MODULES']['catalog']
&& $arItem['CATALOG']
&&
($arItem['CATALOG_TYPE'] == CCatalogProduct::TYPE_PRODUCT
|| $arItem['CATALOG_TYPE'] == CCatalogProduct::TYPE_SET)
)
{
CIBlockPriceTools::setRatioMinPrice($arItem, false);
$arItem['MIN_BASIS_PRICE'] = $arItem['MIN_PRICE'];
}
if (!empty($arItem['DISPLAY_PROPERTIES']))
{
foreach ($arItem['DISPLAY_PROPERTIES'] as $propKey => $arDispProp)
{
if ('F' == $arDispProp['PROPERTY_TYPE'])
unset($arItem['DISPLAY_PROPERTIES'][$propKey]);
}
}
$arItem['LAST_ELEMENT'] = 'N';
$arNewItemsList[$key] = $arItem;
}
$arNewItemsList[$key]['LAST_ELEMENT'] = 'Y';
开发者ID:AlexPrya,项目名称:iShop,代码行数:31,代码来源:result_modifier.php
示例8: array
$arIblockOfferProps = array();
$arIblockOfferPropsFilter = array();
foreach ($arIblockOfferPropsFilter as $val) {
$arIblockOfferProps[] = array("CODE" => $val["CODE"], "NAME" => $val["NAME"]);
$arIblockOfferPropsFilter[] = $val["CODE"];
}
static $arCacheResultPrices = array();
if (!is_set($arCacheResultPrices[$arElements["IBLOCK_ID"]])) {
$dbPriceType = CCatalogGroup::GetList(array(), array('NAME_LANG' => $arItems['NOTES'], 'CAN_BUY' => 'Y'), false, false, array('NAME', 'ID'));
$arPriceType = $dbPriceType->Fetch();
$arResultPrices = CIBlockPriceTools::GetCatalogPrices($arElements["IBLOCK_ID"], array($arPriceType["NAME"]));
$arCacheResultPrices[$arElements["IBLOCK_ID"]] = $arResultPrices;
} else {
$arResultPrices = $arCacheResultPrices[$arElements["IBLOCK_ID"]];
}
$arOffers = CIBlockPriceTools::GetOffersArray($arElements["IBLOCK_ID"], $arItems["PRODUCT_ID"], array("ID" => "DESC"), array("NAME"), $arIblockOfferPropsFilter, 0, $arResultPrices, 1, array(), $USER->GetID(), $arItems['LID']);
if (count($arOffers) > 0) {
foreach ($arOffers as $arOffer) {
/*$arPrice = CCatalogProduct::GetOptimalPrice($arOffer['ID'], 1, $arGroups, "N", array(), $arItems['LID']);
$arOffer["PRICES"] = $arPrice;
if ($arCatalogProduct = CCatalogProduct::GetByID($arOffer['ID']))
{
if ($arCatalogProduct["CAN_BUY_ZERO"]!="Y" && ($arCatalogProduct["QUANTITY_TRACE"]=="Y" && doubleval($arCatalogProduct["QUANTITY"])<=0))
$arItems["CAN_BUY"] = "N";
else
$arItems["CAN_BUY"] = "Y";
}
if (($priceMin === 0) || ($arPrice["DISCOUNT_PRICE"] < $priceMin))
$priceMin = $arPrice["DISCOUNT_PRICE"];*/
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php
示例9: array
}
}
if (!empty($arCurrentValues['IBLOCK_ID'])) {
$arIBlocks = $arCurrentValues['IBLOCK_ID'];
} else {
$rsIBlock = CIBlock::GetList(array("sort" => "asc"), array("TYPE" => $arCurrentValues["IBLOCK_TYPE_ID"], "ACTIVE" => "Y"));
while ($arr = $rsIBlock->Fetch()) {
$arIBlocks = $arr["ID"];
}
}
if (!empty($arIBlocks)) {
$arProperty_Offers = array();
//foreach ($arIBlocks as $intIBlockID)
//{
if (intval($arIBlocks) > 0) {
$arOffers = CIBlockPriceTools::GetOffersIBlock($arIBlocks);
$OFFERS_IBLOCK_ID = is_array($arOffers) ? $arOffers["OFFERS_IBLOCK_ID"] : 0;
if ($OFFERS_IBLOCK_ID) {
$OFFERS_IBLOCK_ID2 = true;
$rsProp = CIBlockProperty::GetList(array("sort" => "asc", "name" => "asc"), array("ACTIVE" => "Y", "IBLOCK_ID" => $OFFERS_IBLOCK_ID));
while ($arr = $rsProp->Fetch()) {
if ($arr["PROPERTY_TYPE"] != "F") {
$arProperty_Offers[$arr["CODE"]] = "[" . $arr["CODE"] . "] " . $arr["NAME"];
}
}
}
}
//}
}
$arPrice = array();
if (CModule::IncludeModule("catalog")) {
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:.parameters.php
示例10: getMinPriceFromOffers
public static function getMinPriceFromOffers(&$offers, $currency)
{
$result = false;
$minPrice = 0;
if (!empty($offers) && is_array($offers))
{
$doubles = array();
foreach ($offers as $oneOffer)
{
$oneOffer['ID'] = intval($oneOffer['ID']);
if (isset($doubles[$oneOffer['ID']]))
continue;
if (!$oneOffer['CAN_BUY'])
continue;
CIBlockPriceTools::setRatioMinPrice($oneOffer, true);
$oneOffer['MIN_PRICE']['CATALOG_MEASURE_RATIO'] = $oneOffer['CATALOG_MEASURE_RATIO'];
$oneOffer['MIN_PRICE']['CATALOG_MEASURE'] = $oneOffer['CATALOG_MEASURE'];
$oneOffer['MIN_PRICE']['CATALOG_MEASURE_NAME'] = $oneOffer['CATALOG_MEASURE_NAME'];
$oneOffer['MIN_PRICE']['~CATALOG_MEASURE_NAME'] = $oneOffer['~CATALOG_MEASURE_NAME'];
if (empty($result))
{
$minPrice = ($oneOffer['MIN_PRICE']['CURRENCY'] == $currency
? $oneOffer['MIN_PRICE']['DISCOUNT_VALUE']
: CCurrencyRates::ConvertCurrency($oneOffer['MIN_PRICE']['DISCOUNT_VALUE'], $oneOffer['MIN_PRICE']['CURRENCY'], $currency)
);
$result = $oneOffer['MIN_PRICE'];
}
else
{
$comparePrice = ($oneOffer['MIN_PRICE']['CURRENCY'] == $currency
? $oneOffer['MIN_PRICE']['DISCOUNT_VALUE']
: CCurrencyRates::ConvertCurrency($oneOffer['MIN_PRICE']['DISCOUNT_VALUE'], $oneOffer['MIN_PRICE']['CURRENCY'], $currency)
);
if ($minPrice > $comparePrice)
{
$minPrice = $comparePrice;
$result = $oneOffer['MIN_PRICE'];
}
}
$doubles[$oneOffer['ID']] = true;
}
}
return $result;
}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:47,代码来源:comp_pricetools.php
示例11: array
$arFields = $obEl->GetFields();
if (!empty($arFields["IBLOCK_SECTION_ID"])) {
$arSec = $arSect;
}
$path = !empty($arFields['DETAIL_PICTURE']) ? $arFields['DETAIL_PICTURE'] : $arFields['PREVIEW_PICTURE'];
if (empty($path)) {
$arProp = CIBlockElement::GetProperty($arFields["IBLOCK_ID"], $arFields["ID"], array(), array('CODE' => 'MORE_PHOTO'))->Fetch();
$path = $arProp["VALUE"];
}
$path = CFile::ResizeImageGet($path, array('width' => 150, 'height' => 150), BX_RESIZE_IMAGE_PROPORTIONAL, false);
$path = $path['src'];
if (CModule::IncludeModule('catalog')) {
$arResultPrices = CIBlockPriceTools::GetCatalogPrices($arFields["IBLOCK_ID"], array($arParams["PRICE_CODE"]));
$arProduct = CCatalogProduct::GetByID($arFields["ID"]);
$arProduct['VAT_INCLUDED'] = $arProduct['VAT_INCLUDED'] == 'Y' ? true : false;
$arPrices = CIBlockPriceTools::GetItemPrices($arFields["IBLOCK_ID"], $arResultPrices, $arFields, $arProduct['VAT_INCLUDED'], array("CURRENCY_ID" => $arParams["CURRENCY"]));
}
$arHits[$index][] = array("NAME" => $arFields["NAME"], "SECTION" => $arSec["NAME"], "SECTION_PAGE_URL" => $arSec["SECTION_PAGE_URL"], "DETAIL_PAGE_URL" => $arFields["DETAIL_PAGE_URL"], "PHOTO" => $path, "PRICE" => $arPrices, "SALELEADER" => $arFields["PROPERTY_SALELEADER_VALUE"], "NEWPRODUCT" => $arFields["PROPERTY_NEWPRODUCT_VALUE"], "SPECIAL_OFFER" => $arFields["PROPERTY_SPECIAL_OFFER_VALUE"]);
}
// while( $obEl = $dbRes->GetNextElement() )
$arResult['HITS'][$index] = $arHits[$index];
}
// if($arParams["VIEW_HIT"] == "Y" && $arItem['DEPTH_LEVEL'] == 1)
}
// foreach($arResult as &$arItem => $index)
if ($obCache->StartDataCache($life_time, $cache_id, "/")) {
$obCache->EndDataCache(array("MENU_HITS" => $arHits));
}
}
// if(!is_array($arResult['HITS']))
unset($obCache);
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:result_modifier.php
示例12: GetOffersArray
public static function GetOffersArray($IBLOCK_ID, $arElementID, $arOrder, $arSelectFields, $arSelectProperties, $limit, $arPrices, $vat_include, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
{
$arResult = array();
$arOffersIBlock = CIBlockPriceTools::GetOffersIBlock($IBLOCK_ID);
if($arOffersIBlock)
{
$limit = intval($limit);
if (0 > $limit)
$limit = 0;
if(!array_key_exists("ID", $arOrder))
$arOrder["ID"] = "DESC";
$arFilter = array(
"IBLOCK_ID" => $arOffersIBlock["OFFERS_IBLOCK_ID"],
"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => $arElementID,
"ACTIVE" => "Y",
"ACTIVE_DATE" => "Y",
);
$arSelect = array(
"ID" => 1,
"IBLOCK_ID" => 1,
"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => 1,
);
//if(!$arParams["USE_PRICE_COUNT"])
{
foreach($arPrices as $value)
{
$arSelect[$value["SELECT"]] = 1;
//$arrFilter["CATALOG_SHOP_QUANTITY_".$value["ID"]] = $arParams["SHOW_PRICE_COUNT"];
}
}
foreach($arSelectFields as $code)
$arSelect[$code] = 1; //mark to select
$arOffersPerElement = array();
$rsOffers = CIBlockElement::GetList($arOrder, $arFilter, false, false, array_keys($arSelect));
while($obOffer = $rsOffers->GetNextElement())
{
$arOffer = $obOffer->GetFields();
$element_id = $arOffer["PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"]."_VALUE"];
//No more than limit offers per element
if($limit > 0)
{
$arOffersPerElement[$element_id]++;
if($arOffersPerElement[$element_id] > $limit)
continue;
}
if($element_id > 0)
{
$arOffer["LINK_ELEMENT_ID"] = $element_id;
$arOffer["DISPLAY_PROPERTIES"] = array();
if(!empty($arSelectProperties))
{
$arOffer["PROPERTIES"] = $obOffer->GetProperties();
foreach($arSelectProperties as $pid)
{
$prop = &$arOffer["PROPERTIES"][$pid];
if((is_array($prop["VALUE"]) && count($prop["VALUE"])>0) ||
(!is_array($prop["VALUE"]) && strlen($prop["VALUE"])>0))
{
$arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
}
}
}
$arOffer["PRICES"] = CIBlockPriceTools::GetItemPrices($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
$arOffer["CAN_BUY"] = CIBlockPriceTools::CanBuy($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer);
}
$arResult[] = $arOffer;
}
}
return $arResult;
}
开发者ID:nProfessor,项目名称:Mytb,代码行数:79,代码来源:comp_pricetools.php
示例13: array
$arProps = array();
if (strpos($newProductId['XML_ID'], '#') === false) {
$parentIterator = \Bitrix\Iblock\ElementTable::getList(array('select' => array('ID', 'XML_ID'), 'filter' => array('ID' => $parentId)));
if ($parentProduct = $parentIterator->fetch()) {
$newProductId['XML_ID'] = $parentProduct['XML_ID'] . '#' . $newProductId['XML_ID'];
}
unset($parentProduct, $parentIterator);
}
$arFields["PRODUCT_XML_ID"] = $newProductId['XML_ID'];
$propertyIterator = \Bitrix\Iblock\PropertyTable::getList(array('select' => array('ID', 'CODE'), 'filter' => array('IBLOCK_ID' => $newProductId['IBLOCK_ID'], '!ID' => $sku['SKU_PROPERTY_ID'])));
while ($property = $propertyIterator->fetch()) {
$property['CODE'] = (string) $property['CODE'];
$arPropsSku[] = $property['CODE'] != '' ? $property['CODE'] : $property['ID'];
}
unset($property, $propertyIterator);
$product_properties = CIBlockPriceTools::GetOfferProperties($newProductId['ID'], $sku['PRODUCT_IBLOCK_ID'], $arPropsSku);
$newValues = array();
foreach ($product_properties as $productSkuProp) {
$bFieldExists = false;
foreach ($strOffersProps as $existingSkuProp) {
if ($existingSkuProp == $productSkuProp["CODE"]) {
$bFieldExists = true;
break;
}
}
if ($bFieldExists === true) {
$newValues[] = array("NAME" => $productSkuProp["NAME"], "CODE" => $productSkuProp["CODE"], "VALUE" => $productSkuProp["VALUE"], "SORT" => $productSkuProp["SORT"]);
}
}
$newValues[] = array("NAME" => "Product XML_ID", "CODE" => "PRODUCT.XML_ID", "VALUE" => $newProductId["XML_ID"]);
$arFields['PROPS'] = isset($arItem['PROPS']) ? updateBasketOffersProps($arItem['PROPS'], $newValues) : $newValues;
开发者ID:AlexPrya,项目名称:redvent.ru,代码行数:31,代码来源:ajax.php
示例14: setItemsOffers
/**
* Add offers for each catalog product.
* @return void
*/
protected function setItemsOffers()
{
global $APPLICATION;
// filter items to get only product type (not offers)
$fullProductIds = array();
//
$productIblocks = array();
foreach ($this->data['CATALOG'] as $catalog) {
if ($catalog['CATALOG_TYPE'] == CCatalogSKU::TYPE_FULL) {
$productIblocks[] = $catalog;
foreach ($this->items as $item) {
if ($item['IBLOCK_ID'] == $catalog['IBLOCK_ID']) {
$fullProductIds[] = $item['ID'];
}
}
}
}
if (empty($fullProductIds)) {
return;
}
$fullProductIds = array_unique($fullProductIds);
// Get total offers for all catalog products
$totalOffers = array();
foreach ($productIblocks as $iblock) {
//if(empty($this->arParams['OFFER_TREE_PROPS'][$iblock['OFFERS_IBLOCK_ID']]) || empty($this->arParams['PROPERTY_CODE'][$iblock['OFFERS_IBLOCK_ID']]))
// continue;
if (!isset($this->arParams['PROPERTY_CODE'][$iblock['OFFERS_IBLOCK_ID']]) && !is_array($this->arParams['PROPERTY_CODE'][$iblock['OFFERS_IBLOCK_ID']])) {
$this->arParams['PROPERTY_CODE'][$iblock['OFFERS_IBLOCK_ID']] = array();
}
if (!isset($this->arParams['OFFER_TREE_PROPS'][$iblock['OFFERS_IBLOCK_ID']]) && !is_array($this->arParams['OFFER_TREE_PROPS'][$iblock['OFFERS_IBLOCK_ID']])) {
$this->arParams['OFFER_TREE_PROPS'][$iblock['OFFERS_IBLOCK_ID']] = array();
}
$selectProperties = array_merge($this->arParams['PROPERTY_CODE'][$iblock['OFFERS_IBLOCK_ID']], $this->arParams['OFFER_TREE_PROPS'][$iblock['OFFERS_IBLOCK_ID']]);
$offers = CIBlockPriceTools::GetOffersArray(array('IBLOCK_ID' => $iblock['IBLOCK_ID'], 'HIDE_NOT_AVAILABLE' => $this->arParams['HIDE_NOT_AVAILABLE']), $fullProductIds, array(), array("ID", "CODE", "NAME", "SORT", "PREVIEW_PICTURE", "DETAIL_PICTURE"), $selectProperties, $this->arParams["OFFERS_LIMIT"], $this->data['CATALOG_PRICES'], $this->arParams['PRICE_VAT_INCLUDE'], $this->data['CONVERT_CURRENCY']);
$totalOffers = array_merge($totalOffers, $offers);
}
if (empty($totalOffers)) {
return;
}
foreach ($totalOffers as $offer) {
$offer["~BUY_URL"] = $APPLICATION->GetCurPageParam($this->arParams["ACTION_VARIABLE"] . "=BUY&" . $this->arParams["PRODUCT_ID_VARIABLE"] . "=" . $offer["ID"], array($this->arParams["PRODUCT_ID_VARIABLE"], $this->arParams["ACTION_VARIABLE"]));
$offer["BUY_URL"] = htmlspecialcharsbx($offer["~BUY_URL"]);
$offer["~ADD_URL"] = $APPLICATION->GetCurPageParam($this->arParams["ACTION_VARIABLE"] . "=ADD2BASKET&" . $this->arParams["PRODUCT_ID_VARIABLE"] . "=" . $offer["ID"], array($this->arParams["PRODUCT_ID_VARIABLE"], $this->arParams["ACTION_VARIABLE"]));
$offer["ADD_URL"] = htmlspecialcharsbx($offer["~ADD_URL"]);
$offer["~COMPARE_URL"] = $APPLICATION->GetCurPageParam("action=ADD_TO_COMPARE_LIST&id=" . $offer["ID"], array($this->arParams["PRODUCT_ID_VARIABLE"], $this->arParams["ACTION_VARIABLE"]));
$offer["COMPARE_URL"] = htmlspecialcharsbx($offer["~COMPARE_URL"]);
$offer["~SUBSCRIBE_URL"] = $APPLICATION->GetCurPageParam($this->arParams["ACTION_VARIABLE"] . "=SUBSCRIBE_PRODUCT&id=" . $offer["ID"], array($this->arParams["PRODUCT_ID_VARIABLE"], $this->arParams["ACTION_VARIABLE"]));
$offer["SUBSCRIBE_URL"] = htmlspecialcharsbx($offer["~SUBSCRIBE_URL"]);
$linkId = (int) $offer['LINK_ELEMENT_ID'];
foreach ($this->items as &$item) {
if (!isset($item['OFFERS'])) {
$item['OFFERS'] = array();
}
if ($linkId == $item['ID']) {
$item['OFFERS'][] = $offer;
}
}
unset($item);
}
// set selected flag
foreach ($this->items as $key => &$item) {
$index = 0;
foreach ($item['OFFERS'] as $offerKey => &$offer) {
$offer['SELECTED'] = $offer['ID'] == $key;
if ($offer['SELECTED']) {
$index = $offerKey;
}
}
$item['OFFERS_SELECTED'] = $index;
}
unset($item);
unset($offer);
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:77,代码来源:class.php
示例15: intval
}
if (isset($_REQUEST["id"])) {
$id = intval($_REQUEST["id"]);
} else {
$id = 0;
}
/*************************************************************************
Handling the Compare button
*************************************************************************/
if ($_REQUEST["action"] == "ADD_TO_COMPARE_LIST" && $id > 0) {
if (!array_key_exists($id, $_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["ITEMS"])) {
//SELECT
$arSelect = array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "NAME", "DETAIL_PAGE_URL");
//WHERE
$arFilter = array("ID" => $id, "IBLOCK_LID" => SITE_ID, "IBLOCK_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y");
$arOffers = CIBlockPriceTools::GetOffersIBlock($arParams["IBLOCK_ID"]);
$OFFERS_IBLOCK_ID = $arOffers ? $arOffers["OFFERS_IBLOCK_ID"] : 0;
if ($arOffers) {
$arFilter["IBLOCK_ID"] = array($arParams["IBLOCK_ID"], $arOffers["OFFERS_IBLOCK_ID"]);
} else {
$arFilter["IBLOCK_ID"] = $arParams["IBLOCK_ID"];
}
$rsElement = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
$rsElement->SetUrlTemplates($arParams["DETAIL_URL"]);
$arElement = $rsElement->GetNext();
$arMaster = false;
if ($arElement && $arElement["IBLOCK_ID"] == $OFFERS_IBLOCK_ID) {
$rsMasterProperty = CIBlockElement::GetProperty($arElement["IBLOCK_ID"], $arElement["ID"], array(), array("ID" => $arOffers["OFFERS_PROPERTY_ID"], "EMPTY" => "N"));
if ($arMasterProperty = $rsMasterProperty->Fetch()) {
$rsMaster = CIBlockElement::GetList(array(), array("ID" => $arMasterProperty["VALUE"], "IBLOCK_ID" => $arMasterProperty["LINK_IBLOCK_ID"], "ACTIVE" => "Y"), false, false, $arSelect);
$rsMaster->SetUrlTemplates($arParams["DETAIL_URL"]);
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:component.php
示例16: CTextParser
$obParser = new CTextParser();
if (is_array($arParams["PRICE_CODE"])) {
$arResult["PRICES"] = CIBlockPriceTools::GetCatalogPrices(0, $arParams["PRICE_CODE"]);
} else {
$arResult["PRICES"] = array();
}
$arSelect = array("ID", "IBLOCK_ID", "PREVIEW_TEXT", "PREVIEW_PICTURE", "DETAIL_PICTURE");
$arFilter = array("IBLOCK_LID" => SITE_ID, "IBLOCK_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R");
foreach ($arResult["PRICES"] as $value) {
$arSelect[] = $value["SELECT"];
$arFilter["CATALOG_SHOP_QUANTITY_" . $value["ID"]] = 1;
}
$arFilter["=ID"] = $arResult["ELEMENTS"];
$rsElements = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
while ($arElement = $rsElements->Fetch()) {
$arElement["PRICES"] = CIBlockPriceTools::GetItemPrices($arElement["IBLOCK_ID"], $arResult["PRICES"], $arElement, $arParams['PRICE_VAT_INCLUDE'], $arConvertParams);
if ($arParams["PREVIEW_TRUNCATE_LEN"] > 0) {
$arElement["PREVIEW_TEXT"] = $obParser->html_cut($arElement["PREVIEW_TEXT"], $arParams["PREVIEW_TRUNCATE_LEN"]);
}
$arResult["ELEMENTS"][$arElement["ID"]] = $arElement;
}
}
foreach ($arResult["SEARCH"] as $i => $arItem) {
switch ($arItem["MODULE_ID"]) {
case "iblock":
if (array_key_exists($arItem["ITEM_ID"], $arResult["ELEMENTS"])) {
$arElement =& $arResult["ELEMENTS"][$arItem["ITEM_ID"]];
if ($arParams["SHOW_PREVIEW"] == "Y") {
if ($arElement["PREVIEW_PICTURE"] > 0) {
$arElement["PICTURE"] = CFile::ResizeImageGet($arElement["PREVIEW_PICTURE"], array("width" => $PREVIEW_WIDTH, "height" => $PREVIEW_HEIGHT), BX_RESIZE_IMAGE_PROPORTIONAL, true);
} elseif ($arElement["DETAIL_PICTURE"] > 0) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:result_modifier.php
示例17: define
<?php
define("NOT_CHECK_PERMISSIONS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if (!CModule::IncludeModule("catalog")) {
return;
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["action"]) > 0 && check_bitrix_sessid()) {
$APPLICATION->RestartBuffer();
switch ($_POST["action"]) {
case "catalogSetAdd2Basket":
if (is_array($_POST["set_ids"])) {
foreach ($_POST["set_ids"] as $itemID) {
$product_properties = true;
if (!empty($_POST["setOffersCartProps"])) {
$product_properties = CIBlockPriceTools::GetOfferProperties($itemID, $_POST["iblockId"], $_POST["setOffersCartProps"]);
}
$ratio = 1;
if ($_POST["itemsRatio"][$itemID]) {
$ratio = $_POST["itemsRatio"][$itemID];
}
if (intval($itemID)) {
Add2BasketByProductID(intval($itemID), $ratio, array("LID" => $_POST["lid"]), $product_properties);
}
}
}
break;
case "ajax_recount_prices":
if (strlen($_POST["currency"]) > 0) {
$arPices = array("formatSum" => "", "formatOldSum" => "", "formatDiscDiffSum" => "");
if ($_POST["sumPrice"]) {
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:ajax.php
示例18: GetProductSku
/**
* @param $userId
* @param $lid
* @param $productId
* @param string $productName
* @param string $currency
* @param array $arProduct
* @return array|bool
*/
function GetProductSku($userId, $lid, $productId, $productName = '', $currency = '', $arProduct = array())
{
$userId = intval($userId);
$productId = intval($productId);
if ($productId <= 0) {
return false;
}
$lid = trim($lid);
if (strlen($lid) <= 0) {
return false;
}
$productName = trim($productName);
$arResult = array();
static $arCacheGroups = array();
if (!isset($arCacheGroups[$userId])) {
$arCacheGroups[$userId] = CUser::GetUserGroup($userId);
}
$arGroups = $arCacheGroups[$userId];
if (!isset($arProduct["IBLOCK_ID"]) || 0 >= intval($arProduct["IBLOCK_ID"])) {
$arProduct["IBLOCK_ID"] = CIBlockElement::GetIBlockByID($arProduct["IBLOCK_ID"]);
}
static $arOffersIblock = array();
if (!isset($arOffersIblock[$arProduct["IBLOCK_ID"]])) {
$mxResult = CCatalogSKU::GetInfoByProductIBlock($arProduct["IBLOCK_ID"]);
if (is_array($mxResult)) {
$arOffersIblock[$arProduct["IBLOCK_ID"]] = $mxResult["IBLOCK_ID"];
}
}
if ($arOffersIblock[$arProduct["IBLOCK_ID"]] > 0) {
static $arCacheOfferProperties = array();
if (!is_set($arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]])) {
$dbOfferProperties = CIBlockProperty::GetList(array('SORT' => 'ASC', 'ID' => 'ASC'), array('IBLOCK_ID' => $arOffersIblock[$arProduct["IBLOCK_ID"]], 'ACTIVE' => 'Y', "!XML_ID" => "CML2_LINK"));
while ($arOfferProperties = $dbOfferProperties->Fetch()) {
if ('F' == $arOfferProperties['PROPERTY_TYPE']) {
|
请发表评论