Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
exportoffercreator.php
1<?php
2namespace Bitrix\Catalog\Ebay;
4
6{
7 public static function getOfferObject(array $offerParams)
8 {
9 if(!isset($offerParams["IBLOCK_ID"]) || intval($offerParams["IBLOCK_ID"]) <= 0)
10 throw new SystemException("Incorrect iBlock ID (".__CLASS__."::".__METHOD__.")");
11
12 $arCatalog = \CCatalogSku::GetInfoByIBlock($offerParams["IBLOCK_ID"]);
13
14 if (empty($arCatalog))
15 throw new SystemException("IBlock is not catalog. (".__CLASS__."::".__METHOD__.")");
16
17 $catalogType = $arCatalog["CATALOG_TYPE"];
18 if (!in_array($catalogType, \CCatalogSku::GetCatalogTypes()))
19 throw new SystemException("Unknown type of catalog (".__CLASS__."::".__METHOD__.")");
20
21 $result = array();
22
23 switch($catalogType)
24 {
25 case \CCatalogSku::TYPE_CATALOG:
26 case \CCatalogSku::TYPE_OFFERS:
27 $result = new ExportOffer($catalogType, $offerParams);
28 break;
29
30 case \CCatalogSku::TYPE_PRODUCT:
31 case \CCatalogSku::TYPE_FULL:
32 $result = new ExportOfferSKU($catalogType, $offerParams);
33 break;
34 }
35
36 return $result;
37 }
38}
static getOfferObject(array $offerParams)