Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
senderconnector.php
1
<?php
9
namespace
Bitrix\Sale
;
10
11
use
Bitrix\Main\Localization\Loc
;
12
use
Bitrix\Main\Loader
;
13
14
if
(!Loader::includeModule(
'sender'
))
15
{
16
return
;
17
}
18
19
Loc::loadMessages
(__FILE__);
20
21
class
SenderEventHandler
22
{
29
public
static
function
onConnectorListBuyer
($data)
30
{
31
$data[
'CONNECTOR'
] =
'Bitrix\Sale\SenderConnectorBuyer'
;
32
33
return
$data;
34
}
35
}
36
37
38
class
SenderConnectorBuyer
extends
\Bitrix\Sender\Connector
39
{
45
public
function
getName
()
46
{
47
return
Loc::getMessage
(
'sender_connector_buyer_name'
);
48
}
49
55
public
function
getCode
()
56
{
57
return
"buyer"
;
58
}
59
65
public
function
getData
()
66
{
67
$lid = $this->getFieldValue(
'LID'
,
null
);
68
$orderCountFrom = $this->getFieldValue(
'ORDER_COUNT_FROM'
,
null
);
69
$orderCountTo = $this->getFieldValue(
'ORDER_COUNT_TO'
,
null
);
70
$orderSumFrom = $this->getFieldValue(
'ORDER_SUM_FROM'
,
null
);
71
$orderSumTo = $this->getFieldValue(
'ORDER_SUM_TO'
,
null
);
72
$orderLastDateFrom = $this->getFieldValue(
'LAST_ORDER_DATE_FROM'
,
null
);
73
$orderLastDateTo = $this->getFieldValue(
'LAST_ORDER_DATE_TO'
,
null
);
74
75
$filter = array();
76
if
($lid)
77
$filter[
'LID'
] = $lid;
78
if
($orderCountFrom)
79
$filter[
'>=COUNT_FULL_PAID_ORDER'
] = $orderCountFrom;
80
if
($orderCountTo)
81
$filter[
'<COUNT_FULL_PAID_ORDER'
] = $orderCountTo;
82
if
($orderSumFrom)
83
$filter[
'>=SUM_PAID'
] = $orderSumFrom;
84
if
($orderSumTo)
85
$filter[
'<SUM_PAID'
] = $orderSumTo;
86
if
($orderLastDateFrom)
87
$filter[
'>=LAST_ORDER_DATE'
] = $orderLastDateFrom;
88
if
($orderLastDateTo)
89
$filter[
'<LAST_ORDER_DATE'
] = $orderLastDateTo;
90
91
return
BuyerStatistic::getList
(array(
92
'select'
=> array(
"EMAIL"
=>
'USER.EMAIL'
,
"NAME"
=>
'USER.NAME'
,
"USER_ID"
,
"ID"
),
93
'filter'
=> $filter,
94
'order'
=> array(
'ID'
=>
'ASC'
),
95
));
96
}
97
103
public
function
getForm
()
104
{
105
$siteInput =
'<select name="'
.$this->getFieldName(
'LID'
).
'">'
;
106
$siteDb = \CSite::GetList(
"sort"
,
"asc"
, array(
"ACTIVE"
=>
"Y"
));
107
while
($site = $siteDb->Fetch())
108
{
109
$inputSelected = ($site[
'LID'
] == $this->getFieldValue(
'LID'
) ?
'selected'
:
''
);
110
$siteInput .=
'<option value="'
.$site[
'LID'
].
'" '
.$inputSelected.
'>'
;
111
$siteInput .= htmlspecialcharsbx($site[
'NAME'
]);
112
$siteInput .=
'</option>'
;
113
}
114
$siteInput .=
'</select>'
;
115
116
117
$orderCountInput =
Loc::getMessage
(
'sender_connector_buyer_from'
);
118
$orderCountInput .=
' <input size=3 type="text" name="'
.$this->getFieldName(
'ORDER_COUNT_FROM'
).
'" value="'
.htmlspecialcharsbx($this->getFieldValue(
'ORDER_COUNT_FROM'
)).
'"> '
;
119
$orderCountInput .=
Loc::getMessage
(
'sender_connector_buyer_to'
);
120
$orderCountInput .=
' <input size=3 type="text" name="'
.$this->getFieldName(
'ORDER_COUNT_TO'
).
'" value="'
.htmlspecialcharsbx($this->getFieldValue(
'ORDER_COUNT_TO'
)).
'">'
;
121
122
$orderSumInput =
Loc::getMessage
(
'sender_connector_buyer_from'
);
123
$orderSumInput .=
' <input size=3 type="text" name="'
.$this->getFieldName(
'ORDER_SUM_FROM'
).
'" value="'
.htmlspecialcharsbx($this->getFieldValue(
'ORDER_SUM_FROM'
)).
'"> '
;
124
$orderSumInput .=
Loc::getMessage
(
'sender_connector_buyer_to'
);
125
$orderSumInput .=
' <input size=3 type="text" name="'
.$this->getFieldName(
'ORDER_SUM_TO'
).
'" value="'
.htmlspecialcharsbx($this->getFieldValue(
'ORDER_SUM_TO'
)).
'">'
;
126
127
$lastOrderDateInput = CalendarPeriod(
128
$this->getFieldName(
'LAST_ORDER_DATE_FROM'
),
129
$this->getFieldValue(
'LAST_ORDER_DATE_FROM'
),
130
$this->getFieldName(
'LAST_ORDER_DATE_TO'
),
131
$this->getFieldValue(
'LAST_ORDER_DATE_TO'
),
132
$this->getFieldFormName()
133
);
134
135
return
'
136
<table>
137
<tr>
138
<td>'
.Loc::getMessage(
'sender_connector_buyer_site'
).
'</td>
139
<td>'
.$siteInput.
'</td>
140
</tr>
141
<tr>
142
<td>'
.
Loc::getMessage
(
'sender_connector_buyer_ordercnt'
).
'</td>
143
<td>'
.$orderCountInput.
'</td>
144
</tr>
145
<tr>
146
<td>'
.
Loc::getMessage
(
'sender_connector_buyer_ordersum'
).
'</td>
147
<td>'
.$orderSumInput.
'</td>
148
</tr>
149
<tr>
150
<td>'
.
Loc::getMessage
(
'sender_connector_buyer_lastorderdate'
).
'</td>
151
<td>'
.$lastOrderDateInput.
'</td>
152
</tr>
153
</table>
154
'
;
155
}
156
}
Bitrix\Iblock\SenderEventHandler
Definition
senderconnector.php:17
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Sale\BuyerStatistic\getList
static getList($filter)
Definition
buyerstatistic.php:26
Bitrix\Sale\SenderConnectorBuyer
Definition
senderconnector.php:39
Bitrix\Sale\SenderConnectorBuyer\getName
getName()
Definition
senderconnector.php:45
Bitrix\Sale\SenderConnectorBuyer\getForm
getForm()
Definition
senderconnector.php:103
Bitrix\Sale\SenderConnectorBuyer\getData
getData()
Definition
senderconnector.php:65
Bitrix\Sale\SenderConnectorBuyer\getCode
getCode()
Definition
senderconnector.php:55
Bitrix\Sale\SenderEventHandler\onConnectorListBuyer
static onConnectorListBuyer($data)
Definition
senderconnector.php:29
Bitrix\Sale
modules
sale
lib
senderconnector.php
Создано системой
1.10.0