Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/wbs24.ozonapinew/lib/ |
Upload File : |
<?php namespace Wbs24\Ozonapinew; trait OrdersHelper { protected function checkIsOrderFromTraidingPlatform($orderId) { $filter = [ '%=XML_ID' => self::XML_ID_PREFIX.'%', 'ID' => $orderId, ]; $orders = $this->wrappers->Order->getList([ 'select' => ['ID', 'STATUS_ID'], 'filter' => $filter, 'order' => ['ID' => 'ASC'], ]); if ($orderResult = $orders->fetch()) { return $orderResult['ID']; } return false; } protected function getExternalId($orderId) { $order = $this->wrappers->Order->load($orderId); if ($order) { $xmlId = $order->getField("XML_ID"); $accountIndex = $this->getAccountIndexByXmlId($xmlId); $this->accountIndex = $accountIndex; $this->setSettingsForCurrentAccount($accountIndex); $postingNumber = str_replace(self::XML_ID_PREFIX . ($accountIndex > 1 ? $accountIndex : '') . '_', '', $xmlId); return $postingNumber; } } protected function setSettingsForCurrentAccount($accountIndex) { $this->setAccount($accountIndex); $this->orderNumberTemplate = $this->wrappers->Option->get($this->moduleId, 'orderNumberTemplate'); } protected function getAccountIndexByXmlId($xmlId) { preg_match('/'.self::XML_ID_PREFIX.'(\d*)_(.+)/', $xmlId, $matches); $accountIndex = $matches[1] ?: 1; return $accountIndex; } }