Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php if (!defined("\102\137\120\122\x4f\114\117\107\137\x49\x4e\103\x4c\125\x44\105\104"..
Decoded Output download
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } use Bitrix\Main\Loader; use Bitrix\Main\Localization\Loc; use Bitrix\Iblock\SectionTable; use Bitrix\Iblock\PropertyTable; use Bitrix\Main\Event; use Bitrix\Main\EventResult; use Bitrix\Main\Data\Cache; use Bitrix\Main\Type\DateTime; use Bitrix\Main\Web\Json; use Guryev\Ozon\Filter\ProductFilter; use Guryev\Ozon\Marketplace\MarketplaceException; use Guryev\Ozon\Marketplace\MarketplaceInterface; use Guryev\Ozon\MySql\AgentsTable; use Guryev\Ozon\MySql\CategoriesConnectionsTable; use Guryev\Ozon\MySql\CharacteristicsConnectionsTable; use Guryev\Ozon\MySql\ExchangeLogTable; use Guryev\Ozon\MySql\SettingsTable; use Guryev\Ozon\MySql\ValuesConnectionsTable; use Guryev\Ozon\Helper; goto RWRw_; etNfX: const GURYEV_OZON_MODULE_NAME = "guryev.ozon"; goto CaBNI; P298w: class MarketplacesExport { protected const COUNT_ELEMENTS_FOR_CATEGORY = 100; public $settingsData; public $relationFields = []; public function __construct(bool $testExport = false) { goto eTpng; eTpng: if (!Loader::includeModule("iblock")) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.MODULE_IBLOCK_NOT_CONNECTED")); } goto KL4zJ; OfYl5: try { goto BWjfx; unVn7: if ($testExport) { $this->settingsData["EXPORT_ACTIVE"] = true; } goto ivCZu; BWjfx: $this->settingsData = SettingsTable::getList(["limit" => 1])->fetch(); goto bUNj4; DMr7r: $this->getRelationFields(); goto ZCro0; ivCZu: if ($this->settingsData["IBLOCK_SKU_USE"] && Loader::includeModule("catalog")) { $skuInfo = CCatalogSKU::GetInfoByProductIBlock($this->settingsData["IBLOCK_ID"]); if ($skuInfo) { $this->settingsData["IBLOCK_SKU_ID"] = $skuInfo["IBLOCK_ID"]; $this->settingsData["SKU_PROPERTY_ID"] = $skuInfo["SKU_PROPERTY_ID"]; } } goto bAXR8; bUNj4: $this->settingsData["IBLOCK_SKU_ID"] = null; goto unVn7; ZCro0: $this->setDomainName(); goto pG5_r; bAXR8: $this->checkSettingsData(); goto DMr7r; pG5_r: } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_CONSTRUCT, "STATUS" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "INFORMATION" => $e->getMessage()]); throw $e; } goto pFV9W; XqJPE: checkModuleMode(); goto OfYl5; KL4zJ: if (!Loader::includeSharewareModule("guryev.ozon")) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.MODULE_GURYEV_OZON_NOT_CONNECTED")); } goto XqJPE; pFV9W: } protected function checkSettingsData() : void { goto BFtKh; BFtKh: if (!$this->settingsData["EXPORT_ACTIVE"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.UPLOAD_IS_INACTIVE")); } goto a36Az; lBccj: if (!$this->settingsData["PROP_ID_PRICE"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.PRICE_NOT_SET_IN_MAIN_SETTINGS")); } goto dWmEv; hazMa: if (!$this->settingsData["PROP_ID_NAME"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.NAME_NOT_SET_IN_MAIN_SETTINGS")); } goto CUYqk; tm4l5: if (!$this->settingsData["PROP_ID_WIDTH"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.PACKING_WIDTH_NOT_SET_IN_MAIN_SETTINGS")); } goto aS9cB; smfZK: if (!$this->settingsData["PROP_ID_HEIGHT"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.PACKING_HEIGHT_NOT_SET_IN_MAIN_SETTINGS")); } goto AHV7e; CUYqk: if (!$this->settingsData["PROP_ID_OFFER_ID"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.ARTICLE_NOT_SET_IN_MAIN_SETTINGS")); } goto YrhlW; Wz5Ds: if (!isset($this->settingsData["PROP_VAT"])) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.VAT_RATE_NOT_SET_IN_MAIN_SETTINGS")); } goto lBccj; EVUaA: if (!$this->settingsData["IBLOCK_ID"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.INFOBLOCK_NOT_SET_IN_MAIN_SETTINGS")); } goto hazMa; AHV7e: if (!$this->settingsData["PROP_ID_LENGTH"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.PACKING_LENGTH_NOT_SET_IN_MAIN_SETTINGS")); } goto tm4l5; aS9cB: if (!$this->settingsData["PROP_ID_WEIGHT"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.WEIGHT_NOT_SET_IN_MAIN_SETTINGS")); } goto ZdnQ3; dWmEv: if ($this->settingsData["IBLOCK_SKU_USE"] && !$this->settingsData["IBLOCK_SKU_ID"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.NOT_EXIST_INFOBLOCK_SKU_ALTHOUGH_SKU_IS_CHECKED")); } goto GmRUA; YrhlW: if (!$this->settingsData["PROP_ID_PRIMARY_IMAGE"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.MAIN_IMAGE_NOT_SET_IN_MAIN_SETTINGS")); } goto smfZK; ZdnQ3: if (!$this->settingsData["PROP_WEIGHT_UNIT"]) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.WEIGHT_UNIT_NOT_SET_IN_MAIN_SETTINGS")); } goto Wz5Ds; a36Az: if (empty($this->settingsData)) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.MAIN_SETTINGS_NOT_SET")); } goto EVUaA; GmRUA: } protected function getRelationFields() : void { goto wTr78; kjOcX: foreach ($this->settingsData as $key => $value) { if (stripos($key, "PROP_ID") !== false) { if (is_numeric($value) && $value > 0) { $findProps[$key] = $value; } else { if ($value) { $this->relationFields[$key] = $value; } } } } goto PSLQS; wTr78: $findProps = []; goto kjOcX; PSLQS: if ($findProps) { $properties = \CIBlockProperty::GetList(["sort" => "asc", "name" => "asc"], ["IBLOCK_ID" => $this->settingsData["IBLOCK_SKU_ID"] ?: $this->settingsData["IBLOCK_ID"]]); while ($arProp = $properties->GetNext()) { foreach ($findProps as $key => $value) { if ($value == $arProp["ID"]) { $this->relationFields[$key] = "PROPERTY_" . $arProp["CODE"]; } } } } goto W0lVp; W0lVp: } public function updateTmpSettingsData(array $updateData) : void { foreach ($updateData as $key => $value) { $this->settingsData[$key] = $value; } } protected function setDomainName() : void { goto R9ipK; va7lK: $this->settingsData["DOMAIN_NAME"] = str_replace(["http://", "https://"], '', $this->settingsData["DOMAIN_NAME"]); goto FQjiM; FQjiM: $this->settingsData["DOMAIN_NAME"] = $this->settingsData["DOMAIN_NAME"] ? "https://" . $this->settingsData["DOMAIN_NAME"] : ''; goto EzL1A; R9ipK: $this->settingsData["DOMAIN_NAME"] = trim($this->settingsData["DOMAIN_NAME"]); goto va7lK; EzL1A: } protected function getDomainName() : string { return $this->settingsData["DOMAIN_NAME"]; } public function exportProducts(array $agentExportData = []) : bool { goto nZ8Eb; nZ8Eb: if (!$this->settingsData["EXPORT_ACTIVE"] || $this->settingsData["EXPORT_NOT_EXPORT_PRODUCT_INFORMATION"]) { return false; } goto c2Jd2; qvlmM: $nextAgentCategory = null; goto JnZ2x; JnZ2x: $date = new DateTime(); goto IqQXp; IqQXp: $date->format("d.m.Y H:i:s"); goto O9Q1x; c2Jd2: $importedProductArts = []; goto qvlmM; CnS3G: try { goto Jyjlb; VPRO1: if ($agentExportData && empty($products) && !$nextAgentCategory) { AgentsTable::update($agentExportData["ID"], ["CURRENT_CATEGORY_ID" => null, "CURRENT_PAGE" => null, "CURRENT_ARTICLES" => null, "DATE_UPDATE" => $date]); } goto eyCAY; eyCAY: return true; goto Ss63V; vag4D: $additionalFilter = []; goto SJM3N; ny2zH: $marketplaceObject = new OzonMarketplace(); goto vag4D; Jyjlb: $categoriesByMarketplaces = $this->getCategoriesForMarketplace(); goto ny2zH; SJM3N: foreach ($categoriesByMarketplaces as $key => $category) { goto J21ww; scFwD: do { $products = $this->getProducts($category["SITE_ID"], $page, $additionalProps, $additionalFilter); if (empty($products)) { $existProducts = false; } else { goto mwY6Z; mwY6Z: $importedProductArtsFlip = $importedProductArts ? array_flip($importedProductArts) : []; goto eDqvD; YNdIe: if ($agentExportData) { $existProducts = false; AgentsTable::update($agentExportData["ID"], ["CURRENT_CATEGORY_ID" => $category["SITE_ID"], "CURRENT_PAGE" => $page + 1, "CURRENT_ARTICLES" => Json::encode($importedProductArts, JSON_THROW_ON_ERROR), "DATE_UPDATE" => $date]); } else { $page++; } goto ekiIu; eDqvD: $preparedData = $marketplaceObject->prepareProductsDataForAdd($category["MARKET_ID"], $products, $additionalProps, $additionalPropsValues, $importedProductArtsFlip); goto EQWRi; W02iY: if ($event->getResults()) { foreach ($event->getResults() as $eventResult) { if ($eventResult->getResultType() !== EventResult::ERROR) { $preparedData = $eventResult->getParameters(); } } } goto QTqob; XPlYQ: $event->send(); goto W02iY; EQWRi: $event = new Event("guryev.ozon", "OnExportProduct", [$preparedData]); goto XPlYQ; e4jQb: $importedProductArtsTmp = array_merge(...$importedProductArtsTmp); goto rDKXd; QTqob: $taskData = $marketplaceObject->addProducts($preparedData)["taskIds"]; goto O2aBe; O2aBe: $importedProductArtsTmp = []; goto uuatV; rDKXd: $importedProductArts = !empty($importedProductArts) ? array_merge($importedProductArts, $importedProductArtsTmp) : $importedProductArtsTmp; goto YNdIe; uuatV: foreach ($taskData as $taskId => $productArticles) { try { $importedProductArtsTmp[] = $productArticles; $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRODUCTS, "STATUS" => MarketplaceInterface::IMPORT_STATUS_PENDING, "TASK_ID" => (string) $taskId, "PRODUCTS" => Json::encode($productArticles, JSON_THROW_ON_ERROR)]); } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRODUCTS, "STATUS" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "INFORMATION" => $e->getMessage()]); throw $e; } } goto e4jQb; ekiIu: } } while ($existProducts); goto D_aWG; D_aWG: if ($agentExportData) { if (empty($products)) { $nextAgentCategory = isset($categoriesByMarketplaces[$key + 1]) ? $categoriesByMarketplaces[$key + 1]["SITE_ID"] : null; AgentsTable::update($agentExportData["ID"], ["CURRENT_CATEGORY_ID" => $nextAgentCategory, "CURRENT_PAGE" => 1, "DATE_UPDATE" => $date]); } break; } goto TBbuy; gAptt: $additionalPropsValues = $this->getAdditionalPropsValuesForCategory($category["SITE_ID"], $category["MARKET_ID"], $additionalProps); goto scFwD; sogLK: $existProducts = true; goto IAZnc; XEhI1: if ($agentExportData && $agentCurrentCategory && $category["SITE_ID"] != $agentCurrentCategory) { continue; } goto sogLK; J21ww: if ($agentExportData) { $page = $agentCurrentPage; } else { $page = 1; } goto XEhI1; IAZnc: $additionalProps = $this->getAdditionalPropsForCategory($marketplaceObject, $category["SITE_ID"], $category["MARKET_ID"]); goto gAptt; TBbuy: } goto VPRO1; Ss63V: } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRODUCTS, "STATUS" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "INFORMATION" => $e->getMessage()]); return false; } goto e97at; O9Q1x: if ($agentExportData) { goto dFTw6; VCOsb: $agentCurrentCategory = $agentExportData["CURRENT_CATEGORY_ID"] ?: null; goto GNj7Z; dFTw6: $agentCurrentPage = $agentExportData["CURRENT_PAGE"] ?: 1; goto VCOsb; GNj7Z: $importedProductArts = $agentExportData["CURRENT_ARTICLES"] ? Json::decode($agentExportData["CURRENT_ARTICLES"]) : []; goto xuQuM; xuQuM: } goto CnS3G; e97at: } public function exportPrices(array $agentExportData = []) : bool { goto kkzF8; qAWy9: if ($agentExportData) { goto HtmEB; HtmEB: $agentCurrentPage = $agentExportData["CURRENT_PAGE"] ?: 1; goto dmUSb; dmUSb: $agentCurrentCategory = $agentExportData["CURRENT_CATEGORY_ID"] ?: null; goto TjS2Y; TjS2Y: $importedProductArts = $agentExportData["CURRENT_ARTICLES"] ? Json::decode($agentExportData["CURRENT_ARTICLES"]) : []; goto hoydW; hoydW: } goto mvIEX; kkzF8: if (!$this->settingsData["EXPORT_ACTIVE"] || $this->settingsData["EXPORT_NOT_EXPORT_PRICE"]) { return false; } goto dMF1K; mvIEX: try { goto WJtg0; K34R5: foreach ($categoriesByMarketplaces as $key => $category) { goto AtoY8; FhUkm: $existProducts = true; goto A_Muo; v2feN: if ($agentExportData && $agentCurrentCategory && $category["SITE_ID"] != $agentCurrentCategory) { continue; } goto FhUkm; H81Ud: if ($agentExportData) { if (empty($products)) { $nextAgentCategory = isset($categoriesByMarketplaces[$key + 1]) ? $categoriesByMarketplaces[$key + 1]["SITE_ID"] : null; AgentsTable::update($agentExportData["ID"], ["CURRENT_CATEGORY_ID" => $nextAgentCategory, "CURRENT_PAGE" => 1, "DATE_UPDATE" => $date]); } break; } goto oZfkx; A_Muo: do { $products = $this->getProducts($category["SITE_ID"], $page, [], []); if (empty($products)) { $existProducts = false; } else { goto jK1Ud; x5yPg: $event->send(); goto GFOwW; Le5bT: $importedProductArts = !empty($importedProductArts) ? array_merge($importedProductArts, $importedProductArtsTmp) : $importedProductArtsTmp; goto f8Jmj; GFOwW: if ($event->getResults()) { foreach ($event->getResults() as $eventResult) { if ($eventResult->getResultType() !== EventResult::ERROR) { $preparedData = $eventResult->getParameters(); } } } goto nzO0B; nzO0B: $productsPriceUpdateRes = $marketplaceObject->updateProductsPrices($preparedData, true); goto n8hMN; jK1Ud: $importedProductArtsFlip = array_flip($importedProductArts); goto LZHRR; LjPJ6: foreach ($productsPriceUpdateRes["productArtsInfo"] as $info) { try { if (!empty($info["updated"])) { $importedProductArtsTmp[] = $info["updated"]; $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRICES, "STATUS" => MarketplaceInterface::IMPORT_STATUS_UPDATED, "PRODUCTS" => Json::encode($info["updated"], JSON_THROW_ON_ERROR)]); } if (!empty($info["errors"])) { goto NQoSX; NQoSX: $productArtsKeys = array_keys($info["errors"]); goto dcYfK; hZUzv: $importedProductArtsTmp[] = $productArtsKeys; goto EHJ7h; EHJ7h: $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRICES, "STATUS" => MarketplaceInterface::IMPORT_STATUS_FAILED, "PRODUCTS" => Json::encode($productArtsKeys, JSON_THROW_ON_ERROR), "INFORMATION" => Json::encode($info["errors"], JSON_THROW_ON_ERROR)]); goto n7lJA; dcYfK: foreach ($productArtsKeys as $keyArt => $artVal) { $productArtsKeys[$keyArt] = (string) $artVal; } goto hZUzv; n7lJA: } } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRICES, "STATUS" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "INFORMATION" => $e->getMessage()]); throw $e; } } goto ONeI5; ONeI5: $importedProductArtsTmp = array_merge(...$importedProductArtsTmp); goto Le5bT; LZHRR: $preparedData = $marketplaceObject->prepareProductsDataForUpdatePrices($products, $importedProductArtsFlip); goto qD6wn; n8hMN: $importedProductArtsTmp = []; goto LjPJ6; qD6wn: $event = new Event("guryev.ozon", "OnExportPrice", [$preparedData]); goto x5yPg; f8Jmj: if ($agentExportData) { $existProducts = false; AgentsTable::update($agentExportData["ID"], ["CURRENT_CATEGORY_ID" => $category["SITE_ID"], "CURRENT_PAGE" => $page + 1, "CURRENT_ARTICLES" => Json::encode($importedProductArts, JSON_THROW_ON_ERROR), "DATE_UPDATE" => $date]); } else { $page++; } goto DydRa; DydRa: } } while ($existProducts); goto H81Ud; AtoY8: if ($agentExportData) { $page = $agentCurrentPage; } else { $page = 1; } goto v2feN; oZfkx: } goto AT89D; WJtg0: $categoriesByMarketplaces = $this->getCategoriesForMarketplace(); goto WLUW2; I_TYm: return true; goto OY_pq; WLUW2: $marketplaceObject = new OzonMarketplace(); goto K34R5; AT89D: if ($agentExportData && empty($products) && !$nextAgentCategory) { AgentsTable::update($agentExportData["ID"], ["CURRENT_CATEGORY_ID" => null, "CURRENT_PAGE" => null, "CURRENT_ARTICLES" => null, "DATE_UPDATE" => $date]); } goto I_TYm; OY_pq: } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRICES, "STATUS" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "INFORMATION" => $e->getMessage()]); return false; } goto LP3Fp; SWeiI: $date = new DateTime(); goto CVksn; yceQB: $nextAgentCategory = null; goto SWeiI; CVksn: $date->format("d.m.Y H:i:s"); goto qAWy9; dMF1K: $importedProductArts = []; goto yceQB; LP3Fp: } public function exportStocks(array $agentExportData = []) : bool { goto uBN7z; aC_S0: try { goto WuvXn; l3RRH: if (!$useWarehouse) { goto K57nw; K57nw: $ozonWarehouses = $marketplaceObject->getWarehouses(); goto j9Y2S; j9Y2S: $ozonWarehouses = $ozonWarehouses["result"] ?: []; goto A5p5H; A5p5H: if (count($ozonWarehouses) > 1) { $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_STOCKS, "STATUS" => MarketplaceInterface::IMPORT_STATUS_FAILED, "INFORMATION" => Loc::getMessage("GURYEV_OZON.INCLUDE.HAVE_MORE_THAN_ONE_WAREHOUSE")]); return false; } goto eq1CC; eq1CC: } goto hc4_z; hc4_z: foreach ($categoriesByMarketplaces as $key => $category) { goto nT3Sc; gi0Uq: if ($agentExportData) { if (empty($products)) { $nextAgentCategory = isset($categoriesByMarketplaces[$key + 1]) ? $categoriesByMarketplaces[$key + 1]["SITE_ID"] : null; AgentsTable::update($agentExportData["ID"], ["CURRENT_CATEGORY_ID" => $nextAgentCategory, "CURRENT_PAGE" => 1, "DATE_UPDATE" => $date]); } break; } goto U57kR; XAzJx: if ($agentExportData && $agentCurrentCategory && $category["SITE_ID"] != $agentCurrentCategory) { continue; } goto xojXv; F0VQT: do { $products = $this->getProducts($category["SITE_ID"], $page, [], []); if (empty($products)) { $existProducts = false; } else { goto bOrxS; x7OnN: if ($event->getResults()) { foreach ($event->getResults() as $eventResult) { if ($eventResult->getResultType() !== EventResult::ERROR) { $preparedData = $eventResult->getParameters(); } } } goto vvRqA; VJDIm: if ($agentExportData) { $existProducts = false; AgentsTable::update($agentExportData["ID"], ["CURRENT_CATEGORY_ID" => $category["SITE_ID"], "CURRENT_PAGE" => $page + 1, "CURRENT_ARTICLES" => Json::encode($importedProductArts, JSON_THROW_ON_ERROR), "DATE_UPDATE" => $date]); } else { $page++; } goto pPKFG; wHmzA: $importedProductArtsTmp = []; goto F6Kkg; LS1BM: $importedProductArts = !empty($importedProductArts) ? array_merge($importedProductArts, $importedProductArtsTmp) : $importedProductArtsTmp; goto VJDIm; Wbi7K: $event->send(); goto x7OnN; d53t0: $importedProductArtsTmp = array_merge(...$importedProductArtsTmp); goto LS1BM; PxHJW: $preparedData = $marketplaceObject->prepareProductsDataForUpdateStocks($products, $useWarehouse, $importedProductArtsFlip); goto H27OM; bOrxS: $importedProductArtsFlip = array_flip($importedProductArts); goto PxHJW; vvRqA: $productsStockUpdateRes = $marketplaceObject->updateProductsStocks($preparedData, $useWarehouse, true); goto wHmzA; F6Kkg: foreach ($productsStockUpdateRes["productArtsInfo"] as $info) { try { if (!empty($info["updated"])) { $importedProductArtsTmp[] = $info["updated"]; $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_STOCKS, "STATUS" => MarketplaceInterface::IMPORT_STATUS_UPDATED, "PRODUCTS" => Json::encode($info["updated"], JSON_THROW_ON_ERROR)]); } if (!empty($info["errors"])) { goto mdqqT; SKiuS: foreach ($productArtsKeys as $keyArt => $artVal) { $productArtsKeys[$keyArt] = (string) $artVal; } goto FxeCq; nrki2: $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_STOCKS, "STATUS" => MarketplaceInterface::IMPORT_STATUS_FAILED, "PRODUCTS" => Json::encode($productArtsKeys, JSON_THROW_ON_ERROR), "INFORMATION" => Json::encode($info["errors"], JSON_THROW_ON_ERROR)]); goto gsX9B; FxeCq: $importedProductArtsTmp[] = $productArtsKeys; goto nrki2; mdqqT: $productArtsKeys = array_keys($info["errors"]); goto SKiuS; gsX9B: } } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_STOCKS, "STATUS" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "INFORMATION" => $e->getMessage()]); throw $e; } } goto d53t0; H27OM: $event = new Event("guryev.ozon", "OnExportStock", [$preparedData]); goto Wbi7K; pPKFG: } } while ($existProducts); goto gi0Uq; xojXv: $existProducts = true; goto F0VQT; nT3Sc: if ($agentExportData) { $page = $agentCurrentPage; } else { $page = 1; } goto XAzJx; U57kR: } goto MZL0Q; myuU1: $useWarehouse = $this->settingsData["WAREHOUSE_ID"] ? true : false; goto l3RRH; MZL0Q: if ($agentExportData && empty($products) && !$nextAgentCategory) { AgentsTable::update($agentExportData["ID"], ["CURRENT_CATEGORY_ID" => null, "CURRENT_PAGE" => null, "CURRENT_ARTICLES" => null, "DATE_UPDATE" => $date]); } goto UPj6f; iq_QU: $marketplaceObject = new OzonMarketplace(); goto myuU1; WuvXn: $categoriesByMarketplaces = $this->getCategoriesForMarketplace(); goto iq_QU; UPj6f: return true; goto kzMlV; kzMlV: } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["TYPE" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRICES, "STATUS" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "INFORMATION" => $e->getMessage()]); return false; } goto XD6pD; uDNcm: $nextAgentCategory = null; goto AJzca; bRvvG: if ($agentExportData) { goto UW2g2; sPHmr: $agentCurrentCategory = $agentExportData["CURRENT_CATEGORY_ID"] ?: null; goto Xy2Eu; UW2g2: $agentCurrentPage = $agentExportData["CURRENT_PAGE"] ?: 1; goto sPHmr; Xy2Eu: $importedProductArts = $agentExportData["CURRENT_ARTICLES"] ? Json::decode($agentExportData["CURRENT_ARTICLES"]) : []; goto N4HL8; N4HL8: } goto aC_S0; tLmg3: $date->format("d.m.Y H:i:s"); goto bRvvG; bnRvG: $importedProductArts = []; goto uDNcm; uBN7z: if (!$this->settingsData["EXPORT_ACTIVE"] || $this->settingsData["EXPORT_NOT_EXPORT_STOCK"]) { return false; } goto bnRvG; AJzca: $date = new DateTime(); goto tLmg3; XD6pD: } public function getCategoriesForMarketplace() : array { goto aL7_Y; UZT7b: $siteSectionIds = []; goto cghEb; CUSU0: if ($this->settingsData["IBLOCK_SKU_USE"]) { $arFilterCharacteristicsConnections["IBLOCK_SKU_USE"] = 1; } else { $arFilterCharacteristicsConnections["IBLOCK_SKU_USE"] = null; } goto fWkM0; vObdh: $arFilterMarketplacesCategoriesConditions = array_values($arFilterMarketplacesCategoriesConditions); goto Bqirc; fWkM0: $characteristicsConnections = CharacteristicsConnectionsTable::getList(["filter" => $arFilterCharacteristicsConnections, "select" => ["CATEGORY_ID", "MARKET_CATEGORY_ID"]]); goto llNFf; qCZqR: $iblockSectionIds = []; goto zC7OP; kbKvj: return $result; goto hEIOg; llNFf: $arFilterMarketplacesCategories = ["LOGIC" => "OR"]; goto vph4w; fwyRJ: while ($arSection = $rsSection->Fetch()) { $iblockSectionIds[$arSection["ID"]] = $arSection["ID"]; } goto T1qwW; aL7_Y: $result = []; goto CUSU0; T1qwW: foreach ($categoriesConnectionsData as $value) { if ($iblockSectionIds[$value["SITE_ID"]]) { $result[] = $value; } } goto kbKvj; pJd4G: while ($row = $characteristicsConnections->fetch()) { $arFilterMarketplacesCategoriesConditions[$row["CATEGORY_ID"] . "_" . $row["MARKET_CATEGORY_ID"]] = ["ACTIVE" => 1, "SITE_ID" => $row["CATEGORY_ID"], "MARKET_ID" => $row["MARKET_CATEGORY_ID"]]; } goto vObdh; WPDtF: $categoriesConnectionsData = CategoriesConnectionsTable::getList(["filter" => $arFilterMarketplacesCategories, "select" => ["ID", "SITE_ID", "MARKET_ID"]])->fetchAll(); goto UZT7b; cghEb: foreach ($categoriesConnectionsData as $value) { $siteSectionIds[] = $value["SITE_ID"]; } goto qCZqR; euaUA: $arFilterMarketplacesCategories = array_merge($arFilterMarketplacesCategories, $arFilterMarketplacesCategoriesConditions); goto WPDtF; Bqirc: if (empty($arFilterMarketplacesCategoriesConditions)) { return $result; } goto euaUA; vph4w: $arFilterMarketplacesCategoriesConditions = []; goto pJd4G; zC7OP: $rsSection = SectionTable::getList(array("filter" => array("IBLOCK_ID" => $this->settingsData["IBLOCK_ID"], "ID" => $siteSectionIds, "GLOBAL_ACTIVE" => "Y"), "select" => ["ID", "IBLOCK_SECTION_ID", "IBLOCK_ID"])); goto fwyRJ; hEIOg: } public function getAdditionalPropsForCategory(MarketplaceInterface $marketplaceObject, int $siteSectionId, string $marketSectionId) : array { goto DFL6u; hOIxd: $characteristicsConnections = CharacteristicsConnectionsTable::getList(["filter" => $arFilterCharacteristicsConnections, "select" => ["ID", "PROPERTY_ID", "MARKET_ID"]]); goto lHeul; TkgxP: $properties = PropertyTable::getList(array("select" => array("ID", "IBLOCK_ID", "CODE", "PROPERTY_TYPE", "HINT"), "filter" => array("=IBLOCK_ID" => $this->settingsData["IBLOCK_SKU_ID"] ?: $this->settingsData["IBLOCK_ID"], "=ID" => array_keys($characteristicsConnectionsProcessed), "=ACTIVE" => "Y"), "order" => array("SORT" => "ASC")))->fetchAll(); goto G8igk; ZFmU7: if (!$marketplaceCategoryProperties) { return []; } goto u49a7; Q2vKl: $characteristicsConnectionsProcessed = []; goto rSCEi; lHeul: while ($row = $characteristicsConnections->fetch()) { $characteristicsConnectionsProcessed[$row["PROPERTY_ID"]][] = $row; } goto gh7ku; gh7ku: $marketplaceCategoryProperties = $marketplaceObject->getCategoryProperties([$marketSectionId])[0]["values"]; goto ZFmU7; u49a7: $marketplaceCategoryPropertiesProcessed = []; goto yE7US; yE7US: foreach ($marketplaceCategoryProperties as $marketplaceCategoryProperty) { $marketplaceCategoryPropertiesProcessed[$marketplaceCategoryProperty["id"]] = $marketplaceCategoryProperty; } goto TkgxP; rSCEi: $arFilterCharacteristicsConnections = ["CATEGORY_ID" => $siteSectionId, "MARKET_CATEGORY_ID" => $marketSectionId]; goto kLS79; RO8MK: return $result; goto Aj14k; G8igk: foreach ($properties as $property) { $characteristicConnections = $characteristicsConnectionsProcessed[$property["ID"]]; foreach ($characteristicConnections as $characteristicConnection) { $marketplaceCategoryProperty = $marketplaceCategoryPropertiesProcessed[$characteristicConnection["MARKET_ID"]]; $result[] = ["SITE_PROPERTY_DATA" => ["ID" => $characteristicConnection["PROPERTY_ID"], "CODE" => $property["CODE"], "TYPE" => $property["PROPERTY_TYPE"], "HINT" => $property["HINT"]], "MARKET_PROPERTY_DATA" => $marketplaceCategoryProperty]; } } goto RO8MK; kLS79: if ($this->settingsData["IBLOCK_SKU_USE"]) { $arFilterCharacteristicsConnections["IBLOCK_SKU_USE"] = 1; } else { $arFilterCharacteristicsConnections["IBLOCK_SKU_USE"] = null; } goto hOIxd; DFL6u: $result = []; goto Q2vKl; Aj14k: } public function getAdditionalPropsValuesForCategory(int $siteSectionId, string $marketSectionId, array $additionalProps) : array { goto N70GO; JWred: if ($this->settingsData["IBLOCK_SKU_USE"]) { $arFilterCharacteristicsValuesConnections["IBLOCK_SKU_USE"] = 1; } else { $arFilterCharacteristicsValuesConnections["IBLOCK_SKU_USE"] = null; } goto exx0u; exx0u: $characteristicsValuesConnections = ValuesConnectionsTable::getList(["filter" => $arFilterCharacteristicsValuesConnections, "select" => ["ID", "PROPERTY_ID", "SITE_VALUE_ID", "MARKET_ID", "MARKET_VALUE_ID", "MARKET_VALUE_NAME"]]); goto j0nvy; j0nvy: while ($row = $characteristicsValuesConnections->fetch()) { $result[$row["PROPERTY_ID"]][] = $row; } goto zn32s; N70GO: $result = []; goto yhXjT; Dyz4N: foreach ($additionalProps as $value) { $sitePropertyIDs[] = $value["SITE_PROPERTY_DATA"]["ID"]; } goto FQvEL; zn32s: return $result; goto RUzNW; yhXjT: $sitePropertyIDs = []; goto Dyz4N; FQvEL: $arFilterCharacteristicsValuesConnections = ["CATEGORY_ID" => $siteSectionId, "MARKET_CATEGORY_ID" => $marketSectionId, "PROPERTY_ID" => $sitePropertyIDs]; goto JWred; RUzNW: } public function getProducts(int $sectionId, int $page, array $additionalProps, array $additionalFilter = []) : array { goto g8oEP; X6U2A: $selectProps = array_merge(array_values($this->relationFields), $propCodes); goto Gj6x7; CzFkA: if (!$this->settingsData["EXPORT_NOT_ACTIVE"]) { $arFilter["ACTIVE"] = "Y"; $arFilterSku["ACTIVE"] = "Y"; } goto fwFyd; qe31A: if ($needRepeatUpdate) { foreach ($result as $productId => $data) { goto c6wcL; e7j2v: if (isset($productsPrice["PRICE"][$productId]) && $productsPrice["PRICE"][$productId] >= 0) { $result[$productId]["FIELDS"]["PROP_ID_PRICE"] = $productsPrice["PRICE"][$productId]; } goto sigg4; MiLWR: if (isset($productsPrice["PREMIUM_PRICE"][$productId]) && $productsPrice["PREMIUM_PRICE"][$productId] >= 0) { $result[$productId]["FIELDS"]["PROP_ID_PREMIUM_PRICE"] = $productsPrice["PREMIUM_PRICE"][$productId]; } goto OMbFV; sigg4: if (isset($productsPrice["OLD_PRICE"][$productId]) && $productsPrice["OLD_PRICE"][$productId] >= 0) { $result[$productId]["FIELDS"]["PROP_ID_OLD_PRICE"] = $productsPrice["OLD_PRICE"][$productId]; } goto MiLWR; c6wcL: if (isset($productsCount[$productId]) && $productsCount[$productId] >= 0) { $result[$productId]["FIELDS"]["PROP_ID_STOCK"] = $productsCount[$productId]; } goto e7j2v; OMbFV: } } goto b0R6S; koBXQ: $needRepeatUpdate = false; goto B06PD; L0170: if ($additionalFilter) { $arFilter = array_merge($arFilter, $additionalFilter); } goto sMP4U; qgmOj: if (Loader::includeModule("sale") && $productIds && ($this->settingsData["PROP_ID_PRICE"] && !is_numeric($this->settingsData["PROP_ID_PRICE"]) || $this->settingsData["PROP_ID_OLD_PRICE"] && !is_numeric($this->settingsData["PROP_ID_OLD_PRICE"]) || $this->settingsData["PROP_ID_PREMIUM_PRICE"] && !is_numeric($this->settingsData["PROP_ID_PREMIUM_PRICE"]))) { goto yst1j; l6aI1: $dbPriceTypes = \CCatalogGroup::GetList([], []); goto W11_0; W11_0: while ($arPriceType = $dbPriceTypes->Fetch()) { $priceTypes[$arPriceType["XML_ID"]] = $arPriceType["ID"]; } goto Me6Aj; SJ490: while ($arPriceProduct = $rsPricesProducts->fetch()) { if ($propIdPriceCatalogGroupId && $arPriceProduct["CATALOG_GROUP_ID"] == $propIdPriceCatalogGroupId) { $productsPrice["PRICE"][$arPriceProduct["PRODUCT_ID"]] = $arPriceProduct["PRICE"]; } if ($propIdOldPriceCatalogGroupId && $arPriceProduct["CATALOG_GROUP_ID"] == $propIdOldPriceCatalogGroupId) { $productsPrice["OLD_PRICE"][$arPriceProduct["PRODUCT_ID"]] = $arPriceProduct["PRICE"]; } if ($propIdPremiumPriceCatalogGroupId && $arPriceProduct["CATALOG_GROUP_ID"] == $propIdPremiumPriceCatalogGroupId) { $productsPrice["PREMIUM_PRICE"][$arPriceProduct["PRODUCT_ID"]] = $arPriceProduct["PRICE"]; } } goto qKgph; qKgph: $needRepeatUpdate = true; goto BpkVE; yst1j: $priceTypes = []; goto l6aI1; Me6Aj: $propIdPriceCatalogGroupId = $priceTypes[$this->relationFields["PROP_ID_PRICE"]] ?: null; goto rRMdu; tm_QJ: $propIdPremiumPriceCatalogGroupId = $priceTypes[$this->relationFields["PROP_ID_PREMIUM_PRICE"]] ?: null; goto BCtJD; rRMdu: $propIdOldPriceCatalogGroupId = $priceTypes[$this->relationFields["PROP_ID_OLD_PRICE"]] ?: null; goto tm_QJ; BCtJD: $rsPricesProducts = \Bitrix\Catalog\PriceTable::getList(["select" => ["*"], "filter" => ["=PRODUCT_ID" => $productIds]]); goto SJ490; BpkVE: } goto qe31A; b0R6S: return $result; goto if44M; Gj6x7: if ($this->settingsData["IBLOCK_SKU_USE"] && $this->settingsData["IBLOCK_SKU_ID"] && $additionalFilter["SKU_ID"]) { $arFilter = ["IBLOCK_ID" => $this->settingsData["IBLOCK_SKU_ID"], "ID" => $additionalFilter["SKU_ID"]]; } else { $arFilter = ["IBLOCK_ID" => $this->settingsData["IBLOCK_ID"], "SECTION_ID" => $sectionId]; $arFilterSku = ["IBLOCK_ID" => $this->settingsData["IBLOCK_SKU_ID"]]; } goto CzFkA; g8oEP: $result = []; goto OLKxZ; sHl6D: $productsPrice = []; goto sSkAB; OLKxZ: $propCodes = []; goto REswP; ECzOf: if ($this->settingsData["IBLOCK_SKU_USE"] && $this->settingsData["IBLOCK_SKU_ID"] && !$additionalFilter["SKU_ID"]) { goto Ubm6u; Ubm6u: $resElems = \CIBlockElement::GetList(["ID" => "ASC"], $arFilter, false, ["iNumPage" => $page, "nPageSize" => self::COUNT_ELEMENTS_FOR_CATEGORY, "checkOutOfRange" => true], ["IBLOCK_ID", "ID"]); goto pAiJW; flNpd: while ($arElem = $resElems->GetNext()) { $mainProductsIds[] = $arElem["ID"]; } goto L5Yy2; pAiJW: $mainProductsIds = []; goto flNpd; L5Yy2: if ($mainProductsIds) { goto yGkt8; V3rXS: $rsOffers = \CIBlockElement::GetList(["ID" => "ASC"], $arFilterSku, false, false, array_merge(["IBLOCK_ID", "ID"], $selectProps)); goto AbsBT; yGkt8: $arFilterSku["PROPERTY_" . $this->settingsData["SKU_PROPERTY_ID"]] = $mainProductsIds; goto V3rXS; AbsBT: while ($arOffer = $rsOffers->GetNextElement()) { $preparedElemData = $this->prepareElemDataForGetProducts($arOffer); $productIds[] = $preparedElemData["ID"]; $result[$preparedElemData["ID"]] = $preparedElemData; } goto QmfOs; QmfOs: } goto XYGPe; XYGPe: } else { $resElems = \CIBlockElement::GetList(["ID" => "ASC"], $arFilter, false, ["iNumPage" => $page, "nPageSize" => self::COUNT_ELEMENTS_FOR_CATEGORY, "checkOutOfRange" => true], array_merge(["IBLOCK_ID", "ID"], $selectProps)); while ($arElem = $resElems->GetNextElement()) { $preparedElemData = $this->prepareElemDataForGetProducts($arElem); $productIds[] = $preparedElemData["ID"]; $result[$preparedElemData["ID"]] = $preparedElemData; } } goto koBXQ; sSkAB: if (Loader::includeModule("catalog") && $this->settingsData["PROP_ID_STOCK"] === "STORE_COUNT" && $productIds) { goto MsMsN; Kx77r: $needRepeatUpdate = true; goto nCh9i; MsMsN: $rsStoreProducts = \Bitrix\Catalog\StoreProductTable::getList(array("filter" => array("PRODUCT_ID" => $productIds, "STORE.ACTIVE" => "Y"))); goto uiGTm; uiGTm: while ($arStoreProduct = $rsStoreProducts->fetch()) { $productsCount[$arStoreProduct["PRODUCT_ID"]] += $arStoreProduct["AMOUNT"]; } goto Kx77r; nCh9i: } goto qgmOj; REswP: foreach ($additionalProps as $additionalProp) { $propCodes[] = $additionalProp["SITE_PROPERTY_DATA"]["CODE"]; } goto X6U2A; B06PD: $productsCount = []; goto sHl6D; sMP4U: $productIds = []; goto ECzOf; fwFyd: if ($this->settingsData["CUSTOM_FILTER"]) { $this->settingsData["CUSTOM_FILTER_SHORT"] = $this->settingsData["CUSTOM_FILTER"] ? Json::decode($this->settingsData["CUSTOM_FILTER"]) : null; if (Loader::includeModule("catalog") && !$this->settingsData["CUSTOM_FILTER_SHORT"]["PROPERTY_ID"]) { goto hGWgp; Fs5tx: $productFilter->prepareFilter(); goto DS7_T; DS7_T: $productFilterProcessed = $productFilter->getProcessedFilter(); goto xVeb6; xVeb6: $arFilter = array_merge($arFilter, $productFilterProcessed); goto NQFRr; hGWgp: $productFilter = new ProductFilter($this->settingsData["CUSTOM_FILTER"]); goto Fs5tx; NQFRr: } else { goto ahJtp; ahJtp: $shortFilterForIblockSku = false; goto rcIK9; BnCiE: if (!$this->settingsData["IBLOCK_SKU_USE"] || !$shortFilterForIblockSku) { $arFilter = array_merge($arFilter, ["PROPERTY_" . $this->settingsData["CUSTOM_FILTER_SHORT"]["PROPERTY_ID"] => $this->settingsData["CUSTOM_FILTER_SHORT"]["PROPERTY_VALUE"]]); } goto Rt4FF; rcIK9: if ($this->settingsData["IBLOCK_SKU_USE"]) { goto tg_be; FjE50: $skuProperties = \CIBlockProperty::GetList(["id" => "asc"], ["IBLOCK_ID" => $this->settingsData["IBLOCK_SKU_ID"]]); goto YWdHe; tg_be: $skuPropertyIds = []; goto FjE50; Fj5E2: if ($skuPropertyIds[$this->settingsData["CUSTOM_FILTER_SHORT"]["PROPERTY_ID"]]) { $arFilterSku = array_merge($arFilterSku, ["PROPERTY_" . $this->settingsData["CUSTOM_FILTER_SHORT"]["PROPERTY_ID"] => $this->settingsData["CUSTOM_FILTER_SHORT"]["PROPERTY_VALUE"]]); $shortFilterForIblockSku = true; } goto QxPwR; YWdHe: while ($arSkuProp = $skuProperties->GetNext()) { $skuPropertyIds[$arSkuProp["ID"]] = $arSkuProp["ID"]; } goto Fj5E2; QxPwR: } goto BnCiE; Rt4FF: } } goto L0170; if44M: } protected function prepareElemDataForGetProducts($arElem) : array { goto cFOj0; nzoHb: foreach ($props as $prop) { goto Hhhfd; Hf1uT: $processedFields[$prop["CODE"]] = ["ID" => $prop["ID"], "CODE" => $prop["CODE"], "NAME" => $prop["NAME"], "PROPERTY_TYPE" => $prop["PROPERTY_TYPE"], "LIST_TYPE" => $prop["LIST_TYPE"], "MULTIPLE" => $prop["MULTIPLE"], "HINT" => $prop["HINT"], "VALUES" => $values]; goto QyIiB; Hhhfd: $values = []; goto pLQy6; pLQy6: if (is_array($prop["VALUE"])) { foreach ($prop["VALUE"] as $key => $propVal) { $values[] = ["ID" => $prop["VALUE_ENUM_ID"][$key] ?: null, "VALUE" => $propVal]; } } else { $values[] = ["ID" => $prop["VALUE_ENUM_ID"] ?: null, "VALUE" => $prop["VALUE"]]; } goto Hf1uT; QyIiB: } goto dsJnz; HGxy2: $props = $arElem->GetProperties(); goto ioSeR; cFOj0: $fields = $arElem->GetFields(); goto HGxy2; ioSeR: $processedFields = []; goto nzoHb; dsJnz: return ["ID" => $fields["ID"], "FIELDS" => $this->prepareFieldsForGetProducts($fields, $props), "COMMON_ADDITIONAL_PROPERTIES" => $this->getCommonAdditionalProps($fields, $props), "PROPERTIES" => $processedFields]; goto uO9fl; uO9fl: } protected function prepareFieldsForGetProducts(array $fields, array $props) : array { goto QP0Jw; FSkzr: if (is_numeric($this->settingsData["PROP_ID_NAME"])) { $result["PROP_ID_NAME"] = $this->findProperty($props, "PROP_ID_NAME")["VALUE"]; } else { $result["PROP_ID_NAME"] = $fields[$this->relationFields["PROP_ID_NAME"]]; } goto LiC6m; d1Pp7: if (is_numeric($this->settingsData["PROP_ID_WIDTH"])) { $result["PROP_ID_WIDTH"] = $this->findProperty($props, "PROP_ID_WIDTH")["VALUE"]; } elseif (Loader::includeModule("sale")) { $result["PROP_ID_WIDTH"] = $fields[$this->relationFields["PROP_ID_WIDTH"]]; } else { $result["PROP_ID_WIDTH"] = null; } goto l5wPa; PnUKQ: $result["PROP_VAT"] = $this->settingsData["PROP_VAT"]; goto W1BGe; byeZ3: if (is_numeric($this->settingsData["PROP_ID_HEIGHT"])) { $result["PROP_ID_HEIGHT"] = $this->findProperty($props, "PROP_ID_HEIGHT")["VALUE"]; } elseif (Loader::includeModule("sale")) { $result["PROP_ID_HEIGHT"] = $fields[$this->relationFields["PROP_ID_HEIGHT"]]; } else { $result["PROP_ID_HEIGHT"] = 0; } goto LgAib; W1BGe: $result["PROP_WEIGHT_UNIT"] = $this->settingsData["PROP_WEIGHT_UNIT"]; goto zPoeH; zPoeH: $result["PROP_SERVICE_TYPE"] = $this->settingsData["PROP_SERVICE_TYPE"]; goto KcF8c; LgAib: if (is_numeric($this->settingsData["PROP_ID_LENGTH"])) { $result["PROP_ID_LENGTH"] = $this->findProperty($props, "PROP_ID_LENGTH")["VALUE"]; } elseif (Loader::includeModule("sale")) { $result["PROP_ID_LENGTH"] = $fields[$this->relationFields["PROP_ID_LENGTH"]]; } else { $result["PROP_ID_LENGTH"] = null; } goto d1Pp7; p27Gv: if (is_numeric($this->settingsData["PROP_ID_PREMIUM_PRICE"])) { $result["PROP_ID_PREMIUM_PRICE"] = $this->findProperty($props, "PROP_ID_PREMIUM_PRICE")["VALUE"]; } else { $result["PROP_ID_PREMIUM_PRICE"] = null; } goto qBJUM; YUOo2: $result["WAREHOUSE_ID"] = $this->settingsData["WAREHOUSE_ID"] ?: null; goto FSkzr; aTQ9c: if (is_numeric($this->settingsData["PROP_ID_IMAGES"])) { $prop = $this->findProperty($props, "PROP_ID_IMAGES"); if ($prop["PROPERTY_TYPE"] === "F") { foreach ($prop["VALUE"] as $propVal) { $result["PROP_ID_IMAGES"][] = $this->getDomainName() . \CFile::GetPath($propVal); } } else { if ($prop["MULTIPLE"] === "Y") { foreach ($prop["VALUE"] as $propVal) { $result["PROP_ID_IMAGES"][] = $this->getDomainName() . $propVal; } } elseif ($prop["VALUE"]) { $result["PROP_ID_IMAGES"][] = $this->getDomainName() . $prop["VALUE"]; } } } else { $prop = \CFile::GetPath($fields[$this->relationFields["PROP_ID_IMAGES"]]); if ($prop) { $result["PROP_ID_IMAGES"][] = $this->getDomainName() . $prop; } } goto byeZ3; l5wPa: if (is_numeric($this->settingsData["PROP_ID_WEIGHT"])) { $result["PROP_ID_WEIGHT"] = $this->findProperty($props, "PROP_ID_WEIGHT")["VALUE"]; } elseif (Loader::includeModule("sale")) { $result["PROP_ID_WEIGHT"] = $fields[$this->relationFields["PROP_ID_WEIGHT"]]; } else { $result["PROP_ID_WEIGHT"] = null; } goto dlso3; qrwpu: $result["PROP_DIMENSION_UNIT"] = $this->settingsData["PROP_DIMENSION_UNIT"]; goto PnUKQ; RzJL6: if (is_numeric($this->settingsData["PROP_ID_DESC"])) { $result["PROP_ID_DESC"] = $this->findProperty($props, "PROP_ID_DESC")["VALUE"]; } else { $result["PROP_ID_DESC"] = $fields[$this->relationFields["PROP_ID_DESC"]]; } goto VYp3G; WeAYl: if (is_numeric($this->settingsData["PROP_ID_COLOR_IMAGE"])) { $result["PROP_ID_COLOR_IMAGE"] = $this->findProperty($props, "PROP_ID_COLOR_IMAGE")["VALUE"]; } else { $result["PROP_ID_COLOR_IMAGE"] = $fields[$this->relationFields["PROP_ID_COLOR_IMAGE"]]; } goto aB0VY; qBJUM: if (is_numeric($this->settingsData["PROP_ID_STOCK"])) { $result["PROP_ID_STOCK"] = $this->findProperty($props, "PROP_ID_STOCK")["VALUE"]; } elseif ($this->settingsData["PROP_ID_STOCK"] === "CATALOG_QUANTITY") { $result["PROP_ID_STOCK"] = $fields[$this->relationFields["PROP_ID_STOCK"]]; } else { $result["PROP_ID_STOCK"] = 0; } goto iJwxw; qks9n: if (is_numeric($this->settingsData["PROP_ID_OLD_PRICE"])) { $result["PROP_ID_OLD_PRICE"] = $this->findProperty($props, "PROP_ID_OLD_PRICE")["VALUE"]; } else { $result["PROP_ID_OLD_PRICE"] = null; } goto p27Gv; dlso3: if (is_numeric($this->settingsData["PROP_ID_BARCODE"])) { $result["PROP_ID_BARCODE"] = $this->findProperty($props, "PROP_ID_BARCODE")["VALUE"]; } else { $result["PROP_ID_BARCODE"] = $fields[$this->relationFields["PROP_ID_BARCODE"]]; } goto WeAYl; WlrQK: if (is_numeric($this->settingsData["PROP_ID_PRIMARY_IMAGE"])) { $prop = $this->findProperty($props, "PROP_ID_PRIMARY_IMAGE"); $result["PROP_ID_PRIMARY_IMAGE"] = $prop["VALUE"] ? $this->getDomainName() . $prop["VALUE"] : ''; } else { $prop = \CFile::GetPath($fields[$this->relationFields["PROP_ID_PRIMARY_IMAGE"]]); $result["PROP_ID_PRIMARY_IMAGE"] = $prop ? $this->getDomainName() . $prop : ''; } goto aTQ9c; QP0Jw: $result = []; goto YUOo2; aB0VY: if (is_numeric($this->settingsData["PROP_ID_PRICE"])) { $result["PROP_ID_PRICE"] = $this->findProperty($props, "PROP_ID_PRICE")["VALUE"]; } else { $result["PROP_ID_PRICE"] = null; } goto qks9n; KcF8c: return $result; goto D7EPh; iJwxw: $result["PROP_CURRENCY"] = $this->settingsData["PROP_CURRENCY"]; goto qrwpu; LiC6m: if (is_numeric($this->settingsData["PROP_ID_OFFER_ID"])) { $result["PROP_ID_OFFER_ID"] = $this->findProperty($props, "PROP_ID_OFFER_ID")["VALUE"]; } else { $result["PROP_ID_OFFER_ID"] = $fields[$this->relationFields["PROP_ID_OFFER_ID"]]; } goto RzJL6; VYp3G: $result["PROP_ID_DESC"] = trim(strip_tags($result["PROP_ID_DESC"])); goto WlrQK; D7EPh: } protected function findProperty(array $props, string $propCode) : array { foreach ($props as $prop) { if ($prop["ID"] == $this->settingsData[$propCode]) { return $prop; } } return []; } public function getCommonAdditionalProps(array $fields = [], array $props = []) : array { goto oe7Uu; CMK3b: if (is_numeric($this->settingsData["PROP_ID_BRAND"])) { $result["PROP_ID_BRAND"] = $this->findProperty($props, "PROP_ID_BRAND")["VALUE"]; } else { $result["PROP_ID_BRAND"] = $fields[$this->relationFields["PROP_ID_BRAND"]]; } goto vjEWa; oe7Uu: $result = []; goto E290z; E290z: if (empty($fields) && empty($props)) { return $result; } goto CMK3b; dMwNv: if (is_numeric($this->settingsData["PROP_ID_MODEL_NAME"])) { $result["PROP_ID_MODEL_NAME"] = $this->findProperty($props, "PROP_ID_MODEL_NAME")["VALUE"]; } else { $result["PROP_ID_MODEL_NAME"] = $fields[$this->relationFields["PROP_ID_MODEL_NAME"]]; } goto RqmGw; vjEWa: if (is_numeric($this->settingsData["PROP_ID_BRAND_CLOTHES_SHOES"])) { $result["PROP_ID_BRAND_CLOTHES_SHOES"] = $this->findProperty($props, "PROP_ID_BRAND_CLOTHES_SHOES")["VALUE"]; } else { $result["PROP_ID_BRAND_CLOTHES_SHOES"] = $fields[$this->relationFields["PROP_ID_BRAND_CLOTHES_SHOES"]]; } goto dMwNv; RqmGw: if (is_numeric($this->settingsData["PROP_ID_ANNOTATION"])) { $result["PROP_ID_ANNOTATION"] = $this->findProperty($props, "PROP_ID_ANNOTATION")["VALUE"]; } else { $result["PROP_ID_ANNOTATION"] = $fields[$this->relationFields["PROP_ID_ANNOTATION"]]; } goto U1L8g; qveUX: if (is_numeric($this->settingsData["PROP_ID_RICH_JSON"])) { $result["PROP_ID_RICH_JSON"] = $this->findProperty($props, "PROP_ID_RICH_JSON")["VALUE"]; } else { $result["PROP_ID_RICH_JSON"] = $fields[$this->relationFields["PROP_ID_RICH_JSON"]]; } goto ltdXp; ltdXp: return $result; goto g7YZ7; U1L8g: if (is_numeric($this->settingsData["PROP_ID_EQUIPMENT"])) { $result["PROP_ID_EQUIPMENT"] = $this->findProperty($props, "PROP_ID_EQUIPMENT")["VALUE"]; } else { $result["PROP_ID_EQUIPMENT"] = $fields[$this->relationFields["PROP_ID_EQUIPMENT"]]; } goto qveUX; g7YZ7: } } goto ntEgu; CaBNI: function checkModuleMode() : void { switch (Loader::includeSharewareModule(GURYEV_OZON_MODULE_NAME)) { case Loader::MODULE_NOT_FOUND: echo "<span style="color:red;">" . Loc::getMessage("GURYEV_OZON.INCLUDE.MODULE_NOT_FOUND") . "</span>"; die; case Loader::MODULE_DEMO: echo "<span style="color:red;">" . Loc::getMessage("GURYEV_OZON.INCLUDE.MODULE_DEMO") . "</span>"; case Loader::MODULE_DEMO_EXPIRED: echo "<span style="color:red;">" . Loc::getMessage("GURYEV_OZON.INCLUDE.MODULE_DEMO_EXPIRED") . "</span>"; die; } } goto P298w; RWRw_: Loader::registerAutoLoadClasses("guryev.ozon", array("Guryev\Ozon\MySql\SettingsTable" => "classes/mysql/SettingsTable.php", "Guryev\Ozon\MySql\CategoriesConnectionsTable" => "classes/mysql/CategoriesConnectionsTable.php", "Guryev\Ozon\MySql\CharacteristicsConnectionsTable" => "classes/mysql/CharacteristicsConnectionsTable.php", "Guryev\Ozon\MySql\ValuesConnectionsTable" => "classes/mysql/ValuesConnectionsTable.php", "Guryev\Ozon\MySql\ExchangeLogTable" => "classes/mysql/ExchangeLogTable.php", "Guryev\Ozon\MySql\AgentsTable" => "classes/mysql/AgentsTable.php", "Guryev\Ozon\Marketplace\MarketplaceInterface" => "lib/marketplace/MarketplaceInterface.php", "Guryev\Ozon\Marketplace\MarketplaceException" => "lib/marketplace/MarketplaceException.php", "Guryev\Ozon\Filter\ProductFilter" => "lib/filter/ProductFilter.php", "Guryev\Ozon\Handler\Iblock" => "lib/handler/iblock.php", "Guryev\Ozon\Handler\Agent" => "lib/agent/export.php", "Guryev\Ozon\Helper" => "lib/Helper.php")); goto etNfX; ntEgu: class OzonMarketplace implements MarketplaceInterface { private const TIMEOUT = 30; private const CACHE_PATH = "/guryev.ozon"; public static function getExchangeTypeExportTexts() : array { return ["EXCHANGE_TYPE_EXPORT_PRODUCTS_TEXT" => Loc::getMessage("GURYEV_OZON.INCLUDE.EXCHANGE_TYPE_EXPORT_PRODUCTS_TEXT"), "EXCHANGE_TYPE_EXPORT_PRICES_TEXT" => Loc::getMessage("GURYEV_OZON.INCLUDE.EXCHANGE_TYPE_EXPORT_PRICES_TEXT"), "EXCHANGE_TYPE_EXPORT_STOCKS_TEXT" => Loc::getMessage("GURYEV_OZON.INCLUDE.EXCHANGE_TYPE_EXPORT_STOCKS_TEXT"), "EXCHANGE_TYPE_EXPORT_CONSTRUCT_TEXT" => Loc::getMessage("GURYEV_OZON.INCLUDE.EXCHANGE_TYPE_EXPORT_CONSTRUCT_TEXT")]; } public static function getWarehouseStatusesWithPersonalAreaTexts() : array { return ["new" => Loc::getMessage("GURYEV_OZON.INCLUDE.WAREHOUSE_STATUSES_WITH_PERSONAL_AREA.NEW"), "created" => Loc::getMessage("GURYEV_OZON.INCLUDE.WAREHOUSE_STATUSES_WITH_PERSONAL_AREA.CREATED"), "disabled" => Loc::getMessage("GURYEV_OZON.INCLUDE.WAREHOUSE_STATUSES_WITH_PERSONAL_AREA.DISABLED"), "blocked" => Loc::getMessage("GURYEV_OZON.INCLUDE.WAREHOUSE_STATUSES_WITH_PERSONAL_AREA.BLOCKED"), "disabled_due_to_limit" => Loc::getMessage("GURYEV_OZON.INCLUDE.WAREHOUSE_STATUSES_WITH_PERSONAL_AREA.DISABLED_DUE_TO_LIMIT"), "error" => Loc::getMessage("GURYEV_OZON.INCLUDE.WAREHOUSE_STATUSES_WITH_PERSONAL_AREA.ERROR")]; } private $apiUrl; private $cliendId; private $apiKey; public function __construct() { goto ZPIll; BSAma: $settingsData = SettingsTable::getList(["select" => ["CLIENT_ID", "API_KEY"], "limit" => 1])->fetch(); goto SRO5x; SRO5x: if (!$settingsData["CLIENT_ID"] || !$settingsData["API_KEY"]) { throw MarketplaceException::forConnectionDataIsNotValid(); } goto vOfYE; vOfYE: $this->apiUrl = MarketplaceInterface::OZON_API_URL; goto DJMdn; rp5U2: $this->apiKey = $settingsData["API_KEY"]; goto KqMCv; ZPIll: if (!Loader::includeSharewareModule("guryev.ozon")) { throw new \RuntimeException(Loc::getMessage("GURYEV_OZON.INCLUDE.MODULE_GURYEV_OZON_NOT_CONNECTED")); } goto BSAma; DJMdn: $this->cliendId = $settingsData["CLIENT_ID"]; goto rp5U2; KqMCv: } public function request(string $methodAPI, array $content = [], string $httpMethod = "GET") : array { goto LaNQc; YfpF9: $ch = curl_init(); goto Bf3Fg; z4mAP: $response = Json::decode($body); goto DDoDs; XrW62: curl_setopt($ch, CURLOPT_TIMEOUT, self::TIMEOUT); goto m5Ix3; m5Ix3: $body = curl_exec($ch); goto meNcc; dm08s: if ($httpMethod === "GET") { $url .= "?" . http_build_query($content); } goto swPIi; GRvY9: curl_setopt($ch, CURLOPT_URL, $url); goto XrW62; Ai7Ql: curl_close($ch); goto z4mAP; u975i: if ($responseCode === 7 || $responseCode === 16) { throw MarketplaceException::forConnectionDataIsNotValid(); } goto RwIix; Bf3Fg: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); goto jMlEX; hBAKr: $error = curl_error($ch); goto Ai7Ql; jMlEX: foreach ($content as $key => $value) { if (empty($value) && $value !== false) { unset($content[$key]); } } goto dm08s; SLHsD: $url = $this->apiUrl . $methodAPI; goto Uq4tn; UUOwe: curl_setopt($ch, CURLOPT_HTTPHEADER, ["Client-Id: " . $this->cliendId, "Api-Key: " . $this->apiKey, "Content-Type: application/json"]); goto GRvY9; Uq4tn: $httpMethod = strtoupper($httpMethod); goto YfpF9; XEGKe: return is_array($response) ? $response : []; goto DTc5e; DDoDs: $responseCode = (int) $response["code"]; goto u975i; RwIix: if ($responseCode) { throw new MarketplaceException($response["message"]); } goto XEGKe; meNcc: $errno = curl_errno($ch); goto hBAKr; swPIi: if ($httpMethod === "POST") { curl_setopt($ch, CURLOPT_POSTFIELDS, $content ? Json::encode($content) : ''); curl_setopt($ch, CURLOPT_POST, true); } goto UUOwe; LaNQc: checkModuleMode(); goto SLHsD; DTc5e: } public function checkConnect() : bool { $this->getWarehouses(); return true; } public function getWarehouses() : array { return $this->request("/v1/warehouse/list", [], "POST"); } public function prepareProductsDataForAdd(int $marketCategoryId, array $products, array $additionalProps = [], array $additionalPropsValues = [], array $importedKeysProductArts = []) : array { goto Gke9H; Gke9H: $result = []; goto k8tHp; k8tHp: $limitImages = 15; goto X1r0A; gL3iu: return $result; goto xuh5h; X1r0A: foreach ($products as $product) { goto YSq5u; x6Zee: $data = ["attributes" => $this->getAttributes($product, $additionalProps, $additionalPropsValues), "barcode" => (string) $fields["PROP_ID_BARCODE"] ?: '', "category_id" => $marketCategoryId, "color_image" => (string) $fields["PROP_ID_COLOR_IMAGE"] ?: '', "currency_code" => $fields["PROP_CURRENCY"], "depth" => (int) $fields["PROP_ID_LENGTH"], "dimension_unit" => $fields["PROP_DIMENSION_UNIT"], "height" => (int) $fields["PROP_ID_HEIGHT"], "images" => $images, "primary_image" => $mainImage, "service_type" => (string) $fields["PROP_SERVICE_TYPE"], "name" => (string) $fields["PROP_ID_NAME"], "offer_id" => (string) $fields["PROP_ID_OFFER_ID"], "old_price" => $fields["PROP_ID_OLD_PRICE"] > 0 && $fields["PROP_ID_OLD_PRICE"] > $fields["PROP_ID_PRICE"] ? (string) $fields["PROP_ID_OLD_PRICE"] : "0", "price" => (string) $fields["PROP_ID_PRICE"], "vat" => (string) $fields["PROP_VAT"], "weight" => (int) $fields["PROP_ID_WEIGHT"], "weight_unit" => (string) $fields["PROP_WEIGHT_UNIT"], "width" => (int) $fields["PROP_ID_WIDTH"]]; goto bHx7f; YSq5u: $fields = $product["FIELDS"]; goto OJ7Vn; xb0eE: if (!empty($fields["PROP_ID_IMAGES"])) { foreach ($fields["PROP_ID_IMAGES"] as $key => $image) { if ($mainImage && $limitImages - 2 < $key || !$mainImage && $limitImages < $key) { break; } if ($image) { $images[] = $image; } } } goto x6Zee; mURbc: $result[] = $data; goto O44ol; bHx7f: foreach ($data as $key => $value) { if (is_null($value) && !in_array($key, ["old_price", "premium_price", "price"])) { unset($data[$key]); } } goto mURbc; cxYre: $mainImage = $fields["PROP_ID_PRIMARY_IMAGE"] ?: null; goto UZgxO; UZgxO: $images = []; goto xb0eE; OJ7Vn: if (!empty($importedKeysProductArts) && array_key_exists($fields["PROP_ID_OFFER_ID"], $importedKeysProductArts)) { continue; } goto cxYre; O44ol: } goto gL3iu; xuh5h: } public function prepareProductsDataForUpdatePrices(array $products, array $importedKeysProductArts = []) : array { goto EBfoF; xM_o0: foreach ($products as $product) { goto BPZ1R; CPQeh: $result[] = $data; goto gDqTh; C4dup: $data = ["currency_code" => (string) $fields["PROP_CURRENCY"], "min_price" => (string) $fields["PROP_ID_PRICE"], "offer_id" => (string) $fields["PROP_ID_OFFER_ID"], "old_price" => $fields["PROP_ID_OLD_PRICE"] > 0 && $fields["PROP_ID_OLD_PRICE"] > $fields["PROP_ID_PRICE"] ? (string) $fields["PROP_ID_OLD_PRICE"] : "0", "price" => (string) $fields["PROP_ID_PRICE"]]; goto CPQeh; KNl7F: if (!empty($importedKeysProductArts) && array_key_exists($fields["PROP_ID_OFFER_ID"], $importedKeysProductArts)) { continue; } goto C4dup; BPZ1R: $fields = $product["FIELDS"]; goto KNl7F; gDqTh: } goto XhzCu; EBfoF: $result = []; goto xM_o0; XhzCu: return $result; goto EiQZn; EiQZn: } public function prepareProductsDataForUpdateStocks(array $products, bool $useWarehouse = false, array $importedKeysProductArts = []) : array { goto Vh7J8; kK9oO: foreach ($products as $product) { goto d4fq1; d4fq1: $fields = $product["FIELDS"]; goto t0C3a; YlmhN: $result[] = $data; goto dWhuz; weVmB: if ($useWarehouse) { $data["warehouse_id"] = (int) $fields["WAREHOUSE_ID"]; } goto YlmhN; t0C3a: if (!empty($importedKeysProductArts) && array_key_exists($fields["PROP_ID_OFFER_ID"], $importedKeysProductArts)) { continue; } goto k9PcY; k9PcY: $data = ["offer_id" => (string) $fields["PROP_ID_OFFER_ID"], "stock" => (int) $fields["PROP_ID_STOCK"] > 0 ? (int) $fields["PROP_ID_STOCK"] : 0]; goto weVmB; dWhuz: } goto N09Qr; N09Qr: return $result; goto w79kg; Vh7J8: $result = []; goto kK9oO; w79kg: } public function addProducts(array $preparedProducts, bool $returnResponses = false) : array { goto uz8PQ; YQ1Gb: return $result; goto W0nRC; CXD4t: $productsChunks = array_chunk($preparedProducts, $maxCountInChunk, true); goto oTO3t; n2Ywn: $result["taskIds"] = $taskIds; goto rrgnP; rrgnP: if ($returnResponses) { $result["responses"] = $returnResponsesArr; } goto YQ1Gb; Rp8_h: $returnResponsesArr = []; goto qr3Tf; oTO3t: $taskIds = []; goto Rp8_h; aYqPe: $maxCountInChunk = 100; goto CXD4t; uz8PQ: $result = []; goto aYqPe; qr3Tf: foreach ($productsChunks as $productsChunk) { goto AhbHG; SXc78: if (isset($productsImportRes["result"]["task_id"])) { foreach ($productsChunk as $product) { $taskIds[$productsImportRes["result"]["task_id"]][] = (string) $product["offer_id"]; } } goto AZOEM; W3ILv: if ($returnResponses) { $returnResponsesArr[] = $productsImportRes; } goto SXc78; hMawI: $productsImportRes = $this->productImport($productsChunk); goto W3ILv; AhbHG: $productsChunk = array_values($productsChunk); goto hMawI; AZOEM: } goto n2Ywn; W0nRC: } public function updateProductsPrices(array $preparedProducts, bool $returnResponses = false) : array { goto hIujm; POm4s: $result["productArtsInfo"] = $productArtsInfo; goto YAZSr; IpUTD: return $result; goto vakZ5; W_ivt: foreach ($productsChunks as $productsChunk) { goto fsOMt; VORfP: foreach ($pricesImportRes["result"] as $productInfo) { if ($productInfo["updated"]) { $productArtsInfo[$key]["updated"][] = (string) $productInfo["offer_id"]; } else { $productArtsInfo[$key]["errors"][(string) $productInfo["offer_id"]] = Json::encode([(string) $productInfo["offer_id"] => $productInfo["errors"]], JSON_THROW_ON_ERROR); } } goto uJB5U; x5ZKy: if ($returnResponses) { $returnResponsesArr[] = $pricesImportRes; } goto VORfP; uJB5U: $key++; goto f5s4w; fsOMt: $productsChunk = array_values($productsChunk); goto w1WnQ; w1WnQ: $pricesImportRes = $this->updateProductImportPrices($productsChunk); goto x5ZKy; f5s4w: } goto POm4s; MFIbs: $maxCountInChunk = 100; goto Ph6Li; YAZSr: if ($returnResponses) { $result["responses"] = $returnResponsesArr; } goto IpUTD; GULP6: $returnResponsesArr = []; goto W_ivt; pCt4t: $key = 0; goto MFIbs; Ph6Li: $productsChunks = array_chunk($preparedProducts, $maxCountInChunk, true); goto wKFeu; wKFeu: $productArtsInfo = []; goto GULP6; hIujm: $result = []; goto pCt4t; vakZ5: } public function updateProductsStocks(array $preparedProducts, bool $useWarehouse = false, bool $returnResponses = false) : array { goto DEoak; lxxkR: $result["productArtsInfo"] = $productArtsInfo; goto exHH1; YlIAe: $maxCountInChunk = 100; goto g629r; qEy94: $key = 0; goto YlIAe; XaK_0: foreach ($productsChunks as $productsChunk) { goto ISjMg; omlmH: foreach ($stocksImportRes["result"] as $productInfo) { if ($productInfo["updated"]) { $productArtsInfo[$key]["updated"][] = (string) $productInfo["offer_id"]; } else { $productArtsInfo[$key]["errors"][(string) $productInfo["offer_id"]] = Json::encode([(string) $productInfo["offer_id"] => $productInfo["errors"]], JSON_THROW_ON_ERROR); } } goto Gftdl; b3GBU: if ($returnResponses) { $returnResponsesArr[] = $stocksImportRes; } goto omlmH; Gftdl: $key++; goto ke72Q; wfxv3: if ($useWarehouse) { $stocksImportRes = $this->updateProductImportStocksOnWarehouse($productsChunk); } else { $stocksImportRes = $this->updateProductImportStocks($productsChunk); } goto b3GBU; ISjMg: $productsChunk = array_values($productsChunk); goto wfxv3; ke72Q: } goto lxxkR; CJmcn: $returnResponsesArr = []; goto XaK_0; DEoak: $result = []; goto qEy94; xIxr3: $productArtsInfo = []; goto CJmcn; g629r: $productsChunks = array_chunk($preparedProducts, $maxCountInChunk, true); goto xIxr3; eo5X8: return $result; goto c6Nfk; exHH1: if ($returnResponses) { $result["responses"] = $returnResponsesArr; } goto eo5X8; c6Nfk: } public function updateProducts(array $preparedProducts) : array { return []; } public function getInfoByImportedProducts(string $taskId) : array { return $this->getProductImportInfo($taskId); } protected function productImport(array $data) : array { return $this->request("/v2/product/import", ["items" => $data], "POST"); } public function getProductInfoLimit() : array { return $this->request("/v3/product/info/limit", [], "POST")["result"]; } protected function getCategoryTree(int $marketplaceCategoryId = null) : array { goto lKWK6; lKWK6: $data = []; goto T8tdI; T8tdI: if ($marketplaceCategoryId) { $data["category_id"] = $marketplaceCategoryId; } goto jY8w0; jY8w0: return $this->request("/v2/category/tree", $data, "POST"); goto K29ER; K29ER: } public function getCategoriesFinal(string $marketplaceCategoryId = null) : array { goto cYPSG; DFlMv: if ($cache->startDataCache()) { goto ylSnD; ANg4F: $result = []; goto vSNOl; ylSnD: try { $data = $this->getCategoryTree($marketplaceCategoryId)["result"]; } catch (Exception $e) { $cache->abortDataCache(); return ["error" => $e->getMessage()]; } goto QvEYz; QvEYz: if ($marketplaceCategoryId) { $data = $data[0]["children"]; } goto JsWPr; AubO9: $cache->endDataCache($result); goto I05so; NN2uZ: $result = array_values($result); goto AubO9; JsWPr: $tree2arrayCategories = $this->tree2arrayCategories($data); goto ANg4F; vSNOl: foreach ($tree2arrayCategories as $category) { if (!$category["hasChildren"]) { unset($category["hasChildren"]); $result[] = $category; } } goto wA8vI; wA8vI: Helper::sortByField($result, "name"); goto NN2uZ; I05so: } goto FNuVK; Tz2bE: $cache = Cache::createInstance(); goto tni27; FNuVK: return $result; goto dM2hd; oWX0B: if ($cache->initCache(600, $cacheKey, self::CACHE_PATH . "/getCategoriesFinal/")) { return $cache->getVars(); } goto DFlMv; tni27: $cacheKey = $marketplaceCategoryId ?: 0; goto oWX0B; cYPSG: $result = []; goto Tz2bE; dM2hd: } public function getCategoryProperties(array $marketplaceCategoryIds = []) : array { goto fgZ6a; MORiM: if ($cache->initCache(600, $cacheKey, self::CACHE_PATH . "/getCategoryProperties/")) { return $cache->getVars(); } goto p08VK; vSKrJ: $cache = Cache::createInstance(); goto WaXhb; AEG8k: $maxCategoryIDs = 20; goto TxIQD; fgZ6a: $result = []; goto AEG8k; C2KgQ: if (count($marketplaceCategoryIds) > $maxCategoryIDs) { throw MarketplaceException::forMaxCount($maxCategoryIDs); } goto vSKrJ; RPRfQ: return $result; goto cTDiw; TxIQD: if (!$marketplaceCategoryIds) { throw MarketplaceException::forMarketplaceCategoryIdsIsRequired(); } goto C2KgQ; p08VK: if ($cache->startDataCache()) { goto MtLzG; MtLzG: try { $data = $this->request("/v3/category/attribute", array("category_id" => $marketplaceCategoryIds), "POST")["result"]; } catch (Exception $e) { $cache->abortDataCache(); return ["error" => $e->getMessage()]; } goto TXQW3; lO8xk: $cache->endDataCache($result); goto QB_16; TXQW3: foreach ($data as $categoryKey => $categoryValue) { $result[$categoryKey]["id"] = $categoryValue["category_id"]; foreach ($categoryValue["attributes"] as $attribute) { $result[$categoryKey]["values"][] = $this->getPropertyData($attribute); } } goto lO8xk; QB_16: } goto RPRfQ; WaXhb: $cacheKey = serialize($marketplaceCategoryIds); goto MORiM; cTDiw: } protected function getPropertyData(array $outcomeData) : array { goto rBUlP; DK3Fm: if ($outcomeData["dictionary_id"] > 0) { $categoryData["dictionary_id"] = $outcomeData["dictionary_id"]; } goto XSWTP; rBUlP: $type = null; goto DCAmy; XSWTP: return $categoryData; goto hOmKO; DCAmy: if ($outcomeData["dictionary_id"] > 0) { if ($outcomeData["is_collection"]) { $type = self::FIELD_MULTISELECT; } else { $type = self::FIELD_SELECT; } } goto C3RpU; C3RpU: $categoryData = array("id" => $outcomeData["id"], "name" => $outcomeData["name"], "type" => $type ?? $this->formattingFieldType($outcomeData["type"]), "description" => $outcomeData["description"], "is_required" => (int) $outcomeData["is_required"]); goto DK3Fm; hOmKO: } public function formattingFieldType(string $marketplaceFieldType) : string { goto N0LjR; x0372: return $result; goto J5_XZ; N0LjR: $result = null; goto Bqke0; pDWAD: switch ($marketplaceFieldType) { case "string" || "multiline": $result = self::FIELD_STRING; break; case "url": $result = self::FIELD_URL; break; case "decimal": $result = self::FIELD_FLOAT; break; case "boolean": $result = self::FIELD_BOOLEAN; break; case "integer": $result = self::FIELD_INTEGER; break; } goto bkniS; bkniS: if (!$result) { throw MarketplaceException::forInvalidVariableType(); } goto x0372; Bqke0: $marketplaceFieldType = mb_strtolower($marketplaceFieldType); goto pDWAD; J5_XZ: } public function getPropertyValues(string $marketplacePropertyId, array $options = []) : array { goto WbUxK; S4MJ7: if ($cache->initCache(600, $cacheKey, self::CACHE_PATH . "/getPropertyValues/")) { return $cache->getVars(); } goto J5Biv; aWz8H: return $result; goto CcEyy; sGtTn: $cache = Cache::createInstance(); goto O7Lls; J5Biv: if ($cache->startDataCache()) { try { $result = $this->request("/v2/category/attribute/values", $data, "POST"); } catch (Exception $e) { $cache->abortDataCache(); return ["error" => $e->getMessage()]; } $cache->endDataCache($result); } goto aWz8H; nZpmN: if ($options["category_id"]) { $data["category_id"] = $options["category_id"]; } goto ZufKY; WbUxK: $result = []; goto EvMiX; O7Lls: $cacheKey = serialize($data); goto S4MJ7; ZufKY: if ($options["last_value_id"]) { $data["last_value_id"] = $options["last_value_id"]; } goto sGtTn; EvMiX: $data = ["attribute_id" => (int) $marketplacePropertyId, "language" => (string) $options["language"] ?: "DEFAULT", "limit" => (int) $options["$limit"] ?: 5000]; goto nZpmN; CcEyy: } protected function getProductImportInfo(int $taskId) : array { return $this->request("/v1/product/import/info", array("task_id" => $taskId), "POST"); } public function updateProductImportPrices(array $data) : array { return $this->request("/v1/product/import/prices", array("prices" => $data), "POST"); } public function updateProductImportStocks(array $data) : array { return $this->request("/v1/product/import/stocks", array("stocks" => $data), "POST"); } public function updateProductImportStocksOnWarehouse(array $data) : array { return $this->request("/v2/products/stocks", array("stocks" => $data), "POST"); } protected function getAttributes($product, array $additionalProps, array $additionalPropsValues) : array { goto j4n6e; Ec3LL: $processedData = []; goto kKgCM; MsxN6: $commonAdditionalProps = $product["COMMON_ADDITIONAL_PROPERTIES"]; goto vBfIY; AF6Vx: foreach ($processedData as $key => $value) { unset($processedData[$key]["type"]); } goto QpjIZ; j4n6e: $result = []; goto MsxN6; srhiN: $initialData = []; goto Ec3LL; YXbfR: if ($commonAdditionalProps["PROP_ID_EQUIPMENT"]) { $result[] = ["id" => 4384, "values" => [["value" => $commonAdditionalProps["PROP_ID_EQUIPMENT"]]]]; } goto klWKm; hLegq: $result[] = ["id" => 31, "values" => [["value" => $commonAdditionalProps["PROP_ID_BRAND_CLOTHES_SHOES"] ?: Loc::getMessage("GURYEV_OZON.INCLUDE.NO_BRAND")]]]; goto gLMve; klWKm: if ($commonAdditionalProps["PROP_ID_RICH_JSON"]) { $result[] = ["id" => 11254, "values" => [["value" => $commonAdditionalProps["PROP_ID_RICH_JSON"]]]]; } goto srhiN; vBfIY: $props = $product["PROPERTIES"]; goto zwPYa; kKgCM: foreach ($additionalProps as $value) { goto jT79d; jT79d: $currentProp = $props[$value["SITE_PROPERTY_DATA"]["CODE"]]; goto a5z9m; EOwVH: if (!$values) { continue; } goto Du0Z5; Du0Z5: $initialData[] = ["id" => (int) $value["MARKET_PROPERTY_DATA"]["id"], "type" => $value["MARKET_PROPERTY_DATA"]["type"], "values" => $this->getValuesForAttributes($values, $currentProp["PROPERTY_TYPE"], $relationPropsValues, $value)]; goto xDQH1; U4ynD: $values = $currentProp["VALUES"]; goto EOwVH; a5z9m: $relationPropsValues = $additionalPropsValues[$currentProp["ID"]] ?: []; goto U4ynD; xDQH1: } goto xwHJ3; xwHJ3: foreach ($initialData as $key => $value) { if (empty($value["values"])) { unset($initialData[$key]); } } goto Nhoho; uanLz: if ($commonAdditionalProps["PROP_ID_ANNOTATION"]) { $result[] = ["id" => 4191, "values" => [["value" => $commonAdditionalProps["PROP_ID_ANNOTATION"]]]]; } goto YXbfR; Nhoho: foreach ($initialData as $value) { if (!$processedData[$value["id"]]) { if ($value["type"] === "string" && $value["values"][1]) { goto uQ8fG; uQ8fG: $resValues = []; goto iXeDT; AkXAm: $value["values"][0]["value"] = implode(", ", $resValues); goto mkZzW; iXeDT: foreach ($value["values"] as $valVal) { $resValues[] = $valVal["value"]; } goto o6U_i; o6U_i: $value["values"] = []; goto AkXAm; mkZzW: } $processedData[$value["id"]] = $value; } elseif ($processedData[$value["id"]] && $value["values"] && $value["type"] === "multiselect") { goto Z9KPT; C1cZ4: foreach ($processedData[$value["id"]]["values"] as $processedDataValue) { $dictionaryValueIds[] = (int) $processedDataValue["dictionary_value_id"]; } goto xGUFR; xGUFR: foreach ($value["values"] as $valueInValues) { if (!in_array((int) $valueInValues["dictionary_value_id"], $dictionaryValueIds, true)) { $processedData[$value["id"]]["values"][] = $valueInValues; $dictionaryValueIds[] = (int) $valueInValues["dictionary_value_id"]; } } goto i55EY; Z9KPT: $dictionaryValueIds = []; goto C1cZ4; i55EY: } elseif ($processedData[$value["id"]] && empty($processedData[$value["id"]]["values"]) && $value["values"]) { $processedData[$value["id"]]["values"] = $value["values"]; } } goto AF6Vx; zwPYa: $result[] = ["id" => 85, "values" => [["value" => $commonAdditionalProps["PROP_ID_BRAND"] ?: Loc::getMessage("GURYEV_OZON.INCLUDE.NO_BRAND")]]]; goto hLegq; lmRLx: return array_merge($result, $processedData); goto TOQSH; QpjIZ: $processedData = array_values($processedData); goto lmRLx; gLMve: if ($commonAdditionalProps["PROP_ID_MODEL_NAME"]) { $result[] = ["id" => 9048, "values" => [["value" => $commonAdditionalProps["PROP_ID_MODEL_NAME"]]]]; } goto uanLz; TOQSH: } protected function getValuesForAttributes(array $propertyValues, string $currentPropType, array $relationPropsValues = [], array $additionalProp = []) : array { goto hff0H; hff0H: $result = []; goto o4XJC; o4XJC: foreach ($propertyValues as $propValue) { goto kxQxz; MVIDl: $resDictionaryValueId = null; goto V2Ckh; BsS5I: foreach ($relationPropsValues as $relationValue) { if ((int) $propValue["ID"] === (int) $relationValue["SITE_VALUE_ID"] && (int) $relationValue["MARKET_ID"] === (int) $additionalProp["MARKET_PROPERTY_DATA"]["id"]) { goto ecM9o; x6EBE: $elemRes = ["value" => $resValue]; goto nOIRw; ecM9o: if ($relationValue["MARKET_VALUE_NAME"]) { $resValue = $relationValue["MARKET_VALUE_NAME"]; $resDictionaryValueId = $relationValue["MARKET_VALUE_ID"]; } else { $resValue = $this->checkDimensionValue($propValue["VALUE"], $additionalProp); } goto x6EBE; nOIRw: if ($resDictionaryValueId) { $elemRes["dictionary_value_id"] = $resDictionaryValueId; $result["dictionary_" . $resDictionaryValueId] = $elemRes; } else { $result[] = $elemRes; } goto t1lsG; t1lsG: } } goto ZXiKG; C3x96: if ($currentPropType === "L" && !$resValue && !$relationPropsValues && ($additionalProp["MARKET_PROPERTY_DATA"]["type"] !== "multiselect" && $additionalProp["MARKET_PROPERTY_DATA"]["type"] !== "select")) { $result[] = ["value" => $this->checkDimensionValue($propValue["VALUE"], $additionalProp)]; } goto pRtPc; V2Ckh: if (!$propValue["ID"] && !$propValue["VALUE"]) { continue; } goto BsS5I; kxQxz: $resValue = null; goto MVIDl; ZXiKG: if ($currentPropType !== "L" && !$resValue) { foreach ($relationPropsValues as $relationValue) { $elemRes = ["value" => $relationValue["MARKET_VALUE_NAME"]]; if ($relationValue["MARKET_VALUE_ID"]) { $elemRes["dictionary_value_id"] = $relationValue["MARKET_VALUE_ID"]; $result["dictionary_" . $relationValue["MARKET_VALUE_ID"]] = $elemRes; } else { $result[] = $elemRes; } } } goto C3x96; pRtPc: if (($currentPropType === "N" || $currentPropType === "S") && !$resValue && !$relationPropsValues) { $result[] = ["value" => $this->checkDimensionValue($propValue["VALUE"], $additionalProp)]; } goto yU3oD; yU3oD: } goto PDiW1; PDiW1: return array_values($result); goto P1inf; P1inf: } protected function tree2arrayCategories(array $data, array $parent = []) : array { goto Qx81Q; ozb1t: return $result; goto cB4vT; fXnjY: foreach ($data as $value) { goto D7jJl; LuOHt: if ($parent) { $data["parentNames"] = $parent["parentNames"] ? array_merge($parent["parentNames"], [$parent["name"]]) : [$parent["name"]]; } goto MDE86; WJfFR: if ($data["hasChildren"]) { $result = array_merge($result, $this->tree2arrayCategories($value["children"], $data)); } goto GzmOp; MDE86: $result[] = $data; goto WJfFR; D7jJl: $data = ["id" => $value["category_id"], "name" => $value["title"], "hasChildren" => $value["children"] ? 1 : 0, "parentNames" => []]; goto LuOHt; GzmOp: } goto ozb1t; Qx81Q: $result = []; goto fXnjY; cB4vT: } protected function checkDimensionValue($value, array $property) { if ($hint = mb_strtolower($property["SITE_PROPERTY_DATA"]["HINT"])) { goto ofdc5; b0gqY: if ($dimension["VALUE_SITE"] && $dimension["VALUE_MARKET"] && $dimension["VALUE_SITE"] !== $dimension["VALUE_MARKET"]) { goto AQxZq; AQxZq: $valueSite = $dimensions[$dimension["TYPE"]][$dimension["VALUE_SITE"]]; goto Ctl_T; a82Wh: $value = round($value, 2); goto e_Id8; e_Id8: $value = (string) $value; goto BZ11I; Ctl_T: $valueMarket = $dimensions[$dimension["TYPE"]][$dimension["VALUE_MARKET"]]; goto WFpMA; WFpMA: if ($valueSite > $valueMarket) { $value *= $valueSite / $valueMarket; } else { $value /= $valueMarket / $valueSite; } goto a82Wh; BZ11I: } goto i8l_L; ofdc5: $dimensions = ["length" => ["" => 1, "" => 10, "" => 1000], "weight" => ["" => 1, "" => 1000, "" => 1000000], "volume_liquid" => ["" => 1, "" => 1000], "capacity_liter_time" => ["/" => 60, "/" => 1]]; goto OXYtm; lE6Ni: foreach ($dimensions as $dimensionKey => $dimensionItem) { if (array_key_exists($hint, $dimensionItem)) { goto U_joY; MujV0: $dimension["VALUE_SITE"] = $hint; goto gcJdr; U_joY: $dimension["TYPE"] = $dimensionKey; goto MujV0; gcJdr: foreach ($dimensionItem as $valueKey => $valueItem) { if (mb_strpos($property["MARKET_PROPERTY_DATA"]["name"], ", " . $valueKey) !== false) { $dimension["VALUE_MARKET"] = $valueKey; break; } } goto wgFEL; wgFEL: break; goto SnYY_; SnYY_: } } goto b0gqY; OXYtm: $dimension = ["TYPE" => '', "VALUE_SITE" => '', "VALUE_MARKET" => '']; goto lE6Ni; i8l_L: } return $value; } }
?>
Did this file decode correctly?
Original Code
<?php
if (!defined("\102\137\120\122\x4f\114\117\107\137\x49\x4e\103\x4c\125\x44\105\104") || B_PROLOG_INCLUDED !== true) { die; } use Bitrix\Main\Loader; use Bitrix\Main\Localization\Loc; use Bitrix\Iblock\SectionTable; use Bitrix\Iblock\PropertyTable; use Bitrix\Main\Event; use Bitrix\Main\EventResult; use Bitrix\Main\Data\Cache; use Bitrix\Main\Type\DateTime; use Bitrix\Main\Web\Json; use Guryev\Ozon\Filter\ProductFilter; use Guryev\Ozon\Marketplace\MarketplaceException; use Guryev\Ozon\Marketplace\MarketplaceInterface; use Guryev\Ozon\MySql\AgentsTable; use Guryev\Ozon\MySql\CategoriesConnectionsTable; use Guryev\Ozon\MySql\CharacteristicsConnectionsTable; use Guryev\Ozon\MySql\ExchangeLogTable; use Guryev\Ozon\MySql\SettingsTable; use Guryev\Ozon\MySql\ValuesConnectionsTable; use Guryev\Ozon\Helper; goto RWRw_; etNfX: const GURYEV_OZON_MODULE_NAME = "\x67\165\162\171\145\166\x2e\157\x7a\x6f\x6e"; goto CaBNI; P298w: class MarketplacesExport { protected const COUNT_ELEMENTS_FOR_CATEGORY = 100; public $settingsData; public $relationFields = []; public function __construct(bool $testExport = false) { goto eTpng; eTpng: if (!Loader::includeModule("\x69\142\x6c\x6f\143\x6b")) { throw new \RuntimeException(Loc::getMessage("\107\125\x52\x59\105\x56\137\117\x5a\117\116\56\x49\x4e\103\114\x55\104\x45\56\115\x4f\104\125\x4c\105\137\x49\x42\x4c\x4f\103\x4b\x5f\x4e\117\x54\x5f\x43\117\116\x4e\105\103\x54\105\x44")); } goto KL4zJ; OfYl5: try { goto BWjfx; unVn7: if ($testExport) { $this->settingsData["\105\130\x50\117\122\124\137\x41\x43\x54\x49\126\105"] = true; } goto ivCZu; BWjfx: $this->settingsData = SettingsTable::getList(["\154\x69\x6d\151\164" => 1])->fetch(); goto bUNj4; DMr7r: $this->getRelationFields(); goto ZCro0; ivCZu: if ($this->settingsData["\111\x42\114\117\x43\113\137\123\x4b\125\137\125\x53\105"] && Loader::includeModule("\x63\x61\164\141\x6c\x6f\x67")) { $skuInfo = CCatalogSKU::GetInfoByProductIBlock($this->settingsData["\111\102\114\117\103\x4b\x5f\111\x44"]); if ($skuInfo) { $this->settingsData["\x49\102\x4c\117\103\113\137\x53\113\125\137\111\x44"] = $skuInfo["\111\102\114\117\x43\113\137\x49\x44"]; $this->settingsData["\123\x4b\x55\137\x50\x52\117\x50\105\122\x54\131\x5f\x49\x44"] = $skuInfo["\123\113\x55\x5f\x50\122\x4f\120\x45\x52\124\x59\137\111\x44"]; } } goto bAXR8; bUNj4: $this->settingsData["\111\x42\114\x4f\x43\113\x5f\x53\113\125\x5f\111\x44"] = null; goto unVn7; ZCro0: $this->setDomainName(); goto pG5_r; bAXR8: $this->checkSettingsData(); goto DMr7r; pG5_r: } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["\x54\x59\x50\x45" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_CONSTRUCT, "\x53\124\x41\124\x55\x53" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "\111\x4e\106\x4f\122\115\101\124\x49\x4f\x4e" => $e->getMessage()]); throw $e; } goto pFV9W; XqJPE: checkModuleMode(); goto OfYl5; KL4zJ: if (!Loader::includeSharewareModule("\x67\165\162\171\x65\166\56\x6f\172\157\156")) { throw new \RuntimeException(Loc::getMessage("\107\125\122\131\x45\126\137\117\x5a\x4f\x4e\x2e\111\116\103\x4c\x55\104\x45\56\x4d\117\x44\125\114\x45\x5f\x47\125\122\x59\x45\x56\x5f\117\132\117\x4e\137\116\117\124\x5f\103\117\x4e\116\105\x43\124\105\x44")); } goto XqJPE; pFV9W: } protected function checkSettingsData() : void { goto BFtKh; BFtKh: if (!$this->settingsData["\105\130\x50\x4f\x52\124\137\x41\x43\124\x49\126\x45"]) { throw new \RuntimeException(Loc::getMessage("\x47\125\122\x59\x45\126\x5f\x4f\x5a\117\116\56\111\116\103\114\x55\104\x45\56\125\x50\114\117\101\x44\x5f\x49\123\x5f\x49\116\101\103\x54\111\x56\x45")); } goto a36Az; lBccj: if (!$this->settingsData["\120\x52\117\120\137\111\x44\137\120\x52\111\x43\105"]) { throw new \RuntimeException(Loc::getMessage("\107\125\122\x59\105\x56\x5f\x4f\x5a\x4f\116\56\x49\116\x43\x4c\x55\x44\x45\x2e\120\122\x49\x43\x45\x5f\x4e\117\x54\137\x53\105\x54\x5f\x49\116\137\x4d\101\111\x4e\x5f\x53\105\x54\124\111\x4e\107\x53")); } goto dWmEv; hazMa: if (!$this->settingsData["\120\122\117\120\x5f\111\104\x5f\x4e\x41\x4d\x45"]) { throw new \RuntimeException(Loc::getMessage("\x47\x55\x52\x59\x45\x56\137\x4f\132\117\116\56\111\116\103\114\125\x44\x45\56\x4e\x41\x4d\105\137\116\x4f\124\137\123\x45\x54\x5f\111\116\137\x4d\101\x49\116\137\123\x45\x54\x54\x49\116\107\123")); } goto CUYqk; tm4l5: if (!$this->settingsData["\x50\122\x4f\x50\137\x49\x44\137\x57\111\104\124\110"]) { throw new \RuntimeException(Loc::getMessage("\x47\x55\122\131\105\x56\137\x4f\132\x4f\x4e\56\x49\116\103\x4c\x55\x44\x45\56\x50\x41\x43\x4b\111\116\107\x5f\127\x49\104\x54\110\x5f\x4e\117\124\137\123\x45\x54\x5f\111\x4e\137\x4d\x41\x49\116\x5f\x53\x45\x54\124\111\x4e\x47\123")); } goto aS9cB; smfZK: if (!$this->settingsData["\120\122\x4f\x50\137\x49\x44\137\110\105\111\107\110\124"]) { throw new \RuntimeException(Loc::getMessage("\x47\125\x52\x59\x45\x56\x5f\x4f\132\117\116\56\x49\x4e\103\x4c\x55\x44\x45\56\120\101\x43\113\111\x4e\x47\x5f\110\x45\x49\x47\110\124\x5f\116\117\124\x5f\x53\105\x54\x5f\111\x4e\137\115\101\x49\116\x5f\123\x45\124\x54\111\x4e\107\123")); } goto AHV7e; CUYqk: if (!$this->settingsData["\120\122\117\x50\137\111\104\x5f\117\x46\106\x45\122\x5f\x49\x44"]) { throw new \RuntimeException(Loc::getMessage("\x47\125\122\x59\x45\126\x5f\117\x5a\117\116\56\111\x4e\103\114\x55\x44\x45\x2e\x41\x52\x54\x49\x43\x4c\105\x5f\x4e\117\x54\x5f\x53\105\x54\137\111\116\137\115\101\111\116\x5f\123\105\124\x54\111\116\x47\123")); } goto YrhlW; Wz5Ds: if (!isset($this->settingsData["\120\x52\x4f\120\x5f\126\101\124"])) { throw new \RuntimeException(Loc::getMessage("\107\x55\x52\131\105\x56\x5f\x4f\x5a\x4f\x4e\56\x49\x4e\103\114\125\104\x45\56\126\101\124\137\122\101\124\x45\x5f\116\117\124\x5f\x53\105\124\137\111\x4e\x5f\x4d\101\x49\x4e\137\x53\105\x54\x54\111\x4e\x47\123")); } goto lBccj; EVUaA: if (!$this->settingsData["\111\x42\114\117\103\x4b\137\111\104"]) { throw new \RuntimeException(Loc::getMessage("\x47\125\x52\x59\105\126\x5f\x4f\x5a\x4f\x4e\56\111\116\x43\114\125\x44\x45\56\x49\116\106\x4f\x42\x4c\117\x43\x4b\137\x4e\117\x54\x5f\x53\x45\124\x5f\x49\x4e\137\115\x41\111\x4e\137\123\105\x54\x54\111\x4e\107\x53")); } goto hazMa; AHV7e: if (!$this->settingsData["\x50\122\x4f\120\x5f\x49\x44\137\x4c\105\x4e\x47\x54\x48"]) { throw new \RuntimeException(Loc::getMessage("\x47\125\x52\131\105\126\137\117\x5a\x4f\116\x2e\111\x4e\103\114\125\104\x45\x2e\120\101\103\113\x49\x4e\x47\x5f\114\x45\116\107\x54\110\x5f\116\x4f\x54\137\123\x45\124\x5f\111\x4e\137\115\x41\111\116\x5f\x53\x45\124\124\111\116\x47\123")); } goto tm4l5; aS9cB: if (!$this->settingsData["\x50\x52\x4f\x50\137\111\104\x5f\127\105\x49\x47\x48\x54"]) { throw new \RuntimeException(Loc::getMessage("\107\125\122\x59\x45\126\x5f\117\x5a\x4f\x4e\56\x49\x4e\x43\x4c\125\x44\x45\56\127\x45\111\107\110\124\x5f\x4e\x4f\x54\137\123\105\124\137\111\x4e\x5f\115\101\111\x4e\137\x53\105\124\x54\x49\116\107\x53")); } goto ZdnQ3; dWmEv: if ($this->settingsData["\111\x42\114\117\x43\x4b\x5f\123\113\x55\137\x55\x53\x45"] && !$this->settingsData["\111\102\114\117\x43\x4b\x5f\123\113\x55\x5f\x49\x44"]) { throw new \RuntimeException(Loc::getMessage("\107\125\122\131\105\x56\x5f\x4f\132\117\116\x2e\x49\x4e\103\114\125\104\x45\x2e\116\x4f\124\x5f\x45\130\x49\123\x54\x5f\x49\x4e\x46\117\x42\x4c\x4f\x43\x4b\x5f\123\x4b\x55\x5f\x41\114\x54\110\117\125\107\x48\137\x53\113\125\137\x49\x53\137\103\110\x45\103\113\x45\104")); } goto GmRUA; YrhlW: if (!$this->settingsData["\x50\x52\x4f\120\x5f\x49\x44\137\x50\x52\x49\x4d\101\122\131\137\x49\115\101\x47\x45"]) { throw new \RuntimeException(Loc::getMessage("\107\125\122\x59\105\126\x5f\x4f\x5a\117\116\56\x49\x4e\x43\x4c\125\x44\x45\56\115\101\111\116\137\111\115\x41\x47\x45\137\x4e\117\124\x5f\123\x45\124\x5f\111\116\x5f\115\x41\111\x4e\137\123\x45\x54\124\111\x4e\107\123")); } goto smfZK; ZdnQ3: if (!$this->settingsData["\120\122\117\120\x5f\127\x45\x49\x47\x48\124\x5f\125\116\x49\x54"]) { throw new \RuntimeException(Loc::getMessage("\107\x55\122\131\x45\126\137\117\x5a\117\x4e\x2e\111\x4e\103\114\125\104\x45\x2e\127\x45\x49\107\x48\124\137\x55\x4e\x49\124\137\116\117\x54\x5f\x53\x45\124\x5f\x49\116\137\115\x41\111\x4e\x5f\x53\x45\124\x54\111\x4e\x47\x53")); } goto Wz5Ds; a36Az: if (empty($this->settingsData)) { throw new \RuntimeException(Loc::getMessage("\107\x55\122\131\105\x56\x5f\117\x5a\x4f\116\56\111\116\103\x4c\125\104\105\56\115\101\x49\116\137\x53\105\x54\124\111\116\x47\x53\137\x4e\x4f\x54\137\x53\105\x54")); } goto EVUaA; GmRUA: } protected function getRelationFields() : void { goto wTr78; kjOcX: foreach ($this->settingsData as $key => $value) { if (stripos($key, "\x50\122\117\x50\137\111\x44") !== false) { if (is_numeric($value) && $value > 0) { $findProps[$key] = $value; } else { if ($value) { $this->relationFields[$key] = $value; } } } } goto PSLQS; wTr78: $findProps = []; goto kjOcX; PSLQS: if ($findProps) { $properties = \CIBlockProperty::GetList(["\x73\x6f\162\x74" => "\x61\163\143", "\x6e\141\x6d\x65" => "\141\163\x63"], ["\111\x42\114\117\x43\113\x5f\x49\x44" => $this->settingsData["\x49\x42\114\x4f\x43\x4b\x5f\123\x4b\x55\137\x49\104"] ?: $this->settingsData["\111\102\114\x4f\103\x4b\x5f\111\104"]]); while ($arProp = $properties->GetNext()) { foreach ($findProps as $key => $value) { if ($value == $arProp["\x49\x44"]) { $this->relationFields[$key] = "\120\122\x4f\120\x45\x52\124\131\x5f" . $arProp["\103\x4f\104\105"]; } } } } goto W0lVp; W0lVp: } public function updateTmpSettingsData(array $updateData) : void { foreach ($updateData as $key => $value) { $this->settingsData[$key] = $value; } } protected function setDomainName() : void { goto R9ipK; va7lK: $this->settingsData["\104\117\x4d\101\111\x4e\137\116\x41\115\x45"] = str_replace(["\x68\x74\164\x70\x3a\x2f\57", "\150\x74\164\160\163\x3a\57\57"], '', $this->settingsData["\x44\117\x4d\x41\111\x4e\x5f\116\x41\115\x45"]); goto FQjiM; FQjiM: $this->settingsData["\x44\x4f\x4d\101\111\x4e\137\x4e\x41\x4d\105"] = $this->settingsData["\x44\x4f\115\x41\111\x4e\x5f\x4e\101\x4d\x45"] ? "\150\164\x74\x70\163\72\x2f\57" . $this->settingsData["\x44\x4f\115\101\x49\x4e\x5f\x4e\101\115\x45"] : ''; goto EzL1A; R9ipK: $this->settingsData["\104\x4f\115\x41\x49\116\137\x4e\101\x4d\x45"] = trim($this->settingsData["\104\117\x4d\101\x49\116\x5f\116\101\x4d\x45"]); goto va7lK; EzL1A: } protected function getDomainName() : string { return $this->settingsData["\104\117\x4d\x41\x49\116\137\116\101\115\x45"]; } public function exportProducts(array $agentExportData = []) : bool { goto nZ8Eb; nZ8Eb: if (!$this->settingsData["\x45\130\x50\117\122\x54\137\101\x43\124\x49\126\x45"] || $this->settingsData["\105\130\120\117\x52\124\137\116\117\x54\x5f\105\130\x50\117\122\x54\x5f\x50\122\x4f\104\x55\103\x54\137\111\x4e\x46\117\122\115\101\x54\111\117\x4e"]) { return false; } goto c2Jd2; qvlmM: $nextAgentCategory = null; goto JnZ2x; JnZ2x: $date = new DateTime(); goto IqQXp; IqQXp: $date->format("\144\x2e\x6d\x2e\x59\x20\x48\x3a\151\72\163"); goto O9Q1x; c2Jd2: $importedProductArts = []; goto qvlmM; CnS3G: try { goto Jyjlb; VPRO1: if ($agentExportData && empty($products) && !$nextAgentCategory) { AgentsTable::update($agentExportData["\111\104"], ["\x43\x55\x52\x52\105\x4e\124\x5f\x43\x41\x54\x45\107\117\x52\131\137\x49\x44" => null, "\103\125\x52\x52\x45\x4e\x54\x5f\120\x41\107\105" => null, "\103\125\122\122\105\116\x54\137\101\x52\124\111\x43\x4c\x45\123" => null, "\x44\x41\124\105\x5f\x55\120\104\101\124\105" => $date]); } goto eyCAY; eyCAY: return true; goto Ss63V; vag4D: $additionalFilter = []; goto SJM3N; ny2zH: $marketplaceObject = new OzonMarketplace(); goto vag4D; Jyjlb: $categoriesByMarketplaces = $this->getCategoriesForMarketplace(); goto ny2zH; SJM3N: foreach ($categoriesByMarketplaces as $key => $category) { goto J21ww; scFwD: do { $products = $this->getProducts($category["\x53\x49\x54\x45\137\111\x44"], $page, $additionalProps, $additionalFilter); if (empty($products)) { $existProducts = false; } else { goto mwY6Z; mwY6Z: $importedProductArtsFlip = $importedProductArts ? array_flip($importedProductArts) : []; goto eDqvD; YNdIe: if ($agentExportData) { $existProducts = false; AgentsTable::update($agentExportData["\x49\104"], ["\x43\125\122\122\x45\116\x54\x5f\x43\101\124\105\107\117\122\x59\137\111\x44" => $category["\x53\x49\124\x45\x5f\x49\x44"], "\103\x55\122\122\x45\116\x54\137\x50\x41\x47\105" => $page + 1, "\x43\x55\122\122\105\116\124\137\x41\122\124\111\103\x4c\x45\123" => Json::encode($importedProductArts, JSON_THROW_ON_ERROR), "\x44\101\x54\105\x5f\x55\120\104\101\124\x45" => $date]); } else { $page++; } goto ekiIu; eDqvD: $preparedData = $marketplaceObject->prepareProductsDataForAdd($category["\x4d\101\122\113\x45\124\137\x49\x44"], $products, $additionalProps, $additionalPropsValues, $importedProductArtsFlip); goto EQWRi; W02iY: if ($event->getResults()) { foreach ($event->getResults() as $eventResult) { if ($eventResult->getResultType() !== EventResult::ERROR) { $preparedData = $eventResult->getParameters(); } } } goto QTqob; XPlYQ: $event->send(); goto W02iY; EQWRi: $event = new Event("\147\165\x72\x79\x65\x76\x2e\x6f\172\157\x6e", "\117\156\105\x78\160\x6f\162\x74\x50\x72\x6f\x64\x75\143\164", [$preparedData]); goto XPlYQ; e4jQb: $importedProductArtsTmp = array_merge(...$importedProductArtsTmp); goto rDKXd; QTqob: $taskData = $marketplaceObject->addProducts($preparedData)["\x74\x61\163\x6b\111\x64\x73"]; goto O2aBe; O2aBe: $importedProductArtsTmp = []; goto uuatV; rDKXd: $importedProductArts = !empty($importedProductArts) ? array_merge($importedProductArts, $importedProductArtsTmp) : $importedProductArtsTmp; goto YNdIe; uuatV: foreach ($taskData as $taskId => $productArticles) { try { $importedProductArtsTmp[] = $productArticles; $res = ExchangeLogTable::add(["\124\131\x50\105" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRODUCTS, "\123\x54\x41\x54\x55\123" => MarketplaceInterface::IMPORT_STATUS_PENDING, "\124\x41\123\x4b\x5f\x49\104" => (string) $taskId, "\120\x52\117\104\125\x43\x54\x53" => Json::encode($productArticles, JSON_THROW_ON_ERROR)]); } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["\x54\131\120\105" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRODUCTS, "\123\x54\x41\x54\125\123" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "\111\x4e\106\x4f\x52\x4d\101\124\x49\x4f\116" => $e->getMessage()]); throw $e; } } goto e4jQb; ekiIu: } } while ($existProducts); goto D_aWG; D_aWG: if ($agentExportData) { if (empty($products)) { $nextAgentCategory = isset($categoriesByMarketplaces[$key + 1]) ? $categoriesByMarketplaces[$key + 1]["\x53\x49\x54\105\x5f\x49\104"] : null; AgentsTable::update($agentExportData["\111\x44"], ["\x43\125\122\x52\x45\x4e\x54\137\103\x41\124\x45\107\117\x52\x59\x5f\x49\x44" => $nextAgentCategory, "\103\x55\122\x52\105\x4e\124\137\x50\x41\x47\x45" => 1, "\x44\101\x54\x45\x5f\125\x50\104\101\124\x45" => $date]); } break; } goto TBbuy; gAptt: $additionalPropsValues = $this->getAdditionalPropsValuesForCategory($category["\123\x49\x54\x45\x5f\x49\104"], $category["\x4d\101\x52\113\x45\124\137\x49\104"], $additionalProps); goto scFwD; sogLK: $existProducts = true; goto IAZnc; XEhI1: if ($agentExportData && $agentCurrentCategory && $category["\x53\x49\x54\x45\137\x49\x44"] != $agentCurrentCategory) { continue; } goto sogLK; J21ww: if ($agentExportData) { $page = $agentCurrentPage; } else { $page = 1; } goto XEhI1; IAZnc: $additionalProps = $this->getAdditionalPropsForCategory($marketplaceObject, $category["\x53\x49\x54\105\x5f\x49\x44"], $category["\x4d\101\x52\113\105\124\137\x49\104"]); goto gAptt; TBbuy: } goto VPRO1; Ss63V: } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["\x54\131\120\x45" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRODUCTS, "\123\124\x41\x54\x55\123" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "\x49\x4e\x46\x4f\122\x4d\101\124\111\x4f\x4e" => $e->getMessage()]); return false; } goto e97at; O9Q1x: if ($agentExportData) { goto dFTw6; VCOsb: $agentCurrentCategory = $agentExportData["\x43\125\x52\x52\105\x4e\124\x5f\x43\x41\124\x45\x47\x4f\122\131\137\x49\x44"] ?: null; goto GNj7Z; dFTw6: $agentCurrentPage = $agentExportData["\103\125\x52\x52\105\x4e\124\x5f\x50\101\107\x45"] ?: 1; goto VCOsb; GNj7Z: $importedProductArts = $agentExportData["\x43\x55\x52\x52\105\116\124\137\x41\x52\124\x49\x43\114\105\123"] ? Json::decode($agentExportData["\x43\125\x52\x52\x45\116\124\x5f\101\x52\124\111\x43\114\x45\123"]) : []; goto xuQuM; xuQuM: } goto CnS3G; e97at: } public function exportPrices(array $agentExportData = []) : bool { goto kkzF8; qAWy9: if ($agentExportData) { goto HtmEB; HtmEB: $agentCurrentPage = $agentExportData["\x43\x55\x52\122\105\116\124\x5f\120\x41\x47\x45"] ?: 1; goto dmUSb; dmUSb: $agentCurrentCategory = $agentExportData["\103\x55\x52\x52\x45\116\124\137\x43\101\x54\x45\x47\117\x52\x59\x5f\x49\104"] ?: null; goto TjS2Y; TjS2Y: $importedProductArts = $agentExportData["\x43\125\x52\122\105\116\x54\x5f\x41\x52\x54\111\x43\114\105\123"] ? Json::decode($agentExportData["\x43\125\122\122\105\x4e\124\x5f\101\122\124\111\103\x4c\105\123"]) : []; goto hoydW; hoydW: } goto mvIEX; kkzF8: if (!$this->settingsData["\x45\x58\120\x4f\122\x54\x5f\101\x43\124\111\x56\x45"] || $this->settingsData["\x45\x58\120\117\122\124\137\x4e\117\124\x5f\105\x58\120\x4f\122\x54\x5f\x50\x52\111\x43\105"]) { return false; } goto dMF1K; mvIEX: try { goto WJtg0; K34R5: foreach ($categoriesByMarketplaces as $key => $category) { goto AtoY8; FhUkm: $existProducts = true; goto A_Muo; v2feN: if ($agentExportData && $agentCurrentCategory && $category["\123\111\x54\x45\x5f\111\104"] != $agentCurrentCategory) { continue; } goto FhUkm; H81Ud: if ($agentExportData) { if (empty($products)) { $nextAgentCategory = isset($categoriesByMarketplaces[$key + 1]) ? $categoriesByMarketplaces[$key + 1]["\x53\111\x54\105\x5f\x49\x44"] : null; AgentsTable::update($agentExportData["\x49\104"], ["\103\x55\122\x52\x45\x4e\x54\137\x43\x41\124\x45\x47\x4f\122\131\137\x49\x44" => $nextAgentCategory, "\103\x55\122\122\x45\x4e\x54\137\x50\x41\107\x45" => 1, "\x44\x41\x54\105\x5f\x55\x50\x44\101\x54\x45" => $date]); } break; } goto oZfkx; A_Muo: do { $products = $this->getProducts($category["\123\111\124\105\137\111\x44"], $page, [], []); if (empty($products)) { $existProducts = false; } else { goto jK1Ud; x5yPg: $event->send(); goto GFOwW; Le5bT: $importedProductArts = !empty($importedProductArts) ? array_merge($importedProductArts, $importedProductArtsTmp) : $importedProductArtsTmp; goto f8Jmj; GFOwW: if ($event->getResults()) { foreach ($event->getResults() as $eventResult) { if ($eventResult->getResultType() !== EventResult::ERROR) { $preparedData = $eventResult->getParameters(); } } } goto nzO0B; nzO0B: $productsPriceUpdateRes = $marketplaceObject->updateProductsPrices($preparedData, true); goto n8hMN; jK1Ud: $importedProductArtsFlip = array_flip($importedProductArts); goto LZHRR; LjPJ6: foreach ($productsPriceUpdateRes["\160\x72\157\x64\x75\x63\x74\101\x72\x74\163\x49\x6e\x66\157"] as $info) { try { if (!empty($info["\165\160\144\x61\x74\x65\144"])) { $importedProductArtsTmp[] = $info["\x75\160\x64\x61\164\x65\144"]; $res = ExchangeLogTable::add(["\x54\131\120\105" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRICES, "\123\124\x41\124\125\123" => MarketplaceInterface::IMPORT_STATUS_UPDATED, "\120\122\117\x44\x55\x43\x54\x53" => Json::encode($info["\x75\x70\144\x61\x74\145\x64"], JSON_THROW_ON_ERROR)]); } if (!empty($info["\x65\162\162\x6f\162\163"])) { goto NQoSX; NQoSX: $productArtsKeys = array_keys($info["\x65\x72\x72\157\x72\x73"]); goto dcYfK; hZUzv: $importedProductArtsTmp[] = $productArtsKeys; goto EHJ7h; EHJ7h: $res = ExchangeLogTable::add(["\124\x59\x50\105" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRICES, "\x53\x54\x41\x54\125\123" => MarketplaceInterface::IMPORT_STATUS_FAILED, "\x50\x52\x4f\104\125\103\124\123" => Json::encode($productArtsKeys, JSON_THROW_ON_ERROR), "\x49\116\106\117\x52\x4d\101\x54\111\117\116" => Json::encode($info["\x65\x72\162\157\x72\163"], JSON_THROW_ON_ERROR)]); goto n7lJA; dcYfK: foreach ($productArtsKeys as $keyArt => $artVal) { $productArtsKeys[$keyArt] = (string) $artVal; } goto hZUzv; n7lJA: } } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["\124\131\x50\x45" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRICES, "\x53\124\101\124\x55\123" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "\111\x4e\x46\117\x52\x4d\x41\x54\x49\x4f\x4e" => $e->getMessage()]); throw $e; } } goto ONeI5; ONeI5: $importedProductArtsTmp = array_merge(...$importedProductArtsTmp); goto Le5bT; LZHRR: $preparedData = $marketplaceObject->prepareProductsDataForUpdatePrices($products, $importedProductArtsFlip); goto qD6wn; n8hMN: $importedProductArtsTmp = []; goto LjPJ6; qD6wn: $event = new Event("\x67\165\x72\x79\x65\166\x2e\x6f\172\157\x6e", "\117\x6e\x45\170\x70\x6f\162\164\x50\x72\151\x63\145", [$preparedData]); goto x5yPg; f8Jmj: if ($agentExportData) { $existProducts = false; AgentsTable::update($agentExportData["\111\104"], ["\103\x55\122\122\x45\x4e\x54\x5f\103\x41\x54\105\x47\117\x52\131\137\x49\x44" => $category["\123\x49\x54\x45\137\111\x44"], "\103\x55\122\x52\x45\x4e\x54\137\x50\x41\x47\x45" => $page + 1, "\103\125\122\122\x45\116\x54\137\x41\x52\124\x49\103\114\x45\123" => Json::encode($importedProductArts, JSON_THROW_ON_ERROR), "\104\101\124\105\137\125\120\104\x41\x54\x45" => $date]); } else { $page++; } goto DydRa; DydRa: } } while ($existProducts); goto H81Ud; AtoY8: if ($agentExportData) { $page = $agentCurrentPage; } else { $page = 1; } goto v2feN; oZfkx: } goto AT89D; WJtg0: $categoriesByMarketplaces = $this->getCategoriesForMarketplace(); goto WLUW2; I_TYm: return true; goto OY_pq; WLUW2: $marketplaceObject = new OzonMarketplace(); goto K34R5; AT89D: if ($agentExportData && empty($products) && !$nextAgentCategory) { AgentsTable::update($agentExportData["\x49\x44"], ["\103\x55\122\122\105\116\x54\137\x43\101\124\105\x47\x4f\x52\x59\x5f\x49\x44" => null, "\x43\x55\122\122\105\116\x54\137\x50\101\107\x45" => null, "\x43\125\x52\x52\x45\x4e\124\137\x41\x52\124\111\x43\114\x45\123" => null, "\x44\101\124\105\x5f\x55\120\104\x41\124\105" => $date]); } goto I_TYm; OY_pq: } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["\124\131\120\x45" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRICES, "\x53\124\101\x54\125\x53" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "\111\116\106\117\x52\x4d\x41\x54\111\x4f\116" => $e->getMessage()]); return false; } goto LP3Fp; SWeiI: $date = new DateTime(); goto CVksn; yceQB: $nextAgentCategory = null; goto SWeiI; CVksn: $date->format("\144\x2e\x6d\x2e\131\x20\110\72\x69\x3a\163"); goto qAWy9; dMF1K: $importedProductArts = []; goto yceQB; LP3Fp: } public function exportStocks(array $agentExportData = []) : bool { goto uBN7z; aC_S0: try { goto WuvXn; l3RRH: if (!$useWarehouse) { goto K57nw; K57nw: $ozonWarehouses = $marketplaceObject->getWarehouses(); goto j9Y2S; j9Y2S: $ozonWarehouses = $ozonWarehouses["\162\x65\x73\x75\154\x74"] ?: []; goto A5p5H; A5p5H: if (count($ozonWarehouses) > 1) { $res = ExchangeLogTable::add(["\124\131\120\x45" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_STOCKS, "\123\124\101\x54\125\123" => MarketplaceInterface::IMPORT_STATUS_FAILED, "\x49\116\x46\117\122\x4d\x41\x54\x49\x4f\116" => Loc::getMessage("\x47\125\122\131\x45\x56\x5f\117\x5a\117\116\56\x49\x4e\103\114\125\x44\105\x2e\x48\101\126\105\x5f\x4d\117\122\105\137\x54\x48\101\x4e\137\117\x4e\105\137\x57\x41\x52\x45\x48\x4f\x55\x53\105")]); return false; } goto eq1CC; eq1CC: } goto hc4_z; hc4_z: foreach ($categoriesByMarketplaces as $key => $category) { goto nT3Sc; gi0Uq: if ($agentExportData) { if (empty($products)) { $nextAgentCategory = isset($categoriesByMarketplaces[$key + 1]) ? $categoriesByMarketplaces[$key + 1]["\123\x49\x54\x45\137\x49\104"] : null; AgentsTable::update($agentExportData["\111\x44"], ["\x43\125\x52\122\105\x4e\124\137\x43\101\x54\105\x47\117\x52\x59\137\x49\104" => $nextAgentCategory, "\x43\125\122\x52\105\116\124\137\x50\101\x47\105" => 1, "\x44\x41\124\105\x5f\125\x50\x44\x41\124\105" => $date]); } break; } goto U57kR; XAzJx: if ($agentExportData && $agentCurrentCategory && $category["\123\x49\124\105\137\x49\104"] != $agentCurrentCategory) { continue; } goto xojXv; F0VQT: do { $products = $this->getProducts($category["\x53\111\124\x45\x5f\x49\104"], $page, [], []); if (empty($products)) { $existProducts = false; } else { goto bOrxS; x7OnN: if ($event->getResults()) { foreach ($event->getResults() as $eventResult) { if ($eventResult->getResultType() !== EventResult::ERROR) { $preparedData = $eventResult->getParameters(); } } } goto vvRqA; VJDIm: if ($agentExportData) { $existProducts = false; AgentsTable::update($agentExportData["\111\104"], ["\103\x55\122\x52\x45\x4e\x54\x5f\103\101\x54\x45\x47\x4f\122\131\137\x49\104" => $category["\x53\x49\x54\105\x5f\111\x44"], "\x43\x55\x52\x52\105\x4e\x54\137\x50\x41\107\105" => $page + 1, "\103\x55\122\122\x45\x4e\124\137\101\122\x54\x49\103\x4c\105\123" => Json::encode($importedProductArts, JSON_THROW_ON_ERROR), "\x44\101\x54\x45\137\125\120\104\x41\x54\105" => $date]); } else { $page++; } goto pPKFG; wHmzA: $importedProductArtsTmp = []; goto F6Kkg; LS1BM: $importedProductArts = !empty($importedProductArts) ? array_merge($importedProductArts, $importedProductArtsTmp) : $importedProductArtsTmp; goto VJDIm; Wbi7K: $event->send(); goto x7OnN; d53t0: $importedProductArtsTmp = array_merge(...$importedProductArtsTmp); goto LS1BM; PxHJW: $preparedData = $marketplaceObject->prepareProductsDataForUpdateStocks($products, $useWarehouse, $importedProductArtsFlip); goto H27OM; bOrxS: $importedProductArtsFlip = array_flip($importedProductArts); goto PxHJW; vvRqA: $productsStockUpdateRes = $marketplaceObject->updateProductsStocks($preparedData, $useWarehouse, true); goto wHmzA; F6Kkg: foreach ($productsStockUpdateRes["\x70\x72\157\x64\165\x63\164\x41\162\164\x73\x49\x6e\x66\x6f"] as $info) { try { if (!empty($info["\x75\160\144\x61\164\145\x64"])) { $importedProductArtsTmp[] = $info["\165\x70\x64\141\x74\145\x64"]; $res = ExchangeLogTable::add(["\x54\131\120\105" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_STOCKS, "\x53\x54\x41\124\125\x53" => MarketplaceInterface::IMPORT_STATUS_UPDATED, "\x50\x52\117\104\x55\x43\x54\x53" => Json::encode($info["\x75\160\x64\141\x74\145\x64"], JSON_THROW_ON_ERROR)]); } if (!empty($info["\x65\x72\x72\x6f\x72\x73"])) { goto mdqqT; SKiuS: foreach ($productArtsKeys as $keyArt => $artVal) { $productArtsKeys[$keyArt] = (string) $artVal; } goto FxeCq; nrki2: $res = ExchangeLogTable::add(["\x54\131\120\x45" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_STOCKS, "\x53\x54\101\x54\x55\123" => MarketplaceInterface::IMPORT_STATUS_FAILED, "\120\x52\117\104\125\x43\124\123" => Json::encode($productArtsKeys, JSON_THROW_ON_ERROR), "\111\116\x46\117\122\115\x41\124\x49\x4f\x4e" => Json::encode($info["\145\162\162\157\x72\163"], JSON_THROW_ON_ERROR)]); goto gsX9B; FxeCq: $importedProductArtsTmp[] = $productArtsKeys; goto nrki2; mdqqT: $productArtsKeys = array_keys($info["\x65\x72\162\x6f\162\x73"]); goto SKiuS; gsX9B: } } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["\124\x59\120\105" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_STOCKS, "\123\x54\101\124\x55\x53" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "\x49\116\x46\x4f\x52\115\x41\124\111\x4f\x4e" => $e->getMessage()]); throw $e; } } goto d53t0; H27OM: $event = new Event("\147\165\x72\x79\x65\166\56\x6f\172\157\x6e", "\x4f\x6e\x45\x78\x70\x6f\x72\x74\123\164\157\143\x6b", [$preparedData]); goto Wbi7K; pPKFG: } } while ($existProducts); goto gi0Uq; xojXv: $existProducts = true; goto F0VQT; nT3Sc: if ($agentExportData) { $page = $agentCurrentPage; } else { $page = 1; } goto XAzJx; U57kR: } goto MZL0Q; myuU1: $useWarehouse = $this->settingsData["\127\x41\122\x45\x48\x4f\x55\123\105\x5f\x49\104"] ? true : false; goto l3RRH; MZL0Q: if ($agentExportData && empty($products) && !$nextAgentCategory) { AgentsTable::update($agentExportData["\x49\x44"], ["\103\x55\x52\122\x45\116\124\137\103\101\x54\105\x47\117\122\131\137\x49\104" => null, "\103\x55\x52\122\x45\116\x54\137\x50\101\x47\x45" => null, "\103\125\x52\x52\105\116\124\137\101\122\x54\111\x43\114\105\123" => null, "\104\x41\124\105\137\125\x50\104\101\x54\x45" => $date]); } goto UPj6f; iq_QU: $marketplaceObject = new OzonMarketplace(); goto myuU1; WuvXn: $categoriesByMarketplaces = $this->getCategoriesForMarketplace(); goto iq_QU; UPj6f: return true; goto kzMlV; kzMlV: } catch (\RuntimeException $e) { $res = ExchangeLogTable::add(["\124\131\120\105" => MarketplaceInterface::EXCHANGE_TYPE_EXPORT_PRICES, "\x53\124\x41\x54\125\123" => MarketplaceInterface::IMPORT_STATUS_EXCEPTION, "\111\x4e\x46\x4f\122\115\101\x54\x49\x4f\x4e" => $e->getMessage()]); return false; } goto XD6pD; uDNcm: $nextAgentCategory = null; goto AJzca; bRvvG: if ($agentExportData) { goto UW2g2; sPHmr: $agentCurrentCategory = $agentExportData["\x43\125\122\x52\x45\x4e\124\x5f\103\101\124\105\107\x4f\122\x59\x5f\111\104"] ?: null; goto Xy2Eu; UW2g2: $agentCurrentPage = $agentExportData["\x43\x55\122\x52\105\116\124\137\x50\101\x47\105"] ?: 1; goto sPHmr; Xy2Eu: $importedProductArts = $agentExportData["\103\125\122\x52\x45\x4e\124\x5f\101\x52\124\x49\103\x4c\105\123"] ? Json::decode($agentExportData["\x43\125\122\122\105\116\124\x5f\x41\122\124\111\x43\x4c\105\x53"]) : []; goto N4HL8; N4HL8: } goto aC_S0; tLmg3: $date->format("\144\x2e\x6d\56\131\x20\110\x3a\x69\x3a\x73"); goto bRvvG; bnRvG: $importedProductArts = []; goto uDNcm; uBN7z: if (!$this->settingsData["\x45\130\120\x4f\122\x54\137\x41\x43\x54\x49\126\105"] || $this->settingsData["\105\x58\x50\117\122\124\137\116\x4f\124\137\105\130\120\x4f\x52\124\137\x53\x54\117\103\113"]) { return false; } goto bnRvG; AJzca: $date = new DateTime(); goto tLmg3; XD6pD: } public function getCategoriesForMarketplace() : array { goto aL7_Y; UZT7b: $siteSectionIds = []; goto cghEb; CUSU0: if ($this->settingsData["\x49\102\114\117\x43\x4b\x5f\123\113\125\137\x55\123\x45"]) { $arFilterCharacteristicsConnections["\111\102\114\x4f\103\x4b\x5f\x53\113\125\137\125\123\x45"] = 1; } else { $arFilterCharacteristicsConnections["\111\102\x4c\117\x43\x4b\137\123\x4b\125\137\125\123\x45"] = null; } goto fWkM0; vObdh: $arFilterMarketplacesCategoriesConditions = array_values($arFilterMarketplacesCategoriesConditions); goto Bqirc; fWkM0: $characteristicsConnections = CharacteristicsConnectionsTable::getList(["\x66\x69\x6c\164\x65\x72" => $arFilterCharacteristicsConnections, "\x73\145\x6c\145\143\x74" => ["\103\101\x54\105\x47\117\x52\131\137\111\x44", "\115\x41\x52\113\x45\124\x5f\103\101\x54\x45\x47\x4f\122\x59\137\111\x44"]]); goto llNFf; qCZqR: $iblockSectionIds = []; goto zC7OP; kbKvj: return $result; goto hEIOg; llNFf: $arFilterMarketplacesCategories = ["\x4c\117\x47\x49\103" => "\x4f\122"]; goto vph4w; fwyRJ: while ($arSection = $rsSection->Fetch()) { $iblockSectionIds[$arSection["\x49\x44"]] = $arSection["\111\x44"]; } goto T1qwW; aL7_Y: $result = []; goto CUSU0; T1qwW: foreach ($categoriesConnectionsData as $value) { if ($iblockSectionIds[$value["\x53\x49\124\105\137\x49\104"]]) { $result[] = $value; } } goto kbKvj; pJd4G: while ($row = $characteristicsConnections->fetch()) { $arFilterMarketplacesCategoriesConditions[$row["\x43\101\124\x45\107\117\122\x59\137\x49\x44"] . "\x5f" . $row["\x4d\x41\122\x4b\105\x54\137\103\101\x54\105\x47\x4f\x52\131\x5f\x49\x44"]] = ["\101\103\x54\111\126\x45" => 1, "\123\x49\x54\x45\x5f\x49\104" => $row["\103\x41\x54\105\x47\117\122\x59\x5f\111\104"], "\115\101\122\x4b\x45\x54\x5f\111\104" => $row["\x4d\x41\x52\x4b\x45\124\137\x43\x41\124\105\107\x4f\x52\x59\x5f\111\104"]]; } goto vObdh; WPDtF: $categoriesConnectionsData = CategoriesConnectionsTable::getList(["\x66\x69\x6c\x74\145\x72" => $arFilterMarketplacesCategories, "\x73\145\154\x65\x63\x74" => ["\111\104", "\123\x49\x54\x45\137\x49\x44", "\x4d\x41\x52\113\105\124\x5f\x49\x44"]])->fetchAll(); goto UZT7b; cghEb: foreach ($categoriesConnectionsData as $value) { $siteSectionIds[] = $value["\123\111\x54\105\137\111\104"]; } goto qCZqR; euaUA: $arFilterMarketplacesCategories = array_merge($arFilterMarketplacesCategories, $arFilterMarketplacesCategoriesConditions); goto WPDtF; Bqirc: if (empty($arFilterMarketplacesCategoriesConditions)) { return $result; } goto euaUA; vph4w: $arFilterMarketplacesCategoriesConditions = []; goto pJd4G; zC7OP: $rsSection = SectionTable::getList(array("\146\151\x6c\x74\x65\162" => array("\x49\x42\x4c\117\103\x4b\137\111\104" => $this->settingsData["\x49\x42\114\x4f\x43\x4b\x5f\111\x44"], "\111\104" => $siteSectionIds, "\107\x4c\x4f\x42\101\x4c\137\x41\x43\x54\x49\x56\105" => "\131"), "\x73\x65\x6c\x65\x63\164" => ["\x49\104", "\111\102\x4c\117\x43\x4b\x5f\x53\x45\103\x54\111\117\116\x5f\x49\104", "\111\x42\x4c\x4f\x43\113\x5f\x49\x44"])); goto fwyRJ; hEIOg: } public function getAdditionalPropsForCategory(MarketplaceInterface $marketplaceObject, int $siteSectionId, string $marketSectionId) : array { goto DFL6u; hOIxd: $characteristicsConnections = CharacteristicsConnectionsTable::getList(["\x66\151\154\x74\x65\162" => $arFilterCharacteristicsConnections, "\163\145\154\145\143\x74" => ["\x49\x44", "\x50\x52\117\120\x45\122\x54\x59\x5f\x49\104", "\x4d\x41\x52\x4b\105\x54\x5f\x49\104"]]); goto lHeul; TkgxP: $properties = PropertyTable::getList(array("\x73\x65\x6c\145\143\164" => array("\111\x44", "\x49\x42\x4c\117\103\113\x5f\x49\x44", "\x43\117\x44\105", "\x50\122\x4f\120\x45\x52\x54\x59\137\x54\x59\x50\x45", "\110\x49\x4e\x54"), "\x66\x69\154\164\145\x72" => array("\x3d\x49\102\x4c\117\x43\x4b\137\111\104" => $this->settingsData["\x49\102\x4c\x4f\103\x4b\137\123\x4b\125\x5f\111\104"] ?: $this->settingsData["\111\x42\114\117\x43\113\x5f\x49\104"], "\x3d\111\104" => array_keys($characteristicsConnectionsProcessed), "\75\101\x43\x54\x49\126\105" => "\131"), "\x6f\162\144\x65\162" => array("\123\x4f\x52\124" => "\x41\x53\103")))->fetchAll(); goto G8igk; ZFmU7: if (!$marketplaceCategoryProperties) { return []; } goto u49a7; Q2vKl: $characteristicsConnectionsProcessed = []; goto rSCEi; lHeul: while ($row = $characteristicsConnections->fetch()) { $characteristicsConnectionsProcessed[$row["\x50\122\117\x50\x45\122\x54\x59\x5f\111\104"]][] = $row; } goto gh7ku; gh7ku: $marketplaceCategoryProperties = $marketplaceObject->getCategoryProperties([$marketSectionId])[0]["\x76\141\154\165\145\x73"]; goto ZFmU7; u49a7: $marketplaceCategoryPropertiesProcessed = []; goto yE7US; yE7US: foreach ($marketplaceCategoryProperties as $marketplaceCategoryProperty) { $marketplaceCategoryPropertiesProcessed[$marketplaceCategoryProperty["\151\144"]] = $marketplaceCategoryProperty; } goto TkgxP; rSCEi: $arFilterCharacteristicsConnections = ["\103\101\x54\x45\107\117\122\131\x5f\111\104" => $siteSectionId, "\x4d\101\122\113\x45\124\137\103\x41\124\x45\107\x4f\122\131\137\111\x44" => $marketSectionId]; goto kLS79; RO8MK: return $result; goto Aj14k; G8igk: foreach ($properties as $property) { $characteristicConnections = $characteristicsConnectionsProcessed[$property["\x49\x44"]]; foreach ($characteristicConnections as $characteristicConnection) { $marketplaceCategoryProperty = $marketplaceCategoryPropertiesProcessed[$characteristicConnection["\115\x41\x52\113\x45\124\137\x49\104"]]; $result[] = ["\x53\111\124\105\137\x50\x52\117\120\x45\x52\x54\131\x5f\104\101\124\x41" => ["\111\x44" => $characteristicConnection["\120\x52\117\120\x45\122\x54\x59\x5f\111\x44"], "\x43\x4f\104\x45" => $property["\103\x4f\x44\x45"], "\124\x59\120\105" => $property["\x50\122\x4f\120\105\122\124\131\137\124\x59\120\x45"], "\x48\x49\x4e\x54" => $property["\110\x49\116\124"]], "\115\101\x52\x4b\x45\124\137\120\x52\117\x50\105\122\x54\x59\x5f\104\x41\x54\101" => $marketplaceCategoryProperty]; } } goto RO8MK; kLS79: if ($this->settingsData["\111\x42\x4c\117\x43\x4b\137\123\113\125\x5f\x55\123\105"]) { $arFilterCharacteristicsConnections["\x49\x42\114\x4f\x43\x4b\x5f\123\113\x55\x5f\x55\x53\105"] = 1; } else { $arFilterCharacteristicsConnections["\111\102\114\x4f\103\113\137\x53\x4b\125\x5f\125\x53\x45"] = null; } goto hOIxd; DFL6u: $result = []; goto Q2vKl; Aj14k: } public function getAdditionalPropsValuesForCategory(int $siteSectionId, string $marketSectionId, array $additionalProps) : array { goto N70GO; JWred: if ($this->settingsData["\111\102\x4c\x4f\103\113\137\x53\113\x55\137\125\123\105"]) { $arFilterCharacteristicsValuesConnections["\x49\x42\x4c\x4f\x43\113\137\x53\113\x55\137\125\x53\105"] = 1; } else { $arFilterCharacteristicsValuesConnections["\x49\102\114\x4f\103\113\137\x53\113\125\137\125\123\x45"] = null; } goto exx0u; exx0u: $characteristicsValuesConnections = ValuesConnectionsTable::getList(["\x66\x69\x6c\x74\x65\162" => $arFilterCharacteristicsValuesConnections, "\x73\145\x6c\x65\x63\164" => ["\x49\104", "\x50\x52\x4f\x50\x45\122\124\131\137\x49\x44", "\123\111\x54\105\137\x56\x41\x4c\x55\x45\x5f\x49\x44", "\x4d\101\x52\x4b\x45\x54\x5f\111\104", "\115\x41\x52\x4b\105\x54\x5f\x56\101\x4c\x55\x45\137\x49\x44", "\x4d\101\122\113\105\x54\x5f\x56\101\114\125\105\137\x4e\101\115\105"]]); goto j0nvy; j0nvy: while ($row = $characteristicsValuesConnections->fetch()) { $result[$row["\x50\x52\117\120\x45\x52\x54\131\x5f\111\104"]][] = $row; } goto zn32s; N70GO: $result = []; goto yhXjT; Dyz4N: foreach ($additionalProps as $value) { $sitePropertyIDs[] = $value["\123\111\124\105\137\x50\x52\x4f\120\x45\x52\124\x59\137\104\101\124\x41"]["\x49\x44"]; } goto FQvEL; zn32s: return $result; goto RUzNW; yhXjT: $sitePropertyIDs = []; goto Dyz4N; FQvEL: $arFilterCharacteristicsValuesConnections = ["\103\x41\124\x45\x47\117\122\x59\x5f\x49\104" => $siteSectionId, "\115\101\x52\x4b\105\x54\137\103\x41\x54\x45\x47\117\122\x59\x5f\111\104" => $marketSectionId, "\120\x52\x4f\120\x45\122\124\131\x5f\x49\104" => $sitePropertyIDs]; goto JWred; RUzNW: } public function getProducts(int $sectionId, int $page, array $additionalProps, array $additionalFilter = []) : array { goto g8oEP; X6U2A: $selectProps = array_merge(array_values($this->relationFields), $propCodes); goto Gj6x7; CzFkA: if (!$this->settingsData["\105\130\x50\x4f\x52\124\137\116\x4f\x54\137\x41\103\x54\111\126\x45"]) { $arFilter["\101\x43\x54\x49\x56\x45"] = "\131"; $arFilterSku["\x41\103\124\x49\126\x45"] = "\x59"; } goto fwFyd; qe31A: if ($needRepeatUpdate) { foreach ($result as $productId => $data) { goto c6wcL; e7j2v: if (isset($productsPrice["\x50\122\x49\103\x45"][$productId]) && $productsPrice["\120\122\x49\x43\105"][$productId] >= 0) { $result[$productId]["\x46\111\x45\114\104\123"]["\120\122\x4f\x50\x5f\111\x44\137\x50\122\x49\x43\x45"] = $productsPrice["\x50\122\x49\103\x45"][$productId]; } goto sigg4; MiLWR: if (isset($productsPrice["\x50\x52\x45\x4d\111\125\115\137\x50\x52\x49\103\x45"][$productId]) && $productsPrice["\x50\x52\105\115\x49\125\x4d\x5f\x50\122\x49\103\105"][$productId] >= 0) { $result[$productId]["\106\111\105\x4c\x44\x53"]["\120\122\117\x50\137\x49\104\x5f\120\x52\105\x4d\111\125\115\x5f\120\122\x49\103\x45"] = $productsPrice["\120\122\x45\115\x49\x55\x4d\x5f\120\x52\111\x43\105"][$productId]; } goto OMbFV; sigg4: if (isset($productsPrice["\x4f\114\104\x5f\x50\122\x49\103\105"][$productId]) && $productsPrice["\117\114\x44\x5f\120\122\x49\x43\105"][$productId] >= 0) { $result[$productId]["\106\x49\105\x4c\x44\123"]["\x50\x52\117\x50\x5f\111\x44\x5f\x4f\x4c\x44\137\120\122\x49\103\x45"] = $productsPrice["\x4f\114\x44\x5f\120\x52\x49\x43\105"][$productId]; } goto MiLWR; c6wcL: if (isset($productsCount[$productId]) && $productsCount[$productId] >= 0) { $result[$productId]["\106\111\105\x4c\x44\x53"]["\x50\x52\x4f\x50\x5f\x49\x44\x5f\123\x54\117\103\x4b"] = $productsCount[$productId]; } goto e7j2v; OMbFV: } } goto b0R6S; koBXQ: $needRepeatUpdate = false; goto B06PD; L0170: if ($additionalFilter) { $arFilter = array_merge($arFilter, $additionalFilter); } goto sMP4U; qgmOj: if (Loader::includeModule("\x73\141\154\x65") && $productIds && ($this->settingsData["\120\122\x4f\120\137\x49\x44\x5f\120\122\111\103\x45"] && !is_numeric($this->settingsData["\120\122\117\x50\x5f\x49\104\137\x50\x52\x49\x43\x45"]) || $this->settingsData["\120\x52\x4f\120\x5f\111\104\x5f\117\114\104\137\120\122\111\103\105"] && !is_numeric($this->settingsData["\120\x52\x4f\x50\x5f\x49\104\137\117\x4c\x44\x5f\120\x52\x49\x43\x45"]) || $this->settingsData["\120\x52\x4f\x50\137\x49\104\x5f\120\x52\105\x4d\x49\x55\115\x5f\x50\122\x49\103\105"] && !is_numeric($this->settingsData["\120\122\x4f\x50\137\x49\x44\137\x50\122\x45\x4d\x49\125\115\137\120\122\x49\103\x45"]))) { goto yst1j; l6aI1: $dbPriceTypes = \CCatalogGroup::GetList([], []); goto W11_0; W11_0: while ($arPriceType = $dbPriceTypes->Fetch()) { $priceTypes[$arPriceType["\x58\115\x4c\137\111\x44"]] = $arPriceType["\x49\x44"]; } goto Me6Aj; SJ490: while ($arPriceProduct = $rsPricesProducts->fetch()) { if ($propIdPriceCatalogGroupId && $arPriceProduct["\103\x41\x54\x41\x4c\117\107\137\x47\x52\117\x55\120\137\x49\x44"] == $propIdPriceCatalogGroupId) { $productsPrice["\x50\122\111\x43\105"][$arPriceProduct["\120\x52\x4f\104\125\103\x54\x5f\x49\x44"]] = $arPriceProduct["\120\122\111\103\105"]; } if ($propIdOldPriceCatalogGroupId && $arPriceProduct["\103\101\x54\x41\114\x4f\x47\x5f\107\122\117\125\120\x5f\x49\104"] == $propIdOldPriceCatalogGroupId) { $productsPrice["\x4f\114\104\137\x50\x52\111\103\105"][$arPriceProduct["\x50\x52\x4f\104\x55\103\124\x5f\111\x44"]] = $arPriceProduct["\x50\x52\111\x43\x45"]; } if ($propIdPremiumPriceCatalogGroupId && $arPriceProduct["\103\101\124\101\114\x4f\107\x5f\x47\122\x4f\125\120\x5f\x49\104"] == $propIdPremiumPriceCatalogGroupId) { $productsPrice["\120\x52\x45\115\x49\125\115\x5f\120\122\111\103\x45"][$arPriceProduct["\120\122\x4f\x44\x55\x43\124\137\x49\x44"]] = $arPriceProduct["\120\x52\111\x43\105"]; } } goto qKgph; qKgph: $needRepeatUpdate = true; goto BpkVE; yst1j: $priceTypes = []; goto l6aI1; Me6Aj: $propIdPriceCatalogGroupId = $priceTypes[$this->relationFields["\x50\122\x4f\120\137\111\104\137\x50\x52\111\x43\x45"]] ?: null; goto rRMdu; tm_QJ: $propIdPremiumPriceCatalogGroupId = $priceTypes[$this->relationFields["\x50\x52\x4f\120\137\111\104\137\x50\x52\105\x4d\111\x55\x4d\x5f\120\x52\111\103\x45"]] ?: null; goto BCtJD; rRMdu: $propIdOldPriceCatalogGroupId = $priceTypes[$this->relationFields["\120\122\117\120\137\x49\104\x5f\x4f\x4c\104\137\x50\122\x49\x43\105"]] ?: null; goto tm_QJ; BCtJD: $rsPricesProducts = \Bitrix\Catalog\PriceTable::getList(["\x73\145\x6c\x65\143\164" => ["\x2a"], "\x66\151\x6c\164\x65\x72" => ["\75\120\x52\x4f\x44\x55\x43\124\137\111\x44" => $productIds]]); goto SJ490; BpkVE: } goto qe31A; b0R6S: return $result; goto if44M; Gj6x7: if ($this->settingsData["\x49\102\x4c\117\x43\x4b\137\x53\x4b\125\137\x55\123\x45"] && $this->settingsData["\x49\x42\114\117\103\113\137\123\x4b\125\x5f\x49\104"] && $additionalFilter["\x53\113\125\x5f\x49\x44"]) { $arFilter = ["\x49\x42\114\x4f\103\x4b\x5f\x49\x44" => $this->settingsData["\111\102\114\x4f\103\113\x5f\123\113\x55\137\x49\104"], "\111\104" => $additionalFilter["\x53\x4b\x55\137\111\104"]]; } else { $arFilter = ["\x49\x42\114\117\103\x4b\x5f\111\x44" => $this->settingsData["\111\x42\114\x4f\x43\113\x5f\x49\104"], "\123\x45\x43\x54\111\117\116\137\x49\104" => $sectionId]; $arFilterSku = ["\x49\102\x4c\x4f\103\113\x5f\x49\104" => $this->settingsData["\x49\102\x4c\117\x43\x4b\137\x53\113\125\137\111\x44"]]; } goto CzFkA; g8oEP: $result = []; goto OLKxZ; sHl6D: $productsPrice = []; goto sSkAB; OLKxZ: $propCodes = []; goto REswP; ECzOf: if ($this->settingsData["\x49\102\x4c\117\103\113\137\x53\x4b\x55\x5f\x55\123\105"] && $this->settingsData["\111\x42\x4c\117\x43\113\137\123\x4b\125\x5f\x49\104"] && !$additionalFilter["\x53\113\x55\137\x49\104"]) { goto Ubm6u; Ubm6u: $resElems = \CIBlockElement::GetList(["\111\x44" => "\x41\123\103"], $arFilter, false, ["\151\x4e\x75\x6d\x50\x61\147\x65" => $page, "\156\x50\x61\147\x65\x53\x69\x7a\145" => self::COUNT_ELEMENTS_FOR_CATEGORY, "\143\x68\145\x63\x6b\117\165\164\x4f\146\x52\141\x6e\147\145" => true], ["\x49\x42\114\117\x43\113\x5f\111\104", "\x49\x44"]); goto pAiJW; flNpd: while ($arElem = $resElems->GetNext()) { $mainProductsIds[] = $arElem["\x49\104"]; } goto L5Yy2; pAiJW: $mainProductsIds = []; goto flNpd; L5Yy2: if ($mainProductsIds) { goto yGkt8; V3rXS: $rsOffers = \CIBlockElement::GetList(["\111\x44" => "\101\x53\x43"], $arFilterSku, false, false, array_merge(["\111\102\x4c\x4f\103\113\x5f\111\104", "\x49\x44"], $selectProps)); goto AbsBT; yGkt8: $arFilterSku["\120\122\x4f\x50\x45\x52\x54\x59\x5f" . $this->settingsData["\x53\113\x55\137\x50\122\117\x50\105\x52\124\x59\x5f\x49\104"]] = $mainProductsIds; goto V3rXS; AbsBT: while ($arOffer = $rsOffers->GetNextElement()) { $preparedElemData = $this->prepareElemDataForGetProducts($arOffer); $productIds[] = $preparedElemData["\x49\x44"]; $result[$preparedElemData["\x49\x44"]] = $preparedElemData; } goto QmfOs; QmfOs: } goto XYGPe; XYGPe: } else { $resElems = \CIBlockElement::GetList(["\111\x44" => "\101\x53\x43"], $arFilter, false, ["\151\x4e\x75\155\x50\141\x67\x65" => $page, "\x6e\120\x61\x67\x65\x53\151\172\145" => self::COUNT_ELEMENTS_FOR_CATEGORY, "\143\x68\x65\x63\153\117\x75\164\x4f\146\x52\x61\156\147\x65" => true], array_merge(["\x49\102\x4c\117\103\x4b\137\111\x44", "\111\x44"], $selectProps)); while ($arElem = $resElems->GetNextElement()) { $preparedElemData = $this->prepareElemDataForGetProducts($arElem); $productIds[] = $preparedElemData["\x49\104"]; $result[$preparedElemData["\x49\x44"]] = $preparedElemData; } } goto koBXQ; sSkAB: if (Loader::includeModule("\x63\141\x74\x61\x6c\x6f\x67") && $this->settingsData["\x50\x52\117\120\x5f\111\104\137\123\x54\x4f\103\x4b"] === "\x53\x54\117\122\x45\x5f\x43\117\125\x4e\x54" && $productIds) { goto MsMsN; Kx77r: $needRepeatUpdate = true; goto nCh9i; MsMsN: $rsStoreProducts = \Bitrix\Catalog\StoreProductTable::getList(array("\146\151\x6c\164\145\x72" => array("\120\122\117\104\x55\x43\124\137\111\x44" => $productIds, "\x53\x54\x4f\122\x45\x2e\x41\103\x54\111\x56\x45" => "\x59"))); goto uiGTm; uiGTm: while ($arStoreProduct = $rsStoreProducts->fetch()) { $productsCount[$arStoreProduct["\120\122\117\104\x55\x43\124\137\x49\x44"]] += $arStoreProduct["\x41\x4d\117\x55\116\x54"]; } goto Kx77r; nCh9i: } goto qgmOj; REswP: foreach ($additionalProps as $additionalProp) { $propCodes[] = $additionalProp["\x53\111\x54\x45\137\x50\122\x4f\x50\105\x52\124\x59\x5f\104\x41\124\x41"]["\103\117\x44\x45"]; } goto X6U2A; B06PD: $productsCount = []; goto sHl6D; sMP4U: $productIds = []; goto ECzOf; fwFyd: if ($this->settingsData["\103\125\x53\124\117\x4d\x5f\x46\x49\x4c\x54\105\x52"]) { $this->settingsData["\103\125\x53\124\x4f\x4d\x5f\x46\x49\114\x54\105\122\137\123\x48\x4f\122\x54"] = $this->settingsData["\103\125\123\124\x4f\x4d\x5f\x46\x49\114\x54\105\122"] ? Json::decode($this->settingsData["\103\125\x53\x54\117\115\x5f\106\111\x4c\x54\x45\122"]) : null; if (Loader::includeModule("\143\141\164\x61\x6c\157\x67") && !$this->settingsData["\x43\x55\x53\x54\x4f\115\137\106\111\x4c\x54\x45\x52\x5f\x53\x48\117\122\124"]["\120\122\x4f\120\x45\x52\x54\131\137\111\x44"]) { goto hGWgp; Fs5tx: $productFilter->prepareFilter(); goto DS7_T; DS7_T: $productFilterProcessed = $productFilter->getProcessedFilter(); goto xVeb6; xVeb6: $arFilter = array_merge($arFilter, $productFilterProcessed); goto NQFRr; hGWgp: $productFilter = new ProductFilter($this->settingsData["\x43\x55\x53\x54\117\x4d\137\x46\x49\114\x54\105\122"]); goto Fs5tx; NQFRr: } else { goto ahJtp; ahJtp: $shortFilterForIblockSku = false; goto rcIK9; BnCiE: if (!$this->settingsData["\111\x42\114\117\x43\x4b\x5f\x53\x4b\x55\137\125\123\105"] || !$shortFilterForIblockSku) { $arFilter = array_merge($arFilter, ["\x50\x52\x4f\120\x45\122\124\x59\137" . $this->settingsData["\x43\125\123\124\x4f\x4d\x5f\106\x49\114\124\105\122\x5f\123\110\117\x52\124"]["\120\x52\117\x50\105\x52\124\x59\x5f\111\104"] => $this->settingsData["\103\x55\123\x54\117\115\137\x46\111\x4c\x54\105\x52\137\x53\110\117\122\x54"]["\120\122\x4f\120\x45\122\x54\x59\137\126\x41\x4c\125\105"]]); } goto Rt4FF; rcIK9: if ($this->settingsData["\x49\x42\x4c\x4f\x43\113\137\123\113\x55\x5f\x55\123\105"]) { goto tg_be; FjE50: $skuProperties = \CIBlockProperty::GetList(["\151\x64" => "\141\163\143"], ["\x49\x42\x4c\x4f\103\x4b\x5f\111\104" => $this->settingsData["\111\102\114\x4f\x43\x4b\137\123\113\x55\x5f\x49\104"]]); goto YWdHe; tg_be: $skuPropertyIds = []; goto FjE50; Fj5E2: if ($skuPropertyIds[$this->settingsData["\103\x55\123\124\x4f\x4d\137\106\x49\114\x54\105\x52\x5f\123\110\117\122\124"]["\x50\x52\117\x50\x45\122\124\131\x5f\111\104"]]) { $arFilterSku = array_merge($arFilterSku, ["\x50\122\x4f\x50\x45\122\x54\x59\x5f" . $this->settingsData["\103\x55\x53\x54\117\115\x5f\106\x49\x4c\124\x45\122\137\x53\x48\117\x52\x54"]["\x50\122\117\x50\x45\122\x54\131\137\111\x44"] => $this->settingsData["\103\x55\x53\124\x4f\x4d\x5f\106\x49\x4c\x54\x45\x52\137\123\x48\x4f\122\124"]["\x50\x52\x4f\x50\105\x52\x54\x59\137\x56\101\114\125\x45"]]); $shortFilterForIblockSku = true; } goto QxPwR; YWdHe: while ($arSkuProp = $skuProperties->GetNext()) { $skuPropertyIds[$arSkuProp["\x49\x44"]] = $arSkuProp["\111\104"]; } goto Fj5E2; QxPwR: } goto BnCiE; Rt4FF: } } goto L0170; if44M: } protected function prepareElemDataForGetProducts($arElem) : array { goto cFOj0; nzoHb: foreach ($props as $prop) { goto Hhhfd; Hf1uT: $processedFields[$prop["\x43\117\x44\x45"]] = ["\x49\x44" => $prop["\111\104"], "\103\x4f\104\x45" => $prop["\103\x4f\x44\x45"], "\x4e\101\x4d\x45" => $prop["\116\101\x4d\x45"], "\x50\x52\117\x50\105\x52\x54\x59\137\124\x59\120\105" => $prop["\120\122\117\120\105\122\x54\x59\x5f\124\131\x50\105"], "\x4c\111\x53\x54\x5f\124\131\120\x45" => $prop["\x4c\111\123\x54\137\124\x59\x50\x45"], "\x4d\x55\x4c\124\111\120\x4c\105" => $prop["\115\x55\x4c\124\x49\120\x4c\x45"], "\110\x49\x4e\x54" => $prop["\x48\111\116\x54"], "\126\101\114\x55\x45\x53" => $values]; goto QyIiB; Hhhfd: $values = []; goto pLQy6; pLQy6: if (is_array($prop["\126\x41\114\x55\x45"])) { foreach ($prop["\126\x41\114\125\105"] as $key => $propVal) { $values[] = ["\111\104" => $prop["\x56\x41\114\125\105\x5f\x45\x4e\125\115\137\111\x44"][$key] ?: null, "\x56\x41\114\125\105" => $propVal]; } } else { $values[] = ["\111\x44" => $prop["\x56\101\x4c\x55\x45\x5f\105\x4e\x55\x4d\x5f\111\x44"] ?: null, "\126\x41\x4c\125\x45" => $prop["\x56\x41\x4c\125\105"]]; } goto Hf1uT; QyIiB: } goto dsJnz; HGxy2: $props = $arElem->GetProperties(); goto ioSeR; cFOj0: $fields = $arElem->GetFields(); goto HGxy2; ioSeR: $processedFields = []; goto nzoHb; dsJnz: return ["\x49\104" => $fields["\x49\x44"], "\x46\111\x45\114\x44\x53" => $this->prepareFieldsForGetProducts($fields, $props), "\103\x4f\115\115\117\x4e\x5f\101\104\x44\x49\124\x49\117\x4e\x41\114\137\120\122\117\120\x45\122\124\111\105\x53" => $this->getCommonAdditionalProps($fields, $props), "\120\x52\117\x50\105\122\x54\111\105\x53" => $processedFields]; goto uO9fl; uO9fl: } protected function prepareFieldsForGetProducts(array $fields, array $props) : array { goto QP0Jw; FSkzr: if (is_numeric($this->settingsData["\120\122\x4f\120\x5f\x49\x44\137\116\x41\115\x45"])) { $result["\x50\x52\117\x50\137\x49\104\137\116\x41\x4d\x45"] = $this->findProperty($props, "\120\x52\x4f\120\137\111\104\137\116\x41\115\x45")["\x56\x41\x4c\125\105"]; } else { $result["\x50\x52\117\120\x5f\111\104\137\116\x41\x4d\x45"] = $fields[$this->relationFields["\120\x52\x4f\120\137\x49\104\137\x4e\x41\115\x45"]]; } goto LiC6m; d1Pp7: if (is_numeric($this->settingsData["\x50\122\x4f\120\137\x49\x44\137\127\x49\104\x54\x48"])) { $result["\120\x52\x4f\x50\137\x49\104\x5f\x57\111\x44\x54\x48"] = $this->findProperty($props, "\x50\x52\117\x50\137\x49\x44\x5f\127\x49\104\x54\x48")["\x56\101\114\x55\x45"]; } elseif (Loader::includeModule("\163\x61\x6c\145")) { $result["\120\122\x4f\120\x5f\111\x44\x5f\x57\111\x44\124\110"] = $fields[$this->relationFields["\x50\x52\x4f\120\137\111\x44\137\x57\111\104\x54\110"]]; } else { $result["\120\x52\117\x50\137\x49\104\137\127\x49\104\124\110"] = null; } goto l5wPa; PnUKQ: $result["\x50\x52\x4f\120\x5f\x56\101\x54"] = $this->settingsData["\x50\122\x4f\x50\137\126\x41\x54"]; goto W1BGe; byeZ3: if (is_numeric($this->settingsData["\120\122\117\x50\x5f\x49\x44\x5f\110\x45\111\107\110\x54"])) { $result["\x50\122\117\120\x5f\111\104\137\110\x45\x49\x47\110\124"] = $this->findProperty($props, "\120\122\x4f\120\137\x49\104\x5f\x48\x45\x49\x47\110\124")["\126\101\114\125\x45"]; } elseif (Loader::includeModule("\163\x61\154\x65")) { $result["\x50\x52\117\x50\x5f\x49\104\x5f\110\105\x49\107\110\124"] = $fields[$this->relationFields["\x50\x52\117\120\137\111\x44\x5f\x48\105\x49\107\x48\124"]]; } else { $result["\x50\122\x4f\x50\137\x49\x44\137\x48\105\111\x47\110\x54"] = 0; } goto LgAib; W1BGe: $result["\x50\x52\x4f\x50\137\x57\x45\111\x47\110\x54\x5f\125\x4e\111\124"] = $this->settingsData["\x50\122\117\x50\x5f\x57\105\x49\107\110\124\137\125\x4e\111\124"]; goto zPoeH; zPoeH: $result["\x50\x52\x4f\120\x5f\123\x45\x52\x56\x49\103\x45\x5f\124\x59\x50\x45"] = $this->settingsData["\120\122\x4f\x50\137\x53\105\122\126\x49\x43\105\x5f\x54\x59\x50\105"]; goto KcF8c; LgAib: if (is_numeric($this->settingsData["\x50\x52\117\x50\137\111\x44\x5f\114\x45\116\107\x54\110"])) { $result["\x50\x52\x4f\x50\x5f\x49\x44\137\114\105\116\x47\x54\110"] = $this->findProperty($props, "\120\122\x4f\x50\137\x49\x44\137\x4c\105\x4e\107\x54\110")["\x56\x41\x4c\x55\105"]; } elseif (Loader::includeModule("\163\141\154\145")) { $result["\x50\122\x4f\x50\x5f\111\104\x5f\x4c\x45\x4e\x47\124\x48"] = $fields[$this->relationFields["\x50\122\117\120\137\x49\x44\x5f\x4c\105\x4e\x47\124\110"]]; } else { $result["\120\x52\x4f\120\137\111\104\x5f\x4c\105\x4e\107\124\110"] = null; } goto d1Pp7; p27Gv: if (is_numeric($this->settingsData["\x50\x52\x4f\120\137\x49\104\137\120\122\105\x4d\x49\x55\115\x5f\120\x52\111\x43\105"])) { $result["\x50\122\117\120\x5f\111\104\137\120\x52\105\x4d\111\125\x4d\137\x50\122\111\x43\x45"] = $this->findProperty($props, "\x50\122\x4f\x50\x5f\x49\x44\137\x50\122\x45\x4d\x49\x55\x4d\137\120\122\111\x43\x45")["\x56\x41\114\125\105"]; } else { $result["\120\x52\117\x50\137\x49\x44\137\120\x52\105\x4d\111\x55\115\x5f\x50\122\111\x43\x45"] = null; } goto qBJUM; YUOo2: $result["\x57\x41\x52\105\x48\x4f\x55\123\x45\137\x49\x44"] = $this->settingsData["\127\101\122\x45\x48\x4f\x55\x53\105\x5f\111\104"] ?: null; goto FSkzr; aTQ9c: if (is_numeric($this->settingsData["\x50\122\x4f\120\137\x49\x44\137\111\115\101\107\x45\x53"])) { $prop = $this->findProperty($props, "\x50\122\x4f\120\137\111\x44\x5f\111\x4d\x41\x47\105\123"); if ($prop["\120\122\x4f\120\x45\122\x54\131\x5f\124\131\120\x45"] === "\x46") { foreach ($prop["\126\x41\x4c\x55\x45"] as $propVal) { $result["\x50\x52\117\120\137\111\x44\137\x49\x4d\x41\x47\x45\x53"][] = $this->getDomainName() . \CFile::GetPath($propVal); } } else { if ($prop["\115\x55\114\x54\x49\x50\114\x45"] === "\x59") { foreach ($prop["\x56\101\114\x55\105"] as $propVal) { $result["\x50\x52\117\x50\x5f\x49\x44\x5f\111\x4d\101\x47\x45\x53"][] = $this->getDomainName() . $propVal; } } elseif ($prop["\126\x41\114\125\x45"]) { $result["\x50\122\117\x50\x5f\x49\104\x5f\111\x4d\x41\x47\105\123"][] = $this->getDomainName() . $prop["\126\101\114\x55\105"]; } } } else { $prop = \CFile::GetPath($fields[$this->relationFields["\120\122\117\120\x5f\111\x44\x5f\x49\115\x41\107\105\123"]]); if ($prop) { $result["\120\x52\x4f\x50\137\x49\104\137\111\115\101\x47\x45\123"][] = $this->getDomainName() . $prop; } } goto byeZ3; l5wPa: if (is_numeric($this->settingsData["\120\x52\x4f\120\137\x49\x44\x5f\127\x45\x49\107\x48\124"])) { $result["\x50\122\117\x50\x5f\111\104\x5f\127\x45\x49\x47\x48\124"] = $this->findProperty($props, "\x50\122\117\120\x5f\111\x44\x5f\x57\x45\111\107\110\x54")["\x56\x41\114\x55\x45"]; } elseif (Loader::includeModule("\163\x61\x6c\145")) { $result["\x50\x52\x4f\120\x5f\x49\x44\x5f\127\x45\111\x47\x48\124"] = $fields[$this->relationFields["\120\x52\117\120\x5f\x49\x44\137\x57\105\x49\107\110\x54"]]; } else { $result["\120\x52\x4f\x50\137\111\104\x5f\127\105\111\107\x48\124"] = null; } goto dlso3; qrwpu: $result["\120\122\117\120\137\104\x49\x4d\x45\116\123\x49\x4f\116\137\x55\116\x49\x54"] = $this->settingsData["\x50\122\x4f\120\x5f\104\x49\115\x45\116\x53\x49\117\116\x5f\x55\x4e\x49\x54"]; goto PnUKQ; RzJL6: if (is_numeric($this->settingsData["\120\x52\x4f\120\x5f\x49\104\x5f\x44\105\x53\x43"])) { $result["\120\x52\117\x50\137\111\104\137\x44\105\123\103"] = $this->findProperty($props, "\x50\122\x4f\x50\x5f\x49\104\137\x44\x45\x53\x43")["\126\101\x4c\x55\105"]; } else { $result["\x50\x52\x4f\x50\137\x49\x44\x5f\104\x45\x53\x43"] = $fields[$this->relationFields["\120\122\117\x50\137\111\104\137\x44\x45\123\103"]]; } goto VYp3G; WeAYl: if (is_numeric($this->settingsData["\120\x52\x4f\x50\x5f\111\x44\137\x43\x4f\114\x4f\122\x5f\111\115\x41\x47\105"])) { $result["\120\122\x4f\120\x5f\x49\104\x5f\x43\117\x4c\117\122\137\111\115\101\107\105"] = $this->findProperty($props, "\120\122\117\120\x5f\x49\104\x5f\x43\117\x4c\x4f\122\x5f\111\x4d\101\107\x45")["\x56\101\x4c\x55\x45"]; } else { $result["\x50\x52\x4f\x50\x5f\111\x44\137\x43\117\114\117\x52\x5f\111\115\x41\107\105"] = $fields[$this->relationFields["\120\122\x4f\120\x5f\111\104\x5f\103\x4f\114\117\122\137\111\115\101\x47\105"]]; } goto aB0VY; qBJUM: if (is_numeric($this->settingsData["\x50\122\117\120\137\111\104\137\123\124\x4f\x43\x4b"])) { $result["\x50\122\117\x50\137\111\x44\137\123\124\x4f\x43\x4b"] = $this->findProperty($props, "\120\122\x4f\120\137\111\104\x5f\123\x54\x4f\103\113")["\126\x41\x4c\x55\105"]; } elseif ($this->settingsData["\x50\122\117\120\x5f\x49\104\x5f\x53\x54\117\x43\x4b"] === "\103\x41\x54\101\114\x4f\107\x5f\121\125\x41\116\124\x49\x54\x59") { $result["\x50\122\117\x50\137\111\104\x5f\123\x54\x4f\103\x4b"] = $fields[$this->relationFields["\120\x52\x4f\120\x5f\x49\x44\x5f\123\x54\x4f\x43\x4b"]]; } else { $result["\x50\122\x4f\120\x5f\x49\x44\137\123\124\117\103\x4b"] = 0; } goto iJwxw; qks9n: if (is_numeric($this->settingsData["\x50\122\x4f\120\x5f\x49\104\x5f\117\x4c\104\137\120\x52\111\103\105"])) { $result["\x50\x52\x4f\x50\137\x49\x44\137\x4f\x4c\104\x5f\x50\x52\x49\103\105"] = $this->findProperty($props, "\x50\x52\117\120\x5f\x49\x44\x5f\x4f\x4c\104\x5f\x50\122\111\103\x45")["\126\x41\114\x55\105"]; } else { $result["\120\122\117\120\137\x49\104\137\x4f\114\x44\x5f\120\x52\111\x43\105"] = null; } goto p27Gv; dlso3: if (is_numeric($this->settingsData["\120\x52\x4f\120\137\x49\x44\137\x42\101\x52\x43\x4f\104\x45"])) { $result["\120\x52\117\x50\137\x49\x44\137\x42\101\122\x43\x4f\104\105"] = $this->findProperty($props, "\120\122\117\120\x5f\111\104\137\102\x41\122\x43\x4f\104\105")["\126\101\114\125\x45"]; } else { $result["\x50\x52\x4f\x50\x5f\x49\x44\137\x42\x41\x52\x43\x4f\104\105"] = $fields[$this->relationFields["\x50\x52\117\x50\137\111\104\x5f\102\101\x52\x43\117\x44\x45"]]; } goto WeAYl; WlrQK: if (is_numeric($this->settingsData["\x50\x52\x4f\120\137\x49\104\137\x50\122\111\115\x41\x52\131\137\x49\115\x41\x47\x45"])) { $prop = $this->findProperty($props, "\120\x52\117\x50\x5f\x49\x44\x5f\120\122\111\115\101\122\x59\x5f\x49\115\x41\x47\x45"); $result["\x50\x52\117\x50\137\111\104\x5f\x50\x52\x49\x4d\x41\x52\131\137\x49\115\x41\x47\x45"] = $prop["\x56\101\x4c\125\105"] ? $this->getDomainName() . $prop["\x56\x41\x4c\x55\105"] : ''; } else { $prop = \CFile::GetPath($fields[$this->relationFields["\x50\x52\x4f\120\x5f\111\x44\x5f\x50\x52\x49\115\x41\122\x59\x5f\111\x4d\101\x47\x45"]]); $result["\120\x52\117\120\x5f\111\104\x5f\x50\122\111\115\101\122\131\x5f\x49\115\x41\107\105"] = $prop ? $this->getDomainName() . $prop : ''; } goto aTQ9c; QP0Jw: $result = []; goto YUOo2; aB0VY: if (is_numeric($this->settingsData["\120\x52\117\x50\137\111\104\x5f\x50\x52\x49\x43\105"])) { $result["\x50\x52\117\x50\137\111\104\x5f\120\x52\x49\x43\105"] = $this->findProperty($props, "\x50\122\x4f\120\x5f\111\x44\x5f\120\122\111\103\x45")["\126\101\114\x55\105"]; } else { $result["\x50\122\117\120\x5f\111\x44\137\x50\x52\111\x43\105"] = null; } goto qks9n; KcF8c: return $result; goto D7EPh; iJwxw: $result["\x50\122\117\x50\x5f\103\125\x52\x52\105\x4e\x43\x59"] = $this->settingsData["\x50\x52\117\x50\x5f\x43\x55\x52\122\105\116\103\131"]; goto qrwpu; LiC6m: if (is_numeric($this->settingsData["\x50\122\x4f\120\137\111\x44\137\117\x46\x46\x45\122\137\x49\x44"])) { $result["\120\x52\x4f\x50\x5f\x49\104\137\117\106\106\105\122\x5f\x49\104"] = $this->findProperty($props, "\x50\122\x4f\x50\137\x49\x44\x5f\117\x46\x46\105\122\137\111\104")["\126\x41\114\x55\105"]; } else { $result["\120\122\117\x50\x5f\111\104\137\117\106\106\105\x52\x5f\x49\x44"] = $fields[$this->relationFields["\120\x52\117\120\137\111\104\x5f\x4f\106\x46\105\122\137\111\x44"]]; } goto RzJL6; VYp3G: $result["\120\122\117\x50\137\x49\x44\137\104\x45\x53\103"] = trim(strip_tags($result["\x50\x52\x4f\x50\137\111\104\x5f\104\x45\x53\103"])); goto WlrQK; D7EPh: } protected function findProperty(array $props, string $propCode) : array { foreach ($props as $prop) { if ($prop["\x49\x44"] == $this->settingsData[$propCode]) { return $prop; } } return []; } public function getCommonAdditionalProps(array $fields = [], array $props = []) : array { goto oe7Uu; CMK3b: if (is_numeric($this->settingsData["\x50\x52\x4f\x50\137\x49\x44\137\x42\x52\101\116\104"])) { $result["\x50\x52\117\120\137\111\x44\x5f\102\122\101\116\x44"] = $this->findProperty($props, "\120\x52\117\x50\137\111\104\x5f\102\x52\101\116\x44")["\126\x41\114\125\105"]; } else { $result["\x50\x52\x4f\120\x5f\111\104\x5f\x42\x52\101\116\104"] = $fields[$this->relationFields["\120\122\117\x50\137\111\104\x5f\x42\x52\x41\x4e\104"]]; } goto vjEWa; oe7Uu: $result = []; goto E290z; E290z: if (empty($fields) && empty($props)) { return $result; } goto CMK3b; dMwNv: if (is_numeric($this->settingsData["\120\122\117\120\x5f\111\x44\137\x4d\117\x44\105\x4c\x5f\x4e\x41\x4d\105"])) { $result["\120\x52\117\120\137\111\x44\x5f\115\117\104\x45\x4c\x5f\116\x41\115\x45"] = $this->findProperty($props, "\x50\122\x4f\120\137\111\104\x5f\x4d\x4f\104\105\x4c\x5f\116\x41\x4d\x45")["\126\x41\x4c\x55\x45"]; } else { $result["\120\122\x4f\x50\x5f\x49\104\137\115\x4f\104\105\114\x5f\116\x41\x4d\105"] = $fields[$this->relationFields["\120\x52\117\x50\137\x49\104\x5f\x4d\117\x44\105\x4c\137\116\101\x4d\x45"]]; } goto RqmGw; vjEWa: if (is_numeric($this->settingsData["\120\122\x4f\x50\x5f\x49\x44\x5f\102\122\101\116\104\137\103\114\x4f\x54\x48\x45\123\137\x53\x48\117\105\123"])) { $result["\x50\x52\117\120\137\x49\x44\137\x42\122\x41\116\104\137\x43\114\x4f\x54\110\105\123\137\123\110\117\105\123"] = $this->findProperty($props, "\x50\122\117\x50\x5f\x49\104\137\x42\x52\x41\116\x44\x5f\103\114\x4f\124\110\x45\x53\x5f\x53\x48\x4f\105\123")["\126\101\114\x55\105"]; } else { $result["\120\x52\x4f\x50\137\111\x44\137\x42\x52\101\x4e\x44\137\103\x4c\117\x54\110\105\x53\x5f\123\110\x4f\105\123"] = $fields[$this->relationFields["\x50\122\117\120\137\x49\x44\x5f\102\x52\101\116\104\x5f\x43\114\117\x54\x48\105\123\x5f\x53\x48\117\x45\123"]]; } goto dMwNv; RqmGw: if (is_numeric($this->settingsData["\120\x52\x4f\x50\137\x49\104\137\101\116\116\117\124\x41\124\111\117\116"])) { $result["\x50\122\117\120\137\111\x44\137\x41\116\x4e\x4f\124\x41\124\111\x4f\x4e"] = $this->findProperty($props, "\x50\x52\117\x50\137\111\x44\x5f\101\x4e\116\x4f\x54\x41\x54\x49\x4f\x4e")["\x56\x41\114\x55\x45"]; } else { $result["\120\x52\x4f\120\x5f\x49\x44\x5f\x41\116\x4e\x4f\124\101\x54\x49\x4f\116"] = $fields[$this->relationFields["\120\x52\x4f\120\x5f\111\x44\x5f\x41\116\116\x4f\x54\x41\x54\111\x4f\116"]]; } goto U1L8g; qveUX: if (is_numeric($this->settingsData["\x50\x52\117\120\x5f\111\x44\137\122\x49\103\110\137\x4a\x53\117\116"])) { $result["\x50\x52\x4f\x50\x5f\111\104\137\x52\x49\103\110\137\112\x53\x4f\116"] = $this->findProperty($props, "\x50\122\117\x50\x5f\111\104\x5f\122\x49\103\110\x5f\112\x53\117\x4e")["\x56\x41\x4c\x55\105"]; } else { $result["\x50\122\117\x50\x5f\x49\104\137\122\x49\103\110\x5f\112\123\117\x4e"] = $fields[$this->relationFields["\120\x52\x4f\120\137\x49\x44\x5f\122\111\x43\110\137\x4a\x53\117\x4e"]]; } goto ltdXp; ltdXp: return $result; goto g7YZ7; U1L8g: if (is_numeric($this->settingsData["\x50\122\117\120\137\111\x44\137\105\121\125\111\x50\x4d\x45\x4e\x54"])) { $result["\120\x52\x4f\x50\x5f\x49\x44\x5f\x45\121\125\x49\x50\x4d\x45\x4e\124"] = $this->findProperty($props, "\120\122\x4f\120\137\111\104\x5f\x45\x51\x55\x49\120\115\x45\x4e\124")["\126\101\114\125\x45"]; } else { $result["\120\x52\x4f\x50\x5f\x49\104\137\105\121\125\111\x50\115\x45\x4e\x54"] = $fields[$this->relationFields["\x50\122\x4f\120\x5f\x49\x44\x5f\x45\121\125\111\120\x4d\x45\x4e\x54"]]; } goto qveUX; g7YZ7: } } goto ntEgu; CaBNI: function checkModuleMode() : void { switch (Loader::includeSharewareModule(GURYEV_OZON_MODULE_NAME)) { case Loader::MODULE_NOT_FOUND: echo "\x3c\163\x70\x61\156\x20\x73\x74\x79\154\145\75\x22\143\157\154\x6f\162\72\162\x65\x64\73\x22\x3e" . Loc::getMessage("\107\125\x52\x59\x45\126\137\117\132\117\x4e\56\111\x4e\x43\114\x55\104\x45\56\x4d\x4f\x44\125\x4c\105\x5f\116\x4f\x54\x5f\x46\x4f\x55\116\x44") . "\74\x2f\163\160\141\x6e\76"; die; case Loader::MODULE_DEMO: echo "\x3c\x73\160\141\x6e\40\163\x74\x79\154\x65\x3d\x22\143\x6f\154\157\162\x3a\x72\x65\144\73\42\76" . Loc::getMessage("\x47\125\x52\131\x45\126\137\117\132\117\116\56\111\116\103\114\125\104\105\x2e\x4d\x4f\x44\x55\114\105\137\x44\x45\x4d\x4f") . "\74\57\163\x70\141\156\x3e"; case Loader::MODULE_DEMO_EXPIRED: echo "\74\163\160\x61\x6e\40\x73\x74\171\154\x65\75\x22\x63\x6f\x6c\157\x72\72\x72\x65\144\73\42\76" . Loc::getMessage("\107\125\122\x59\x45\126\x5f\117\x5a\117\x4e\x2e\x49\x4e\x43\x4c\x55\104\x45\x2e\x4d\x4f\x44\125\114\105\x5f\x44\x45\x4d\x4f\137\105\x58\x50\111\122\105\104") . "\74\x2f\x73\160\141\x6e\x3e"; die; } } goto P298w; RWRw_: Loader::registerAutoLoadClasses("\147\x75\162\x79\145\x76\x2e\x6f\x7a\x6f\156", array("\x47\x75\x72\x79\145\166\x5c\x4f\x7a\x6f\x6e\134\115\x79\123\161\154\134\123\145\x74\164\x69\x6e\x67\163\124\x61\142\154\x65" => "\x63\154\x61\x73\163\145\x73\57\155\x79\x73\161\x6c\57\123\145\164\x74\151\156\x67\163\x54\141\x62\x6c\145\x2e\160\150\x70", "\x47\x75\x72\x79\145\x76\x5c\x4f\x7a\x6f\x6e\x5c\x4d\171\123\161\x6c\x5c\103\x61\164\x65\x67\157\162\151\145\163\x43\x6f\156\x6e\145\143\x74\151\x6f\x6e\163\x54\x61\x62\154\145" => "\x63\x6c\141\x73\163\145\163\57\x6d\171\163\161\154\x2f\x43\141\164\145\x67\x6f\x72\x69\145\x73\103\x6f\156\x6e\x65\143\164\x69\157\156\x73\x54\x61\x62\154\x65\56\160\150\160", "\107\x75\x72\x79\x65\x76\134\x4f\x7a\157\x6e\x5c\115\x79\x53\x71\154\x5c\x43\150\x61\162\141\x63\164\145\x72\x69\163\x74\x69\143\x73\x43\157\x6e\156\x65\x63\164\151\x6f\156\163\124\x61\142\x6c\145" => "\143\154\141\163\163\145\163\57\x6d\171\x73\161\x6c\57\103\150\x61\162\141\143\164\x65\162\x69\x73\164\151\143\163\x43\157\x6e\x6e\145\143\x74\x69\x6f\156\x73\x54\x61\x62\154\145\56\x70\x68\160", "\x47\x75\x72\171\x65\x76\134\x4f\172\157\156\134\x4d\171\123\161\154\134\126\x61\x6c\165\x65\x73\x43\157\x6e\x6e\x65\143\164\x69\157\156\163\x54\x61\x62\x6c\145" => "\143\154\x61\x73\163\x65\x73\x2f\x6d\171\x73\x71\154\x2f\126\141\154\x75\x65\163\103\x6f\x6e\156\x65\143\x74\151\157\156\163\x54\141\x62\x6c\x65\x2e\160\x68\x70", "\107\x75\x72\x79\145\166\134\117\172\x6f\x6e\134\115\171\123\161\x6c\134\x45\x78\x63\150\141\156\x67\145\114\x6f\x67\x54\141\x62\154\145" => "\143\154\x61\x73\163\145\163\57\x6d\171\x73\161\154\57\105\x78\143\x68\x61\156\x67\x65\114\157\147\124\141\x62\154\x65\56\160\150\x70", "\107\165\162\171\x65\166\x5c\117\x7a\x6f\156\x5c\115\x79\x53\161\x6c\134\x41\x67\145\x6e\164\163\x54\x61\x62\154\x65" => "\x63\x6c\x61\163\x73\x65\x73\57\155\x79\x73\161\x6c\x2f\x41\x67\145\156\164\163\x54\x61\x62\154\x65\56\160\150\160", "\x47\x75\x72\x79\x65\x76\x5c\x4f\x7a\x6f\x6e\134\115\x61\x72\x6b\145\164\160\154\141\x63\x65\134\x4d\141\162\x6b\145\x74\160\x6c\141\x63\145\111\x6e\x74\145\x72\146\141\143\145" => "\x6c\151\142\57\155\141\162\x6b\x65\x74\x70\154\141\x63\145\57\115\x61\162\x6b\145\164\x70\154\x61\x63\x65\111\x6e\x74\145\x72\x66\141\143\145\56\x70\150\160", "\x47\165\162\x79\x65\x76\134\x4f\x7a\157\156\134\x4d\141\x72\153\x65\x74\160\x6c\141\143\x65\134\115\141\x72\153\x65\x74\160\154\141\143\145\105\x78\x63\145\160\x74\x69\157\x6e" => "\154\151\x62\57\155\x61\x72\x6b\145\x74\160\154\141\143\145\57\115\141\x72\x6b\x65\164\160\x6c\141\143\145\105\170\143\x65\x70\164\x69\x6f\156\x2e\x70\150\x70", "\107\x75\162\x79\x65\x76\134\117\x7a\157\156\x5c\106\151\x6c\x74\x65\x72\134\x50\162\x6f\144\x75\x63\164\106\151\x6c\164\x65\162" => "\x6c\151\142\x2f\x66\151\154\164\145\162\57\x50\162\157\x64\x75\143\x74\x46\x69\x6c\164\145\x72\x2e\160\150\160", "\107\x75\x72\171\145\x76\x5c\x4f\x7a\x6f\x6e\134\x48\141\156\144\154\145\162\x5c\x49\142\x6c\157\143\153" => "\x6c\x69\142\57\x68\141\156\144\154\145\162\x2f\x69\x62\154\157\x63\x6b\x2e\160\150\x70", "\107\x75\x72\171\x65\166\x5c\117\x7a\157\x6e\134\110\141\x6e\x64\x6c\145\162\134\x41\x67\x65\x6e\x74" => "\154\151\x62\57\x61\x67\x65\x6e\x74\x2f\145\x78\x70\x6f\x72\164\x2e\x70\150\160", "\x47\x75\162\171\x65\x76\x5c\117\172\157\x6e\134\x48\145\154\160\x65\x72" => "\154\151\x62\57\110\145\154\160\145\x72\x2e\x70\x68\160")); goto etNfX; ntEgu: class OzonMarketplace implements MarketplaceInterface { private const TIMEOUT = 30; private const CACHE_PATH = "\x2f\147\x75\162\x79\x65\166\56\157\x7a\157\x6e"; public static function getExchangeTypeExportTexts() : array { return ["\x45\130\x43\110\x41\116\107\105\137\124\131\120\105\137\105\130\120\x4f\x52\124\137\120\x52\x4f\104\125\103\124\x53\137\124\x45\x58\x54" => Loc::getMessage("\107\125\122\131\105\x56\x5f\x4f\132\x4f\x4e\56\x49\x4e\x43\114\125\x44\x45\x2e\x45\x58\x43\x48\101\x4e\107\105\x5f\x54\x59\120\x45\137\x45\x58\120\x4f\x52\124\x5f\120\x52\117\x44\125\x43\124\x53\137\x54\x45\x58\x54"), "\105\130\x43\110\101\116\107\105\x5f\x54\x59\x50\105\x5f\x45\130\120\x4f\x52\x54\137\x50\122\111\x43\x45\x53\x5f\124\105\130\124" => Loc::getMessage("\107\125\122\131\105\x56\137\x4f\132\117\116\56\111\116\103\x4c\125\x44\x45\x2e\x45\x58\103\x48\x41\x4e\107\105\137\x54\131\x50\x45\x5f\x45\x58\x50\x4f\122\x54\137\120\122\111\x43\x45\123\137\124\x45\x58\124"), "\x45\130\x43\110\x41\x4e\107\105\137\x54\131\120\x45\137\105\130\120\117\122\124\x5f\123\x54\x4f\103\113\123\x5f\x54\x45\130\x54" => Loc::getMessage("\x47\x55\122\131\x45\126\137\117\x5a\117\116\x2e\111\x4e\x43\114\125\104\105\56\105\130\x43\110\101\116\x47\x45\x5f\x54\x59\120\105\x5f\x45\130\120\x4f\122\124\x5f\123\124\117\x43\113\123\137\124\105\x58\x54"), "\x45\x58\x43\x48\x41\x4e\107\x45\137\x54\131\x50\x45\x5f\x45\130\120\x4f\x52\x54\137\103\117\116\x53\124\x52\x55\x43\124\x5f\x54\x45\130\124" => Loc::getMessage("\x47\125\122\131\105\x56\x5f\117\132\117\116\56\111\x4e\103\114\125\104\x45\56\105\x58\103\x48\101\116\x47\105\137\x54\131\120\105\137\x45\x58\120\117\122\124\137\103\117\116\123\x54\x52\x55\103\124\137\x54\x45\x58\124")]; } public static function getWarehouseStatusesWithPersonalAreaTexts() : array { return ["\156\145\x77" => Loc::getMessage("\107\125\x52\x59\105\x56\137\x4f\x5a\117\116\56\x49\116\103\x4c\125\104\105\x2e\x57\x41\122\105\x48\117\x55\123\x45\x5f\x53\x54\101\x54\x55\x53\105\x53\x5f\127\x49\124\110\137\120\105\x52\x53\x4f\116\x41\114\x5f\101\x52\105\101\x2e\x4e\x45\127"), "\x63\x72\x65\141\164\145\x64" => Loc::getMessage("\x47\x55\x52\131\x45\126\x5f\x4f\132\x4f\116\56\x49\116\x43\114\125\x44\105\56\x57\x41\x52\x45\x48\117\125\123\x45\x5f\123\x54\101\x54\x55\123\x45\123\137\x57\111\x54\110\x5f\x50\x45\122\x53\x4f\116\101\114\137\x41\122\x45\x41\x2e\x43\x52\105\x41\124\105\x44"), "\x64\x69\x73\141\142\154\145\x64" => Loc::getMessage("\x47\x55\122\x59\x45\x56\x5f\x4f\132\x4f\x4e\56\111\x4e\103\x4c\x55\104\x45\x2e\x57\101\x52\105\110\x4f\x55\x53\105\x5f\x53\124\x41\x54\x55\x53\x45\x53\x5f\x57\x49\124\x48\x5f\120\x45\x52\x53\x4f\x4e\x41\114\137\x41\x52\x45\x41\x2e\104\111\x53\101\102\114\x45\x44"), "\142\154\x6f\143\153\x65\144" => Loc::getMessage("\107\x55\122\131\105\x56\x5f\x4f\132\117\x4e\56\x49\116\x43\x4c\x55\x44\105\x2e\x57\101\x52\x45\x48\x4f\x55\123\x45\137\123\124\x41\124\x55\123\x45\x53\137\127\111\x54\x48\x5f\x50\105\x52\123\117\116\x41\x4c\137\101\122\x45\x41\x2e\x42\x4c\117\103\x4b\105\x44"), "\x64\x69\x73\141\142\x6c\145\x64\x5f\144\x75\x65\137\x74\x6f\x5f\154\x69\x6d\x69\x74" => Loc::getMessage("\107\x55\x52\x59\x45\126\137\x4f\132\x4f\x4e\x2e\x49\x4e\x43\114\x55\x44\105\56\127\101\x52\105\110\x4f\125\x53\x45\x5f\x53\124\x41\124\x55\x53\105\123\x5f\x57\111\x54\x48\137\x50\105\x52\123\117\116\x41\114\137\101\x52\x45\x41\56\104\111\x53\x41\102\x4c\x45\104\137\104\x55\105\x5f\x54\117\137\x4c\111\115\x49\x54"), "\145\162\x72\x6f\162" => Loc::getMessage("\107\125\x52\x59\105\x56\x5f\117\x5a\117\x4e\x2e\x49\116\x43\x4c\x55\104\x45\56\127\101\122\x45\x48\x4f\125\123\x45\137\123\x54\x41\x54\x55\x53\105\123\137\127\x49\124\110\137\x50\x45\x52\123\117\x4e\x41\114\x5f\x41\122\x45\x41\56\105\122\122\117\x52")]; } private $apiUrl; private $cliendId; private $apiKey; public function __construct() { goto ZPIll; BSAma: $settingsData = SettingsTable::getList(["\163\145\x6c\x65\143\x74" => ["\103\x4c\x49\x45\116\124\137\111\104", "\101\120\x49\x5f\113\105\x59"], "\154\151\x6d\x69\x74" => 1])->fetch(); goto SRO5x; SRO5x: if (!$settingsData["\x43\x4c\x49\x45\x4e\124\x5f\111\x44"] || !$settingsData["\101\x50\111\137\x4b\105\131"]) { throw MarketplaceException::forConnectionDataIsNotValid(); } goto vOfYE; vOfYE: $this->apiUrl = MarketplaceInterface::OZON_API_URL; goto DJMdn; rp5U2: $this->apiKey = $settingsData["\x41\x50\x49\x5f\113\x45\x59"]; goto KqMCv; ZPIll: if (!Loader::includeSharewareModule("\x67\x75\162\171\145\x76\x2e\x6f\x7a\x6f\156")) { throw new \RuntimeException(Loc::getMessage("\107\x55\122\131\x45\x56\x5f\x4f\132\x4f\116\x2e\x49\116\103\x4c\125\104\105\56\115\117\x44\x55\x4c\x45\137\107\x55\x52\131\x45\x56\137\x4f\x5a\117\116\137\x4e\x4f\x54\137\x43\117\116\x4e\105\103\x54\105\x44")); } goto BSAma; DJMdn: $this->cliendId = $settingsData["\103\x4c\111\105\116\x54\x5f\111\104"]; goto rp5U2; KqMCv: } public function request(string $methodAPI, array $content = [], string $httpMethod = "\107\105\124") : array { goto LaNQc; YfpF9: $ch = curl_init(); goto Bf3Fg; z4mAP: $response = Json::decode($body); goto DDoDs; XrW62: curl_setopt($ch, CURLOPT_TIMEOUT, self::TIMEOUT); goto m5Ix3; m5Ix3: $body = curl_exec($ch); goto meNcc; dm08s: if ($httpMethod === "\x47\105\x54") { $url .= "\x3f" . http_build_query($content); } goto swPIi; GRvY9: curl_setopt($ch, CURLOPT_URL, $url); goto XrW62; Ai7Ql: curl_close($ch); goto z4mAP; u975i: if ($responseCode === 7 || $responseCode === 16) { throw MarketplaceException::forConnectionDataIsNotValid(); } goto RwIix; Bf3Fg: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); goto jMlEX; hBAKr: $error = curl_error($ch); goto Ai7Ql; jMlEX: foreach ($content as $key => $value) { if (empty($value) && $value !== false) { unset($content[$key]); } } goto dm08s; SLHsD: $url = $this->apiUrl . $methodAPI; goto Uq4tn; UUOwe: curl_setopt($ch, CURLOPT_HTTPHEADER, ["\x43\x6c\151\x65\x6e\x74\55\111\144\x3a\x20" . $this->cliendId, "\101\160\x69\55\x4b\145\x79\72\x20" . $this->apiKey, "\103\x6f\156\164\x65\x6e\x74\x2d\x54\x79\160\x65\72\x20\x61\160\160\x6c\x69\x63\x61\x74\151\157\x6e\57\152\x73\157\156"]); goto GRvY9; Uq4tn: $httpMethod = strtoupper($httpMethod); goto YfpF9; XEGKe: return is_array($response) ? $response : []; goto DTc5e; DDoDs: $responseCode = (int) $response["\143\157\144\145"]; goto u975i; RwIix: if ($responseCode) { throw new MarketplaceException($response["\155\145\x73\x73\x61\x67\x65"]); } goto XEGKe; meNcc: $errno = curl_errno($ch); goto hBAKr; swPIi: if ($httpMethod === "\x50\x4f\123\x54") { curl_setopt($ch, CURLOPT_POSTFIELDS, $content ? Json::encode($content) : ''); curl_setopt($ch, CURLOPT_POST, true); } goto UUOwe; LaNQc: checkModuleMode(); goto SLHsD; DTc5e: } public function checkConnect() : bool { $this->getWarehouses(); return true; } public function getWarehouses() : array { return $this->request("\57\166\61\57\x77\x61\162\x65\x68\157\x75\163\x65\x2f\154\151\x73\164", [], "\x50\117\123\x54"); } public function prepareProductsDataForAdd(int $marketCategoryId, array $products, array $additionalProps = [], array $additionalPropsValues = [], array $importedKeysProductArts = []) : array { goto Gke9H; Gke9H: $result = []; goto k8tHp; k8tHp: $limitImages = 15; goto X1r0A; gL3iu: return $result; goto xuh5h; X1r0A: foreach ($products as $product) { goto YSq5u; x6Zee: $data = ["\x61\x74\164\x72\151\x62\x75\164\145\163" => $this->getAttributes($product, $additionalProps, $additionalPropsValues), "\x62\x61\162\143\x6f\144\x65" => (string) $fields["\x50\x52\117\x50\x5f\111\x44\137\x42\101\122\x43\x4f\x44\105"] ?: '', "\x63\x61\x74\x65\147\x6f\x72\x79\137\x69\x64" => $marketCategoryId, "\x63\x6f\154\157\x72\137\151\155\x61\147\145" => (string) $fields["\x50\122\117\x50\x5f\111\104\x5f\103\117\114\x4f\x52\137\111\115\101\x47\x45"] ?: '', "\143\x75\x72\162\145\156\x63\171\x5f\x63\x6f\144\145" => $fields["\120\x52\x4f\120\137\x43\125\122\x52\105\x4e\103\131"], "\x64\x65\x70\164\150" => (int) $fields["\x50\122\x4f\120\137\x49\x44\137\114\x45\116\107\x54\x48"], "\144\151\x6d\x65\x6e\163\x69\157\156\137\x75\x6e\151\164" => $fields["\x50\122\x4f\120\137\104\111\115\x45\x4e\123\x49\117\x4e\137\x55\116\x49\124"], "\150\x65\151\147\x68\164" => (int) $fields["\x50\x52\117\120\137\x49\104\x5f\110\x45\x49\x47\x48\x54"], "\x69\155\141\147\145\x73" => $images, "\x70\162\151\155\141\162\x79\137\x69\x6d\x61\x67\145" => $mainImage, "\163\x65\162\166\151\143\x65\x5f\164\171\160\145" => (string) $fields["\x50\122\x4f\x50\x5f\123\x45\x52\126\x49\103\105\137\x54\131\x50\105"], "\x6e\x61\155\145" => (string) $fields["\x50\x52\117\x50\137\111\104\x5f\116\x41\x4d\105"], "\x6f\146\x66\x65\162\137\151\144" => (string) $fields["\x50\x52\117\x50\137\111\x44\x5f\x4f\106\x46\x45\122\137\x49\104"], "\x6f\154\x64\137\x70\x72\x69\x63\x65" => $fields["\x50\x52\x4f\x50\137\x49\x44\x5f\117\x4c\x44\x5f\120\x52\111\x43\105"] > 0 && $fields["\120\122\117\120\137\111\104\x5f\117\x4c\104\137\120\122\x49\103\x45"] > $fields["\120\122\x4f\x50\137\111\x44\137\120\x52\111\x43\x45"] ? (string) $fields["\x50\122\117\120\x5f\111\x44\x5f\117\x4c\104\x5f\120\x52\111\103\x45"] : "\60", "\160\x72\151\x63\145" => (string) $fields["\120\x52\117\x50\x5f\x49\x44\137\x50\x52\x49\x43\x45"], "\x76\141\x74" => (string) $fields["\120\x52\117\x50\x5f\x56\x41\x54"], "\167\x65\x69\x67\x68\164" => (int) $fields["\120\122\x4f\120\137\x49\x44\x5f\x57\105\x49\107\110\124"], "\167\x65\151\x67\150\164\x5f\165\x6e\151\x74" => (string) $fields["\120\122\117\120\137\127\x45\x49\107\110\x54\x5f\125\116\x49\x54"], "\x77\x69\144\164\150" => (int) $fields["\x50\x52\117\120\137\111\x44\x5f\127\111\104\124\x48"]]; goto bHx7f; YSq5u: $fields = $product["\106\x49\105\114\x44\x53"]; goto OJ7Vn; xb0eE: if (!empty($fields["\120\122\117\x50\137\111\104\137\x49\x4d\101\107\105\123"])) { foreach ($fields["\x50\122\117\120\x5f\111\104\x5f\111\115\x41\x47\x45\123"] as $key => $image) { if ($mainImage && $limitImages - 2 < $key || !$mainImage && $limitImages < $key) { break; } if ($image) { $images[] = $image; } } } goto x6Zee; mURbc: $result[] = $data; goto O44ol; bHx7f: foreach ($data as $key => $value) { if (is_null($value) && !in_array($key, ["\157\154\x64\137\160\x72\151\143\145", "\160\162\x65\155\x69\x75\x6d\x5f\160\162\x69\143\145", "\160\162\151\143\x65"])) { unset($data[$key]); } } goto mURbc; cxYre: $mainImage = $fields["\x50\x52\x4f\x50\x5f\x49\104\x5f\120\122\x49\x4d\x41\122\131\x5f\111\115\101\x47\x45"] ?: null; goto UZgxO; UZgxO: $images = []; goto xb0eE; OJ7Vn: if (!empty($importedKeysProductArts) && array_key_exists($fields["\120\122\x4f\120\137\x49\104\137\117\106\106\105\122\x5f\x49\x44"], $importedKeysProductArts)) { continue; } goto cxYre; O44ol: } goto gL3iu; xuh5h: } public function prepareProductsDataForUpdatePrices(array $products, array $importedKeysProductArts = []) : array { goto EBfoF; xM_o0: foreach ($products as $product) { goto BPZ1R; CPQeh: $result[] = $data; goto gDqTh; C4dup: $data = ["\x63\165\162\x72\x65\156\143\x79\137\x63\157\x64\x65" => (string) $fields["\x50\x52\x4f\x50\x5f\103\x55\x52\x52\105\116\x43\131"], "\x6d\x69\156\137\160\162\x69\143\x65" => (string) $fields["\120\122\x4f\x50\x5f\111\104\137\120\122\111\x43\105"], "\x6f\146\146\x65\x72\137\x69\144" => (string) $fields["\120\x52\x4f\x50\137\x49\104\137\x4f\106\106\105\122\137\111\x44"], "\157\154\144\x5f\x70\162\151\143\145" => $fields["\120\x52\x4f\x50\137\111\x44\137\x4f\x4c\x44\137\120\122\111\103\105"] > 0 && $fields["\x50\122\x4f\x50\x5f\x49\104\x5f\x4f\114\104\x5f\120\x52\x49\103\x45"] > $fields["\120\x52\x4f\120\x5f\x49\104\137\120\122\111\103\105"] ? (string) $fields["\120\x52\x4f\120\137\111\x44\137\x4f\114\104\137\120\x52\111\103\105"] : "\x30", "\x70\x72\x69\143\145" => (string) $fields["\120\122\117\x50\x5f\x49\104\137\x50\122\x49\x43\105"]]; goto CPQeh; KNl7F: if (!empty($importedKeysProductArts) && array_key_exists($fields["\x50\x52\117\120\137\x49\x44\137\117\106\x46\x45\122\x5f\111\x44"], $importedKeysProductArts)) { continue; } goto C4dup; BPZ1R: $fields = $product["\106\111\x45\114\104\x53"]; goto KNl7F; gDqTh: } goto XhzCu; EBfoF: $result = []; goto xM_o0; XhzCu: return $result; goto EiQZn; EiQZn: } public function prepareProductsDataForUpdateStocks(array $products, bool $useWarehouse = false, array $importedKeysProductArts = []) : array { goto Vh7J8; kK9oO: foreach ($products as $product) { goto d4fq1; d4fq1: $fields = $product["\x46\x49\x45\114\104\123"]; goto t0C3a; YlmhN: $result[] = $data; goto dWhuz; weVmB: if ($useWarehouse) { $data["\x77\x61\162\x65\x68\157\165\163\145\x5f\151\144"] = (int) $fields["\127\101\122\105\110\117\125\123\x45\x5f\111\104"]; } goto YlmhN; t0C3a: if (!empty($importedKeysProductArts) && array_key_exists($fields["\120\x52\117\x50\x5f\111\x44\137\x4f\106\x46\105\122\137\x49\x44"], $importedKeysProductArts)) { continue; } goto k9PcY; k9PcY: $data = ["\x6f\146\x66\x65\x72\x5f\151\x64" => (string) $fields["\120\x52\117\x50\x5f\x49\x44\x5f\x4f\106\x46\105\x52\137\111\104"], "\163\x74\x6f\143\153" => (int) $fields["\x50\x52\x4f\120\137\x49\104\x5f\x53\124\117\x43\113"] > 0 ? (int) $fields["\120\122\117\120\137\111\104\x5f\x53\x54\117\103\113"] : 0]; goto weVmB; dWhuz: } goto N09Qr; N09Qr: return $result; goto w79kg; Vh7J8: $result = []; goto kK9oO; w79kg: } public function addProducts(array $preparedProducts, bool $returnResponses = false) : array { goto uz8PQ; YQ1Gb: return $result; goto W0nRC; CXD4t: $productsChunks = array_chunk($preparedProducts, $maxCountInChunk, true); goto oTO3t; n2Ywn: $result["\164\141\163\x6b\111\x64\x73"] = $taskIds; goto rrgnP; rrgnP: if ($returnResponses) { $result["\162\x65\163\x70\x6f\x6e\163\145\x73"] = $returnResponsesArr; } goto YQ1Gb; Rp8_h: $returnResponsesArr = []; goto qr3Tf; oTO3t: $taskIds = []; goto Rp8_h; aYqPe: $maxCountInChunk = 100; goto CXD4t; uz8PQ: $result = []; goto aYqPe; qr3Tf: foreach ($productsChunks as $productsChunk) { goto AhbHG; SXc78: if (isset($productsImportRes["\x72\x65\x73\165\154\x74"]["\x74\x61\163\x6b\137\151\x64"])) { foreach ($productsChunk as $product) { $taskIds[$productsImportRes["\x72\x65\x73\165\x6c\164"]["\x74\141\163\153\137\x69\x64"]][] = (string) $product["\x6f\146\146\145\x72\x5f\151\144"]; } } goto AZOEM; W3ILv: if ($returnResponses) { $returnResponsesArr[] = $productsImportRes; } goto SXc78; hMawI: $productsImportRes = $this->productImport($productsChunk); goto W3ILv; AhbHG: $productsChunk = array_values($productsChunk); goto hMawI; AZOEM: } goto n2Ywn; W0nRC: } public function updateProductsPrices(array $preparedProducts, bool $returnResponses = false) : array { goto hIujm; POm4s: $result["\160\x72\x6f\144\x75\143\x74\x41\x72\x74\x73\x49\156\x66\x6f"] = $productArtsInfo; goto YAZSr; IpUTD: return $result; goto vakZ5; W_ivt: foreach ($productsChunks as $productsChunk) { goto fsOMt; VORfP: foreach ($pricesImportRes["\162\x65\163\165\154\x74"] as $productInfo) { if ($productInfo["\x75\x70\144\141\x74\145\144"]) { $productArtsInfo[$key]["\x75\160\144\141\x74\x65\x64"][] = (string) $productInfo["\x6f\146\x66\x65\162\137\x69\144"]; } else { $productArtsInfo[$key]["\x65\x72\x72\x6f\162\163"][(string) $productInfo["\157\x66\146\x65\162\x5f\x69\x64"]] = Json::encode([(string) $productInfo["\x6f\x66\146\145\162\137\151\x64"] => $productInfo["\145\162\x72\x6f\162\x73"]], JSON_THROW_ON_ERROR); } } goto uJB5U; x5ZKy: if ($returnResponses) { $returnResponsesArr[] = $pricesImportRes; } goto VORfP; uJB5U: $key++; goto f5s4w; fsOMt: $productsChunk = array_values($productsChunk); goto w1WnQ; w1WnQ: $pricesImportRes = $this->updateProductImportPrices($productsChunk); goto x5ZKy; f5s4w: } goto POm4s; MFIbs: $maxCountInChunk = 100; goto Ph6Li; YAZSr: if ($returnResponses) { $result["\162\145\x73\x70\x6f\x6e\x73\x65\x73"] = $returnResponsesArr; } goto IpUTD; GULP6: $returnResponsesArr = []; goto W_ivt; pCt4t: $key = 0; goto MFIbs; Ph6Li: $productsChunks = array_chunk($preparedProducts, $maxCountInChunk, true); goto wKFeu; wKFeu: $productArtsInfo = []; goto GULP6; hIujm: $result = []; goto pCt4t; vakZ5: } public function updateProductsStocks(array $preparedProducts, bool $useWarehouse = false, bool $returnResponses = false) : array { goto DEoak; lxxkR: $result["\x70\162\157\144\165\x63\x74\101\162\x74\x73\111\x6e\146\x6f"] = $productArtsInfo; goto exHH1; YlIAe: $maxCountInChunk = 100; goto g629r; qEy94: $key = 0; goto YlIAe; XaK_0: foreach ($productsChunks as $productsChunk) { goto ISjMg; omlmH: foreach ($stocksImportRes["\x72\x65\163\x75\154\164"] as $productInfo) { if ($productInfo["\x75\x70\x64\x61\164\145\x64"]) { $productArtsInfo[$key]["\165\160\x64\x61\164\145\x64"][] = (string) $productInfo["\157\x66\146\x65\162\x5f\151\144"]; } else { $productArtsInfo[$key]["\x65\x72\x72\157\x72\x73"][(string) $productInfo["\157\146\x66\145\162\137\x69\x64"]] = Json::encode([(string) $productInfo["\x6f\x66\146\145\x72\x5f\x69\144"] => $productInfo["\145\162\x72\x6f\x72\163"]], JSON_THROW_ON_ERROR); } } goto Gftdl; b3GBU: if ($returnResponses) { $returnResponsesArr[] = $stocksImportRes; } goto omlmH; Gftdl: $key++; goto ke72Q; wfxv3: if ($useWarehouse) { $stocksImportRes = $this->updateProductImportStocksOnWarehouse($productsChunk); } else { $stocksImportRes = $this->updateProductImportStocks($productsChunk); } goto b3GBU; ISjMg: $productsChunk = array_values($productsChunk); goto wfxv3; ke72Q: } goto lxxkR; CJmcn: $returnResponsesArr = []; goto XaK_0; DEoak: $result = []; goto qEy94; xIxr3: $productArtsInfo = []; goto CJmcn; g629r: $productsChunks = array_chunk($preparedProducts, $maxCountInChunk, true); goto xIxr3; eo5X8: return $result; goto c6Nfk; exHH1: if ($returnResponses) { $result["\162\145\x73\x70\157\156\x73\145\163"] = $returnResponsesArr; } goto eo5X8; c6Nfk: } public function updateProducts(array $preparedProducts) : array { return []; } public function getInfoByImportedProducts(string $taskId) : array { return $this->getProductImportInfo($taskId); } protected function productImport(array $data) : array { return $this->request("\57\166\x32\x2f\160\x72\157\x64\165\x63\x74\57\151\155\x70\157\x72\x74", ["\x69\x74\145\x6d\163" => $data], "\x50\117\123\124"); } public function getProductInfoLimit() : array { return $this->request("\57\166\63\57\160\162\157\144\165\143\164\57\151\156\146\157\x2f\154\x69\155\151\x74", [], "\x50\x4f\x53\x54")["\162\x65\163\165\x6c\x74"]; } protected function getCategoryTree(int $marketplaceCategoryId = null) : array { goto lKWK6; lKWK6: $data = []; goto T8tdI; T8tdI: if ($marketplaceCategoryId) { $data["\x63\x61\x74\145\147\157\162\x79\x5f\x69\x64"] = $marketplaceCategoryId; } goto jY8w0; jY8w0: return $this->request("\57\x76\x32\57\x63\x61\164\x65\x67\157\162\x79\x2f\x74\162\x65\x65", $data, "\x50\117\123\124"); goto K29ER; K29ER: } public function getCategoriesFinal(string $marketplaceCategoryId = null) : array { goto cYPSG; DFlMv: if ($cache->startDataCache()) { goto ylSnD; ANg4F: $result = []; goto vSNOl; ylSnD: try { $data = $this->getCategoryTree($marketplaceCategoryId)["\x72\x65\x73\x75\x6c\164"]; } catch (Exception $e) { $cache->abortDataCache(); return ["\145\162\x72\157\162" => $e->getMessage()]; } goto QvEYz; QvEYz: if ($marketplaceCategoryId) { $data = $data[0]["\143\150\x69\x6c\x64\162\x65\156"]; } goto JsWPr; AubO9: $cache->endDataCache($result); goto I05so; NN2uZ: $result = array_values($result); goto AubO9; JsWPr: $tree2arrayCategories = $this->tree2arrayCategories($data); goto ANg4F; vSNOl: foreach ($tree2arrayCategories as $category) { if (!$category["\150\x61\163\x43\x68\151\154\144\162\x65\156"]) { unset($category["\x68\x61\163\103\x68\x69\x6c\144\x72\x65\156"]); $result[] = $category; } } goto wA8vI; wA8vI: Helper::sortByField($result, "\x6e\x61\155\145"); goto NN2uZ; I05so: } goto FNuVK; Tz2bE: $cache = Cache::createInstance(); goto tni27; FNuVK: return $result; goto dM2hd; oWX0B: if ($cache->initCache(600, $cacheKey, self::CACHE_PATH . "\x2f\x67\145\x74\x43\141\x74\145\x67\x6f\162\151\x65\163\x46\x69\156\141\154\57")) { return $cache->getVars(); } goto DFlMv; tni27: $cacheKey = $marketplaceCategoryId ?: 0; goto oWX0B; cYPSG: $result = []; goto Tz2bE; dM2hd: } public function getCategoryProperties(array $marketplaceCategoryIds = []) : array { goto fgZ6a; MORiM: if ($cache->initCache(600, $cacheKey, self::CACHE_PATH . "\57\147\x65\x74\x43\x61\164\145\x67\157\162\x79\120\x72\x6f\160\145\162\x74\151\145\x73\57")) { return $cache->getVars(); } goto p08VK; vSKrJ: $cache = Cache::createInstance(); goto WaXhb; AEG8k: $maxCategoryIDs = 20; goto TxIQD; fgZ6a: $result = []; goto AEG8k; C2KgQ: if (count($marketplaceCategoryIds) > $maxCategoryIDs) { throw MarketplaceException::forMaxCount($maxCategoryIDs); } goto vSKrJ; RPRfQ: return $result; goto cTDiw; TxIQD: if (!$marketplaceCategoryIds) { throw MarketplaceException::forMarketplaceCategoryIdsIsRequired(); } goto C2KgQ; p08VK: if ($cache->startDataCache()) { goto MtLzG; MtLzG: try { $data = $this->request("\x2f\x76\x33\57\143\141\164\x65\x67\157\162\171\57\141\x74\164\x72\x69\142\x75\x74\145", array("\x63\141\164\145\x67\x6f\162\171\x5f\x69\x64" => $marketplaceCategoryIds), "\120\117\x53\124")["\162\145\163\165\154\164"]; } catch (Exception $e) { $cache->abortDataCache(); return ["\145\x72\x72\157\162" => $e->getMessage()]; } goto TXQW3; lO8xk: $cache->endDataCache($result); goto QB_16; TXQW3: foreach ($data as $categoryKey => $categoryValue) { $result[$categoryKey]["\151\x64"] = $categoryValue["\x63\141\164\x65\x67\x6f\162\171\137\x69\x64"]; foreach ($categoryValue["\x61\164\x74\x72\151\142\165\164\145\x73"] as $attribute) { $result[$categoryKey]["\x76\x61\x6c\165\x65\163"][] = $this->getPropertyData($attribute); } } goto lO8xk; QB_16: } goto RPRfQ; WaXhb: $cacheKey = serialize($marketplaceCategoryIds); goto MORiM; cTDiw: } protected function getPropertyData(array $outcomeData) : array { goto rBUlP; DK3Fm: if ($outcomeData["\x64\151\x63\164\151\157\156\x61\162\x79\137\151\x64"] > 0) { $categoryData["\144\x69\x63\x74\x69\x6f\x6e\x61\x72\x79\137\x69\x64"] = $outcomeData["\144\x69\143\164\x69\x6f\156\x61\162\x79\137\151\x64"]; } goto XSWTP; rBUlP: $type = null; goto DCAmy; XSWTP: return $categoryData; goto hOmKO; DCAmy: if ($outcomeData["\x64\x69\x63\164\x69\157\x6e\x61\x72\171\x5f\x69\x64"] > 0) { if ($outcomeData["\151\x73\137\x63\x6f\x6c\x6c\x65\143\x74\151\157\x6e"]) { $type = self::FIELD_MULTISELECT; } else { $type = self::FIELD_SELECT; } } goto C3RpU; C3RpU: $categoryData = array("\x69\144" => $outcomeData["\151\x64"], "\x6e\141\x6d\x65" => $outcomeData["\156\x61\155\x65"], "\x74\x79\x70\x65" => $type ?? $this->formattingFieldType($outcomeData["\x74\x79\x70\x65"]), "\x64\145\163\x63\162\151\x70\164\x69\157\156" => $outcomeData["\144\x65\x73\x63\162\151\x70\164\151\x6f\x6e"], "\151\163\137\162\x65\x71\x75\151\x72\x65\x64" => (int) $outcomeData["\x69\x73\x5f\x72\x65\161\x75\151\162\x65\x64"]); goto DK3Fm; hOmKO: } public function formattingFieldType(string $marketplaceFieldType) : string { goto N0LjR; x0372: return $result; goto J5_XZ; N0LjR: $result = null; goto Bqke0; pDWAD: switch ($marketplaceFieldType) { case "\x73\164\x72\x69\156\147" || "\x6d\x75\x6c\x74\151\154\151\156\145": $result = self::FIELD_STRING; break; case "\x75\x72\x6c": $result = self::FIELD_URL; break; case "\x64\x65\143\151\x6d\141\x6c": $result = self::FIELD_FLOAT; break; case "\x62\x6f\x6f\x6c\145\x61\x6e": $result = self::FIELD_BOOLEAN; break; case "\x69\x6e\x74\145\147\145\162": $result = self::FIELD_INTEGER; break; } goto bkniS; bkniS: if (!$result) { throw MarketplaceException::forInvalidVariableType(); } goto x0372; Bqke0: $marketplaceFieldType = mb_strtolower($marketplaceFieldType); goto pDWAD; J5_XZ: } public function getPropertyValues(string $marketplacePropertyId, array $options = []) : array { goto WbUxK; S4MJ7: if ($cache->initCache(600, $cacheKey, self::CACHE_PATH . "\x2f\147\x65\x74\120\162\x6f\160\x65\x72\x74\171\126\x61\154\x75\x65\163\57")) { return $cache->getVars(); } goto J5Biv; aWz8H: return $result; goto CcEyy; sGtTn: $cache = Cache::createInstance(); goto O7Lls; J5Biv: if ($cache->startDataCache()) { try { $result = $this->request("\x2f\x76\x32\x2f\143\x61\164\145\147\157\162\x79\57\x61\164\x74\162\151\x62\x75\164\145\57\x76\141\x6c\x75\145\163", $data, "\120\117\x53\x54"); } catch (Exception $e) { $cache->abortDataCache(); return ["\145\x72\162\157\162" => $e->getMessage()]; } $cache->endDataCache($result); } goto aWz8H; nZpmN: if ($options["\x63\141\x74\x65\x67\157\162\171\137\151\144"]) { $data["\143\x61\x74\x65\147\x6f\162\171\137\151\x64"] = $options["\x63\x61\164\145\147\157\x72\171\x5f\x69\144"]; } goto ZufKY; WbUxK: $result = []; goto EvMiX; O7Lls: $cacheKey = serialize($data); goto S4MJ7; ZufKY: if ($options["\x6c\141\163\164\137\166\141\154\165\x65\x5f\151\x64"]) { $data["\154\x61\x73\x74\137\x76\x61\154\x75\x65\x5f\151\144"] = $options["\x6c\x61\x73\x74\137\x76\x61\x6c\165\x65\137\x69\x64"]; } goto sGtTn; EvMiX: $data = ["\141\x74\x74\x72\x69\x62\165\x74\145\x5f\151\144" => (int) $marketplacePropertyId, "\x6c\x61\x6e\147\165\141\x67\145" => (string) $options["\154\x61\156\x67\x75\141\x67\x65"] ?: "\104\105\x46\101\125\114\x54", "\154\x69\x6d\151\x74" => (int) $options["\44\x6c\151\155\151\164"] ?: 5000]; goto nZpmN; CcEyy: } protected function getProductImportInfo(int $taskId) : array { return $this->request("\x2f\166\x31\x2f\160\162\x6f\144\x75\143\164\x2f\x69\155\x70\157\162\164\x2f\151\x6e\146\x6f", array("\x74\x61\163\x6b\x5f\x69\144" => $taskId), "\120\x4f\123\124"); } public function updateProductImportPrices(array $data) : array { return $this->request("\57\x76\61\57\x70\x72\157\x64\165\143\164\x2f\x69\155\160\157\x72\x74\57\x70\x72\151\x63\x65\163", array("\x70\x72\151\143\145\x73" => $data), "\120\117\x53\x54"); } public function updateProductImportStocks(array $data) : array { return $this->request("\x2f\x76\x31\x2f\160\162\x6f\144\x75\x63\164\57\151\155\160\157\162\164\x2f\163\164\157\143\x6b\163", array("\x73\x74\x6f\143\153\163" => $data), "\x50\117\x53\124"); } public function updateProductImportStocksOnWarehouse(array $data) : array { return $this->request("\57\x76\62\57\x70\162\157\x64\x75\x63\164\163\x2f\163\x74\x6f\143\x6b\x73", array("\x73\x74\157\x63\153\x73" => $data), "\120\117\x53\x54"); } protected function getAttributes($product, array $additionalProps, array $additionalPropsValues) : array { goto j4n6e; Ec3LL: $processedData = []; goto kKgCM; MsxN6: $commonAdditionalProps = $product["\x43\x4f\115\115\117\116\x5f\101\x44\104\x49\124\x49\117\116\101\x4c\137\120\122\x4f\x50\105\x52\124\111\x45\x53"]; goto vBfIY; AF6Vx: foreach ($processedData as $key => $value) { unset($processedData[$key]["\164\171\160\x65"]); } goto QpjIZ; j4n6e: $result = []; goto MsxN6; srhiN: $initialData = []; goto Ec3LL; YXbfR: if ($commonAdditionalProps["\120\x52\117\120\x5f\x49\x44\137\x45\121\125\x49\120\x4d\x45\x4e\124"]) { $result[] = ["\151\x64" => 4384, "\166\x61\x6c\165\x65\x73" => [["\x76\x61\x6c\x75\x65" => $commonAdditionalProps["\120\x52\117\120\x5f\111\104\x5f\105\121\125\111\120\x4d\x45\116\x54"]]]]; } goto klWKm; hLegq: $result[] = ["\151\144" => 31, "\x76\x61\154\x75\145\x73" => [["\166\141\x6c\165\145" => $commonAdditionalProps["\120\122\x4f\120\x5f\x49\104\137\x42\x52\101\116\x44\137\x43\x4c\117\x54\x48\105\123\x5f\x53\110\117\105\x53"] ?: Loc::getMessage("\x47\125\x52\x59\105\x56\x5f\x4f\x5a\x4f\x4e\x2e\111\x4e\103\x4c\x55\x44\x45\x2e\x4e\117\137\102\x52\x41\116\104")]]]; goto gLMve; klWKm: if ($commonAdditionalProps["\120\122\117\120\x5f\x49\x44\137\122\x49\103\110\x5f\112\x53\x4f\x4e"]) { $result[] = ["\151\x64" => 11254, "\166\141\154\x75\x65\x73" => [["\166\x61\154\x75\x65" => $commonAdditionalProps["\x50\122\x4f\120\137\111\x44\137\x52\111\103\x48\137\112\123\117\116"]]]]; } goto srhiN; vBfIY: $props = $product["\x50\x52\117\120\105\x52\x54\x49\x45\x53"]; goto zwPYa; kKgCM: foreach ($additionalProps as $value) { goto jT79d; jT79d: $currentProp = $props[$value["\123\111\x54\x45\137\x50\x52\117\x50\x45\x52\x54\x59\x5f\104\101\x54\101"]["\x43\117\104\x45"]]; goto a5z9m; EOwVH: if (!$values) { continue; } goto Du0Z5; Du0Z5: $initialData[] = ["\151\x64" => (int) $value["\115\101\122\x4b\x45\124\137\x50\122\117\120\105\122\124\x59\x5f\x44\101\x54\x41"]["\151\144"], "\164\171\160\145" => $value["\115\x41\122\113\105\124\x5f\x50\x52\117\120\x45\x52\x54\x59\x5f\104\x41\x54\x41"]["\x74\x79\x70\145"], "\x76\141\154\165\x65\163" => $this->getValuesForAttributes($values, $currentProp["\x50\x52\117\120\x45\x52\124\131\137\124\131\x50\x45"], $relationPropsValues, $value)]; goto xDQH1; U4ynD: $values = $currentProp["\x56\101\114\125\x45\x53"]; goto EOwVH; a5z9m: $relationPropsValues = $additionalPropsValues[$currentProp["\x49\x44"]] ?: []; goto U4ynD; xDQH1: } goto xwHJ3; xwHJ3: foreach ($initialData as $key => $value) { if (empty($value["\166\x61\154\x75\145\163"])) { unset($initialData[$key]); } } goto Nhoho; uanLz: if ($commonAdditionalProps["\120\x52\117\120\x5f\111\104\x5f\101\x4e\116\117\124\x41\124\111\117\x4e"]) { $result[] = ["\151\144" => 4191, "\166\x61\x6c\x75\145\x73" => [["\166\141\x6c\165\x65" => $commonAdditionalProps["\x50\x52\117\120\137\111\x44\x5f\101\116\116\x4f\x54\x41\124\x49\x4f\116"]]]]; } goto YXbfR; Nhoho: foreach ($initialData as $value) { if (!$processedData[$value["\151\x64"]]) { if ($value["\x74\171\160\145"] === "\x73\x74\162\151\x6e\x67" && $value["\166\x61\154\165\x65\x73"][1]) { goto uQ8fG; uQ8fG: $resValues = []; goto iXeDT; AkXAm: $value["\166\141\154\165\x65\163"][0]["\166\141\x6c\165\x65"] = implode("\x2c\x20", $resValues); goto mkZzW; iXeDT: foreach ($value["\x76\141\x6c\165\x65\163"] as $valVal) { $resValues[] = $valVal["\x76\x61\x6c\x75\x65"]; } goto o6U_i; o6U_i: $value["\166\x61\x6c\165\145\x73"] = []; goto AkXAm; mkZzW: } $processedData[$value["\x69\144"]] = $value; } elseif ($processedData[$value["\x69\144"]] && $value["\x76\x61\x6c\x75\145\163"] && $value["\x74\x79\x70\145"] === "\155\165\x6c\x74\x69\x73\145\x6c\x65\x63\x74") { goto Z9KPT; C1cZ4: foreach ($processedData[$value["\151\144"]]["\x76\141\x6c\x75\145\x73"] as $processedDataValue) { $dictionaryValueIds[] = (int) $processedDataValue["\x64\151\143\164\151\x6f\x6e\x61\x72\171\x5f\166\141\154\x75\145\x5f\151\x64"]; } goto xGUFR; xGUFR: foreach ($value["\x76\x61\154\x75\x65\x73"] as $valueInValues) { if (!in_array((int) $valueInValues["\144\151\143\164\x69\157\x6e\x61\162\171\137\x76\x61\x6c\x75\x65\137\151\144"], $dictionaryValueIds, true)) { $processedData[$value["\151\144"]]["\166\x61\154\x75\145\163"][] = $valueInValues; $dictionaryValueIds[] = (int) $valueInValues["\x64\151\x63\x74\151\157\156\141\162\171\137\x76\x61\154\165\x65\x5f\151\144"]; } } goto i55EY; Z9KPT: $dictionaryValueIds = []; goto C1cZ4; i55EY: } elseif ($processedData[$value["\x69\144"]] && empty($processedData[$value["\x69\x64"]]["\166\141\154\165\x65\163"]) && $value["\166\x61\x6c\165\145\x73"]) { $processedData[$value["\151\x64"]]["\166\141\154\165\145\163"] = $value["\166\x61\154\x75\145\x73"]; } } goto AF6Vx; zwPYa: $result[] = ["\x69\144" => 85, "\166\x61\154\165\x65\x73" => [["\x76\x61\154\165\x65" => $commonAdditionalProps["\x50\122\x4f\120\137\111\104\137\102\x52\101\x4e\104"] ?: Loc::getMessage("\107\125\x52\x59\x45\126\x5f\x4f\132\117\x4e\56\111\x4e\103\x4c\x55\x44\105\x2e\116\117\137\102\x52\101\116\104")]]]; goto hLegq; lmRLx: return array_merge($result, $processedData); goto TOQSH; QpjIZ: $processedData = array_values($processedData); goto lmRLx; gLMve: if ($commonAdditionalProps["\x50\122\117\x50\x5f\x49\x44\137\115\x4f\104\105\x4c\137\116\101\x4d\x45"]) { $result[] = ["\x69\x64" => 9048, "\x76\x61\154\x75\x65\x73" => [["\166\141\154\x75\x65" => $commonAdditionalProps["\x50\x52\117\x50\137\111\x44\x5f\x4d\x4f\104\x45\114\137\116\x41\x4d\x45"]]]]; } goto uanLz; TOQSH: } protected function getValuesForAttributes(array $propertyValues, string $currentPropType, array $relationPropsValues = [], array $additionalProp = []) : array { goto hff0H; hff0H: $result = []; goto o4XJC; o4XJC: foreach ($propertyValues as $propValue) { goto kxQxz; MVIDl: $resDictionaryValueId = null; goto V2Ckh; BsS5I: foreach ($relationPropsValues as $relationValue) { if ((int) $propValue["\x49\104"] === (int) $relationValue["\x53\111\x54\105\x5f\126\x41\x4c\x55\105\137\111\104"] && (int) $relationValue["\x4d\101\x52\113\105\x54\137\111\x44"] === (int) $additionalProp["\x4d\101\x52\x4b\x45\x54\137\120\122\117\120\x45\x52\x54\131\137\x44\x41\124\101"]["\x69\144"]) { goto ecM9o; x6EBE: $elemRes = ["\x76\x61\x6c\x75\145" => $resValue]; goto nOIRw; ecM9o: if ($relationValue["\115\101\122\113\105\124\137\126\x41\x4c\x55\x45\137\x4e\101\x4d\105"]) { $resValue = $relationValue["\115\101\x52\113\x45\124\x5f\x56\x41\114\x55\105\137\116\101\115\105"]; $resDictionaryValueId = $relationValue["\x4d\101\x52\x4b\105\124\x5f\126\x41\x4c\125\105\137\111\x44"]; } else { $resValue = $this->checkDimensionValue($propValue["\126\101\x4c\x55\105"], $additionalProp); } goto x6EBE; nOIRw: if ($resDictionaryValueId) { $elemRes["\144\151\x63\164\151\157\x6e\x61\162\171\x5f\166\141\x6c\165\x65\137\x69\x64"] = $resDictionaryValueId; $result["\x64\151\143\164\x69\157\x6e\141\x72\171\137" . $resDictionaryValueId] = $elemRes; } else { $result[] = $elemRes; } goto t1lsG; t1lsG: } } goto ZXiKG; C3x96: if ($currentPropType === "\x4c" && !$resValue && !$relationPropsValues && ($additionalProp["\115\101\122\x4b\105\x54\x5f\120\x52\x4f\x50\x45\122\x54\x59\x5f\x44\x41\x54\x41"]["\x74\171\x70\145"] !== "\x6d\165\x6c\x74\x69\x73\145\154\145\143\164" && $additionalProp["\x4d\101\x52\x4b\105\124\x5f\120\x52\117\120\105\122\124\x59\137\104\101\124\x41"]["\x74\x79\160\x65"] !== "\x73\145\x6c\x65\x63\164")) { $result[] = ["\166\141\x6c\x75\x65" => $this->checkDimensionValue($propValue["\126\x41\114\x55\105"], $additionalProp)]; } goto pRtPc; V2Ckh: if (!$propValue["\x49\104"] && !$propValue["\x56\101\114\x55\105"]) { continue; } goto BsS5I; kxQxz: $resValue = null; goto MVIDl; ZXiKG: if ($currentPropType !== "\x4c" && !$resValue) { foreach ($relationPropsValues as $relationValue) { $elemRes = ["\166\141\x6c\x75\145" => $relationValue["\115\x41\122\x4b\x45\x54\137\126\101\x4c\x55\105\x5f\116\101\x4d\x45"]]; if ($relationValue["\115\101\x52\113\105\124\137\x56\x41\x4c\x55\105\x5f\111\x44"]) { $elemRes["\x64\x69\x63\x74\x69\x6f\x6e\x61\x72\171\x5f\x76\141\x6c\165\x65\x5f\x69\x64"] = $relationValue["\115\x41\x52\113\x45\x54\137\x56\101\114\x55\105\x5f\111\x44"]; $result["\x64\151\143\x74\x69\x6f\156\141\x72\x79\x5f" . $relationValue["\x4d\101\x52\x4b\x45\124\137\126\101\114\125\x45\137\x49\104"]] = $elemRes; } else { $result[] = $elemRes; } } } goto C3x96; pRtPc: if (($currentPropType === "\116" || $currentPropType === "\123") && !$resValue && !$relationPropsValues) { $result[] = ["\166\x61\x6c\165\x65" => $this->checkDimensionValue($propValue["\x56\101\114\x55\x45"], $additionalProp)]; } goto yU3oD; yU3oD: } goto PDiW1; PDiW1: return array_values($result); goto P1inf; P1inf: } protected function tree2arrayCategories(array $data, array $parent = []) : array { goto Qx81Q; ozb1t: return $result; goto cB4vT; fXnjY: foreach ($data as $value) { goto D7jJl; LuOHt: if ($parent) { $data["\x70\x61\x72\x65\x6e\x74\x4e\x61\x6d\x65\x73"] = $parent["\160\x61\162\x65\156\x74\116\x61\x6d\x65\163"] ? array_merge($parent["\160\x61\162\145\156\164\116\141\x6d\x65\x73"], [$parent["\x6e\141\x6d\145"]]) : [$parent["\156\x61\x6d\x65"]]; } goto MDE86; WJfFR: if ($data["\150\141\x73\103\x68\x69\154\x64\x72\145\156"]) { $result = array_merge($result, $this->tree2arrayCategories($value["\143\x68\151\x6c\144\162\145\x6e"], $data)); } goto GzmOp; MDE86: $result[] = $data; goto WJfFR; D7jJl: $data = ["\151\x64" => $value["\x63\x61\164\x65\x67\x6f\162\x79\x5f\x69\144"], "\x6e\x61\155\x65" => $value["\x74\x69\x74\x6c\145"], "\150\x61\163\x43\150\151\x6c\144\162\145\156" => $value["\143\x68\151\x6c\144\162\x65\x6e"] ? 1 : 0, "\160\141\162\x65\x6e\164\x4e\141\155\145\x73" => []]; goto LuOHt; GzmOp: } goto ozb1t; Qx81Q: $result = []; goto fXnjY; cB4vT: } protected function checkDimensionValue($value, array $property) { if ($hint = mb_strtolower($property["\x53\x49\x54\x45\x5f\120\x52\117\x50\x45\122\x54\x59\137\104\x41\x54\x41"]["\110\x49\x4e\124"])) { goto ofdc5; b0gqY: if ($dimension["\x56\x41\114\125\105\x5f\x53\x49\124\x45"] && $dimension["\x56\x41\x4c\125\x45\137\x4d\101\x52\x4b\x45\x54"] && $dimension["\126\101\x4c\x55\105\x5f\x53\111\124\x45"] !== $dimension["\126\101\114\125\x45\137\x4d\101\122\113\105\124"]) { goto AQxZq; AQxZq: $valueSite = $dimensions[$dimension["\x54\131\x50\x45"]][$dimension["\126\x41\114\125\105\137\x53\111\124\105"]]; goto Ctl_T; a82Wh: $value = round($value, 2); goto e_Id8; e_Id8: $value = (string) $value; goto BZ11I; Ctl_T: $valueMarket = $dimensions[$dimension["\124\x59\120\x45"]][$dimension["\126\x41\x4c\125\x45\137\x4d\101\122\113\105\x54"]]; goto WFpMA; WFpMA: if ($valueSite > $valueMarket) { $value *= $valueSite / $valueMarket; } else { $value /= $valueMarket / $valueSite; } goto a82Wh; BZ11I: } goto i8l_L; ofdc5: $dimensions = ["\154\145\156\x67\164\x68" => ["\xd0\274\xd0\274" => 1, "\xd1\x81\320\xbc" => 10, "\xd0\xbc" => 1000], "\167\145\151\147\x68\164" => ["\320\xb3" => 1, "\320\272\xd0\263" => 1000, "\321\202" => 1000000], "\x76\x6f\154\x75\x6d\145\x5f\154\x69\161\x75\151\x64" => ["\320\xbc\320\273" => 1, "\320\xbb" => 1000], "\x63\x61\x70\x61\x63\151\x74\x79\137\154\x69\164\145\x72\137\x74\x69\x6d\145" => ["\320\xbb\x2f\321\x81" => 60, "\xd0\273\x2f\320\274\320\270\xd0\xbd" => 1]]; goto OXYtm; lE6Ni: foreach ($dimensions as $dimensionKey => $dimensionItem) { if (array_key_exists($hint, $dimensionItem)) { goto U_joY; MujV0: $dimension["\x56\x41\114\125\105\137\123\111\x54\x45"] = $hint; goto gcJdr; U_joY: $dimension["\124\x59\x50\105"] = $dimensionKey; goto MujV0; gcJdr: foreach ($dimensionItem as $valueKey => $valueItem) { if (mb_strpos($property["\x4d\x41\x52\x4b\105\124\137\120\x52\117\120\x45\122\124\x59\x5f\104\x41\124\101"]["\x6e\141\155\x65"], "\54\40" . $valueKey) !== false) { $dimension["\x56\101\x4c\125\105\137\115\101\122\113\105\124"] = $valueKey; break; } } goto wgFEL; wgFEL: break; goto SnYY_; SnYY_: } } goto b0gqY; OXYtm: $dimension = ["\124\x59\x50\105" => '', "\x56\x41\x4c\125\105\137\x53\111\x54\105" => '', "\x56\101\114\125\x45\x5f\115\101\x52\x4b\105\124" => '']; goto lE6Ni; i8l_L: } return $value; } }
?>
Function Calls
None |
Stats
MD5 | 0c3865442b741d51b004b89051ee3399 |
Eval Count | 0 |
Decode Time | 107 ms |