1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
order.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources;
4
5
use Bitrix\Main\ArgumentNullException;
6
use \Bitrix\Sale\TradingPlatform\Logger;
7
use \Bitrix\Sale\TradingPlatform\Ebay\Ebay;
8
9
class
Order
extends
DataSource
implements \Iterator
10
{
11
protected
$remotePath
;
12
protected
$siteId
;
13
protected
$dataFiles
=
array
();
14
protected
$currentFileIdx
= 0;
15
protected
$startFileIdx
= 0;
16
protected
$orderLatest
=
""
;
17
18
public
function
__construct
(
$params
)
19
{
20
if
(!isset(
$params
[
"FEED_TYPE"
]) ||
$params
[
"FEED_TYPE"
] ==
''
)
21
throw
new
ArgumentNullException
(
"FEED_TYPE"
);
22
23
$this->remotePath =
"/store/"
.$params[
"FEED_TYPE"
].
"/output/"
.date(
'M-d-Y'
, time());
24
$this->orderLatest =
"/store/"
.$params[
"FEED_TYPE"
].
"/output/order-latest"
;
25
26
if
(!isset(
$params
[
"SITE_ID"
]) ||
$params
[
"SITE_ID"
] ==
''
)
27
throw
new
ArgumentNullException
(
"SITE_ID"
);
28
29
$this->siteId =
$params
[
"SITE_ID"
];
30
$this->dataFiles = $this->
receiveFiles
();
31
}
32
33
public
function
setStartPosition
($startPos =
""
)
34
{
35
if
($startPos <>
''
)
36
$this->startFileIdx = $startPos;
37
}
38
39
public
function
current
()
40
{
41
$content
= file_get_contents($this->dataFiles[$this->currentFileIdx]);
42
$skipLength = mb_strtolower(
SITE_CHARSET
) !=
'utf-8'
? 3 : 1;
43
$content
= mb_substr(
$content
, $skipLength);
44
$content
=
"<?xml version='1.0' encoding='UTF-8'?>"
.$content;
45
return
$content
;
46
}
47
48
public
function
key
()
49
{
50
return
$this->currentFileIdx
;
51
}
52
53
public
function
next
()
54
{
55
$this->currentFileIdx++;
56
}
57
58
public
function
rewind
()
59
{
60
$this->currentFileIdx =
$this->startFileIdx
;
61
}
62
63
public
function
valid
()
64
{
65
return
isset($this->dataFiles[$this->currentFileIdx])
66
&& $this->dataFiles[
$this->currentFileIdx
]
67
&&
\Bitrix\Main\IO\File::isFileExists
($this->dataFiles[$this->currentFileIdx]);
68
}
69
70
protected
function
receiveFiles
()
71
{
72
$result
=
array
();
73
$timeToKeepFiles = 24;
74
$tmpDir = \CTempFile::GetDirectoryName($timeToKeepFiles);
75
CheckDirPath
($tmpDir);
76
77
$sftp = \Bitrix\Sale\TradingPlatform\Ebay\Helper::getSftp($this->siteId);
78
79
if
(!$sftp)
80
return
array
();
81
82
$sftp->connect();
83
84
/*
85
$orderFiles = $sftp->getFilesList($this->remotePath);
86
87
foreach($orderFiles as $file)
88
{
89
if($sftp->downloadFile($this->remotePath."/".$file, $tmpDir.$file))
90
{
91
$result[] = $tmpDir.$file;
92
Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_SOURCE_ORDERFILE_RECEIVED", $file, "File received successfully.", $this->siteId);
93
}
94
}
95
*/
96
97
$file =
"orderLatest"
;
98
99
if
($sftp->downloadFile($this->orderLatest, $tmpDir.$file))
100
{
101
$result
[] = $tmpDir.$file;
102
Ebay::log
(
Logger::LOG_LEVEL_INFO
,
"EBAY_DATA_SOURCE_ORDERFILE_RECEIVED"
, $file,
"File received successfully."
, $this->siteId);
103
}
104
105
return
$result
;
106
}
107
}
Bitrix\Main\ArgumentNullException
Определения
ArgumentNullException.php:9
Bitrix\Main\IO\File\isFileExists
static isFileExists($path)
Определения
file.php:249
Bitrix\Sale\TradingPlatform\Ebay\Ebay\log
static log($level, $type, $itemId, $description, $siteId)
Определения
ebay.php:161
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\DataSource
Определения
datasource.php:6
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order
Определения
order.php:10
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\$dataFiles
$dataFiles
Определения
order.php:13
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\$orderLatest
$orderLatest
Определения
order.php:16
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\$remotePath
$remotePath
Определения
order.php:11
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\setStartPosition
setStartPosition($startPos="")
Определения
order.php:33
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\key
key()
Определения
order.php:48
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\__construct
__construct($params)
Определения
order.php:18
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\receiveFiles
receiveFiles()
Определения
order.php:70
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\$currentFileIdx
$currentFileIdx
Определения
order.php:14
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\$siteId
$siteId
Определения
order.php:12
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\valid
valid()
Определения
order.php:63
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\$startFileIdx
$startFileIdx
Определения
order.php:15
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\next
next()
Определения
order.php:53
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\rewind
rewind()
Определения
order.php:58
Bitrix\Sale\TradingPlatform\Ebay\Feed\Data\Sources\Order\current
current()
Определения
order.php:39
Bitrix\Sale\TradingPlatform\Logger\LOG_LEVEL_INFO
const LOG_LEVEL_INFO
Определения
logger.php:16
$content
$content
Определения
commerceml.php:144
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
SITE_CHARSET
const SITE_CHARSET
Определения
include.php:62
CheckDirPath
CheckDirPath($path)
Определения
tools.php:2707
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
bitrix
modules
sale
lib
tradingplatform
ebay
feed
data
sources
order.php
Создано системой
1.14.0