2namespace Bitrix\Catalog\Ebay;
5 Bitrix\Main\SystemException,
36 if(!isset(
$params[
"IBLOCK_ID"]) || intval(
$params[
"IBLOCK_ID"]) <= 0)
37 throw new SystemException(
"Incorrect iBlock ID (".__CLASS__.
"::".__METHOD__.
")");
41 $this->iBlockId =
$params[
"IBLOCK_ID"];
42 $this->xmlData =
$params[
"XML_DATA"];
47 $this->startPosition =
$params[
"START_POSITION"];
48 if(isset(
$params[
"INCLUDE_SUBSECTION"]))
49 $this->includeSubsections =
$params[
"INCLUDE_SUBSECTION"];
51 $this->bAllSections = in_array(0, $this->arSections) ? true :
false;
64 #[\ReturnTypeWillChange]
75 #[\ReturnTypeWillChange]
86 #[\ReturnTypeWillChange]
90 $this->currentRecord = $this->
nextItem();
99 #[\ReturnTypeWillChange]
102 $this->currentKey = 0;
104 $this->currentRecord = $this->
nextItem();
114 #[\ReturnTypeWillChange]
117 return is_array($this->currentRecord);
124 $arSelect =
array(
"ID",
"LID",
"IBLOCK_ID",
"IBLOCK_SECTION_ID",
"NAME",
"PREVIEW_PICTURE",
"PREVIEW_TEXT",
125 "PREVIEW_TEXT_TYPE",
"DETAIL_PICTURE",
"LANG_DIR",
"DETAIL_PAGE_URL",
"DETAIL_TEXT");
130 if($this->startPosition)
133 if (!$this->bAllSections && !empty($this->arSections))
135 $filter[
"INCLUDE_SUBSECTIONS"] = $this->includeSubsections ?
"Y" :
"N";
139 if($this->onlyAvailableElements)
140 $filter[
"CATALOG_AVAILABLE"] =
"Y";
142 $filter[
"SECTION_GLOBAL_ACTIVE"] =
"Y";
145 return \CIBlockElement::GetList(
$order,
$filter,
false,
false, $arSelect);
152 foreach($arAvailGroups as $group)
165 if (!$this->bAllSections)
167 $intSectionsCount =
count($this->arSections);
168 for (
$i = 0;
$i < $intSectionsCount;
$i++)
170 $list = \CIBlockSection::GetNavChain(
172 $this->arSections[
$i],
184 $curRIGHT_MARGIN = 0;
187 $curLEFT_MARGIN = (int)
$ar_res[
'LEFT_MARGIN'];
188 $curRIGHT_MARGIN = (int)
$ar_res[
'RIGHT_MARGIN'];
189 $arAvailGroups[
$ar_res[
'ID']] = [
191 'IBLOCK_SECTION_ID' => (
int)
$ar_res[
'IBLOCK_SECTION_ID'],
199 '>LEFT_MARGIN' => $curLEFT_MARGIN,
200 '<RIGHT_MARGIN' => $curRIGHT_MARGIN,
202 'IBLOCK_ACTIVE' =>
'Y',
203 'GLOBAL_ACTIVE' =>
'Y',
205 $db_res = \CIBlockSection::GetList(
206 [
'LEFT_MARGIN '=>
'ASC'],
219 $arAvailGroups[
$ar_res[
'ID']] = [
221 'IBLOCK_SECTION_ID' => (
int)
$ar_res[
'IBLOCK_SECTION_ID'],
233 'IBLOCK_ACTIVE' =>
'Y',
234 'GLOBAL_ACTIVE' =>
'Y',
236 $db_res = \CIBlockSection::GetList(
237 [
'LEFT_MARGIN' =>
'ASC'],
250 $arAvailGroups[
$ar_res[
'ID']] = [
252 'IBLOCK_SECTION_ID' => (
int)
$ar_res[
'IBLOCK_SECTION_ID'],
259 return $arAvailGroups;
266 if (is_array($selectedGroups))
268 foreach ($selectedGroups as $value)
282 $dbIblock = \CIBlock::GetByID($this->iBlockId);
287 if ($serverName ==
'')
291 $rsSite = \CSite::GetList(
'',
'',
array(
"LID" =>
$arIblock[
"LID"]));
292 if($arSite = $rsSite->Fetch())
293 $arIblock[
"SERVER_NAME"] = $arSite[
"SERVER_NAME"];
294 if(
$arIblock[
"SERVER_NAME"] ==
'' && defined(
"SITE_SERVER_NAME"))
295 $arIblock[
"SERVER_NAME"] = SITE_SERVER_NAME;
297 $arIblock[
"SERVER_NAME"] = \COption::GetOptionString(
"main",
"server_name",
"");
307 $rsProps = \CIBlockProperty::GetList(
308 array(
'SORT' =>
'ASC',
'NAME' =>
'ASC'),
309 array(
'IBLOCK_ID' => $this->iBlockId,
'ACTIVE' =>
'Y',
'CHECK_PERMISSIONS' =>
'N')
313 $arProp[
'ID'] = (int)$arProp[
'ID'];
314 $arProp[
'USER_TYPE'] = (string)$arProp[
'USER_TYPE'];
315 $arProp[
'CODE'] = (string)$arProp[
'CODE'];
316 $arIblock[
'PROPERTY'][$arProp[
'ID']] = $arProp;
329 array(
'ID' => $productId),
332 array(
'ID',
'QUANTITY',
'QUANTITY_TRACE',
'CAN_BUY_ZERO')
335 if ($arProduct = $rsProducts->Fetch())
337 $arProduct[
'QUANTITY'] = doubleval($arProduct[
'QUANTITY']);
339 if (0 >= $arProduct[
'QUANTITY'] && (
'Y' != $arProduct[
'QUANTITY_TRACE'] ||
'N' != $arProduct[
'CAN_BUY_ZERO']))
342 $result = $arProduct[
'QUANTITY'];
357 return (isset($currencyList[
'RUR']) ?
'RUR' :
'RUB');
368 $this->onlyAvailableElements =
true;
370 $this->onlyAvailableElements =
false;
378 $minPriceCurrency =
"";
380 $baseCurrency = Currency\CurrencyManager::getBaseCurrency();
383 if ($this->xmlData[
'PRICE'] > 0)
386 'PRODUCT_ID' => $productId,
387 'CATALOG_GROUP_ID' => $this->xmlData[
'PRICE'],
389 'GROUP_GROUP_ID' =>
array(2),
390 '+<=QUANTITY_FROM' => 1,
391 '+>=QUANTITY_TO' => 1,
395 if ($arPrice = $rsPrices->Fetch())
406 $minPrice = $arOptimalPrice[
'RESULT_PRICE'][
'DISCOUNT_PRICE'];
407 $minPriceCurrency = $baseCurrency;
409 $minPriceGroup = $arOptimalPrice[
'PRICE'][
'CATALOG_GROUP_ID'];
424 $minPrice = $arPrice[
'RESULT_PRICE'][
'DISCOUNT_PRICE'];
425 $minPriceCurrency = $baseCurrency;
427 $minPriceGroup = $arPrice[
'PRICE'][
'CATALOG_GROUP_ID'];
433 "MIN_RUB" => $minPriceRUR,
434 "MIN_GROUP" => $minPriceGroup,
435 "MIN_CURRENCY" => $minPriceCurrency
443 if ($detailPageUrl ==
'')
444 $detailPageUrl =
'/';
446 $detailPageUrl = str_replace(
' ',
'%20', $detailPageUrl);
448 $result =
"http://".$this->arIblock[
'SERVER_NAME'].Main\Text\HtmlFilter::encode($detailPageUrl);
457 if ($file = \CFile::GetFileArray($pictNo))
459 if(mb_substr($file[
"SRC"], 0, 1) ==
"/")
460 $strFile =
"http://".$this->arIblock[
'SERVER_NAME'].implode(
"/", array_map(
"rawurlencode", explode(
"/", $file[
"SRC"])));
461 elseif(preg_match(
"/^(http|https):\\/\\/(.*?)\\/(.*)\$/", $file[
"SRC"], $match))
462 $strFile =
"http://".$match[2].
'/'.implode(
"/", array_map(
"rawurlencode", explode(
"/", $match[3])));
482 if($arProperty[
"USER_TYPE"] <>
'')
484 $arUserType = \CIBlockProperty::GetUserType($arProperty[
"USER_TYPE"]);
485 if(array_key_exists(
"GetPublicViewHTML", $arUserType))
496 if (is_array($this->xmlData) && is_array($this->xmlData[
'XML_DATA']) && is_array($this->xmlData[
'XML_DATA'][
'PARAMS']))
498 foreach ($this->xmlData[
'XML_DATA'][
'PARAMS'] as
$key => $propId)
512 $bParam = (strncmp($param,
'PARAM_', 6) == 0);
518 isset($arOffer[
'PROPERTIES'][$PROPERTY_CODE])
519 ? $arOffer[
'PROPERTIES'][$PROPERTY_CODE]
520 : $arOffer[
'PROPERTIES'][$PROPERTY]
525 if(!is_array($arProperty[
"VALUE"]))
526 $arProperty[
"VALUE"] =
array($arProperty[
"VALUE"]);
531 foreach($arProperty[
"VALUE"] as $oneValue)
536 array(
"VALUE" => $oneValue),
537 array(
'MODE' =>
'SIMPLE_TEXT'),
543 $arCheckValue =
array();
545 foreach ($arProperty[
'VALUE'] as &$intValue)
547 $intValue = (int)$intValue;
549 $arCheckValue[] = $intValue;
552 if (isset($intValue))
555 if (!empty($arCheckValue))
560 $value[] =
$arRes[
'NAME'];
566 $arCheckValue =
array();
568 foreach ($arProperty[
'VALUE'] as &$intValue)
570 $intValue = (int)$intValue;
572 $arCheckValue[] = $intValue;
575 if (isset($intValue))
578 if (!empty($arCheckValue))
580 $dbRes = \CIBlockSection::GetList(
array(),
array(
'IBLOCK_ID' => $arProperty[
'LINK_IBLOCK_ID'],
'ID' => $arCheckValue),
false,
array(
'NAME'));
583 $value[] =
$arRes[
'NAME'];
589 $value .= $arProperty[
'VALUE'];
593 foreach ($arProperty[
'VALUE'] as &$intValue)
595 $intValue = (int)$intValue;
598 if ($ar_file = \CFile::GetFileArray($intValue))
600 if(mb_substr($ar_file[
"SRC"], 0, 1) ==
"/")
601 $strFile =
"http://".$this->arIblock[
"SERVER_NAME"].implode(
"/", array_map(
"rawurlencode", explode(
"/", $ar_file[
"SRC"])));
602 elseif(preg_match(
"/^(http|https):\\/\\/(.*?)\\/(.*)\$/", $ar_file[
"SRC"], $match))
603 $strFile =
"http://".$match[2].
'/'.implode(
"/", array_map(
"rawurlencode", explode(
"/", $match[3])));
611 if (isset($intValue))
616 $value = $arProperty[
'VALUE'];
619 if(is_array($value) &&
count($value) == 1)
620 $value = implode(
"", $value);
640 $boolCurrentSections =
false;
643 $dbElementGroups = \CIBlockElement::GetElementGroups($productId,
false,
array(
'ID',
'ADDITIONAL_PROPERTY_ID'));
645 while ($arElementGroup = $dbElementGroups->Fetch())
647 if (0 < (
int)$arElementGroup[
'ADDITIONAL_PROPERTY_ID'])
650 $boolCurrentSections =
true;
652 if (in_array((
int)$arElementGroup[
"ID"], $this->arSectionIDs))
653 $result[] = $arElementGroup[
"ID"];
656 if (!$boolCurrentSections)
664 if (!empty($availGroups))
676 if (100 <= $this->cnt)
682 'PROPERTIES' =>
true,
689 if(!$obElement = $this->dbItems->GetNextElement())
692 $arItem = $obElement->GetFields();
693 $arItem[
'PROPERTIES'] = $obElement->GetProperties();
694 $arItem[
"QUANTITY"] = $this->
getQuantity($arItem[
"ID"]);
695 $arItem[
"PRICES"] = $this->
getPrices($arItem[
"ID"], $this->arIblock[
'LID']);
697 $arItem[
"DETAIL_PICTURE_URL"] = $this->
getPictureUrl((
int)$arItem[
"DETAIL_PICTURE"]);
698 $arItem[
"PREVIEW_PICTURE_URL"] = $this->
getPictureUrl((
int)$arItem[
"PREVIEW_PICTURE"]);
699 $arItem[
"PARAMS"] = $this->
getParams($arItem, $this->arIblock);
700 $arItem[
"DETAIL_PAGE_URL"] = $this->
getDetailPageUrl($arItem[
"~DETAIL_PAGE_URL"]);
getValue($arOffer, $param, $PROPERTY, $arProperties, $arUserTypeFormat)
getIblockProps($serverName)
getDetailPageUrl($detailPageUrl)
getParams($product, $arIblock)
getSections($selectedGroups)
getMaxSectionId(array $arAvailGroups)
getSectionIDs(array $availGroups)
setOnlyAvailableFlag($flag)
getPrices($productId, $siteId)
__construct($catalogType, $params)
getCategories($productId)
static ClearDiscountCache($arTypes)
static GetOptimalPrice($intProductID, $quantity=1, $arUserGroups=array(), $renewal="N", $priceList=array(), $siteID=false, $arDiscountCoupons=false)
static ConvertCurrency($valSum, $curFrom, $curTo, $valDate="")
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
static GetListEx($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(! $ar_profile) $strFile
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
if(empty($arRunErrors)) $arUserTypeFormat
if( $site[ 'SERVER_NAME']==='') if($site['SERVER_NAME']==='') $arProperties