Version Description
- 2019-07-03 =
- New format - HTML
- Added order field "Link to edit order" (useful for HTML format)
- Added product field "Embedded Product Image" (works for XLS and PDF formats only!)
- Added order fields (for customer) - "First Order Date", "Last Order Date"
- Added 'Hide unused' for order/product/coupon fields (dropdowns filtered by matching orders)
- Allow to sort orders by any custom field
- Fixed bug - fields with prefix "USER_" were shown for all tabs in section "Setup fields"
- Fixed bug - the plugin exported all orders by default (including cancelled and refunded)
- Fixed bug - bulk export didn't sort orders
- Fixed bug - incompatibility with some coupon plugins
- Fixed bug - tab "Tools" didn't show error if JSON is not valid
- Removed a lot of outdated code
Download this release
Release Info
Developer | algol.plus |
Plugin | Advanced Order Export For WooCommerce |
Version | 3.0.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.1 to 3.0.0
- assets/css/export.css +198 -374
- assets/img/1 +0 -0
- assets/js/buttons.js +371 -0
- assets/js/export-fields.js +1368 -0
- assets/js/export.js +0 -1579
- assets/js/filters.js +882 -0
- assets/js/select2-i18n.js +96 -0
- assets/js/settings-form.js +157 -1650
- classes/FPDF/{fpdf.php → class-woe-fpdf.php} +8 -3
- classes/FPDF/class-woe-pdf-mc-table.php +26 -8
- classes/PHPExcel/Shared/OLE.php +1 -1
- classes/admin/class-wc-order-export-ajax.php +0 -422
- classes/admin/class-wc-order-export-manage.php +51 -170
- classes/admin/class-wc-order-export-settings.php +30 -0
- classes/admin/tabs/ajax/class-wc-order-export-ajax.php +43 -0
- classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php +134 -0
- classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-filters.php +116 -0
- classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax.php +32 -0
- classes/admin/tabs/ajax/trait-wc-order-export-ajax-helpers.php +146 -0
- classes/admin/tabs/class-wc-order-export-admin-tab-abstract.php +43 -0
- classes/admin/tabs/class-wc-order-export-admin-tab-export-now.php +17 -0
- classes/admin/tabs/class-wc-order-export-admin-tab-help.php +17 -0
- classes/admin/tabs/class-wc-order-export-admin-tab-profiles.php +17 -0
- classes/admin/tabs/class-wc-order-export-admin-tab-schedule-jobs.php +17 -0
- classes/admin/tabs/class-wc-order-export-admin-tab-status-change-jobs.php +17 -0
- classes/admin/tabs/class-wc-order-export-admin-tab-tools.php +25 -0
- classes/class-wc-order-export-admin.php +149 -667
- classes/core/class-wc-order-export-data-extractor-ui.php +82 -65
- classes/core/class-wc-order-export-data-extractor.php +225 -65
- classes/core/class-wc-order-export-engine.php +37 -216
- classes/formats/abstract-class-woe-formatter-plain-format.php +65 -9
- classes/formats/abstract-class-woe-formatter-sv.php +5 -6
- classes/formats/class-woe-formatter-csv.php +1 -1
- classes/formats/class-woe-formatter-html.php +288 -0
- classes/formats/class-woe-formatter-json.php +5 -3
- classes/formats/class-woe-formatter-pdf.php +96 -3
- classes/formats/class-woe-formatter-xls.php +121 -19
- classes/formats/class-woe-formatter-xml.php +8 -5
- classes/formats/trait-woe-plain-format.php +10 -8
- i18n/languages/woo-order-export-lite.pot +536 -440
- readme.txt +30 -13
- view/main.php +11 -9
- view/settings-form.php +385 -180
- view/tab/export.php +5 -8
- view/tab/order-actions.php +3 -3
- view/tab/profiles.php +3 -3
- view/tab/schedules.php +3 -3
- view/tab/tools.php +34 -12
- woo-order-export-lite.php +43 -29
assets/css/export.css
CHANGED
@@ -8,92 +8,7 @@
|
|
8 |
padding-top: 0px;
|
9 |
|
10 |
}
|
11 |
-
.fields_control_style input,select{
|
12 |
-
margin: 3px;
|
13 |
-
width: 80%;
|
14 |
-
}
|
15 |
-
|
16 |
-
.tablenav.top {
|
17 |
-
margin-bottom: 10px;
|
18 |
-
}
|
19 |
-
|
20 |
-
.tablenav.top select {
|
21 |
-
margin: 0 6px 0 0;
|
22 |
-
width: 100%;
|
23 |
-
height: 32px;
|
24 |
-
}
|
25 |
-
|
26 |
-
.tablenav.top #doaction {
|
27 |
-
margin: 0 6px 0 0;
|
28 |
-
height: 32px;
|
29 |
-
}
|
30 |
-
|
31 |
-
.fields_control_style {
|
32 |
-
padding: 10px;
|
33 |
-
border-color: rgb(187, 180, 180);
|
34 |
-
border-style: solid;
|
35 |
-
border-width: 1px;
|
36 |
-
display: inline-block;
|
37 |
-
}
|
38 |
-
.fields_control_style .div_meta{
|
39 |
-
float: left;
|
40 |
-
width: 50%;
|
41 |
-
padding: 2px;
|
42 |
-
}
|
43 |
-
.fields_control_style .div_custom{
|
44 |
-
padding: 2px;
|
45 |
-
float: left;
|
46 |
-
width: 45%;
|
47 |
-
border-left: dotted 1px;
|
48 |
-
}
|
49 |
-
.fields_control_style label {
|
50 |
-
display: inline-block;
|
51 |
-
padding: 5px;
|
52 |
-
min-width: 100px;
|
53 |
-
|
54 |
-
}
|
55 |
-
.fields_control_style span {
|
56 |
-
display:block;
|
57 |
-
width:100px;
|
58 |
-
height: 100%;
|
59 |
-
margin: 0 auto;
|
60 |
-
padding: 5px;
|
61 |
-
}
|
62 |
|
63 |
-
#fields_control {
|
64 |
-
padding: 10px;
|
65 |
-
/*width: 530px;*/
|
66 |
-
border-color: rgb(187, 180, 180);
|
67 |
-
border-style: solid;
|
68 |
-
border-width: 1px;
|
69 |
-
display: inline-block;
|
70 |
-
}
|
71 |
-
#fields_control label {
|
72 |
-
display: inline-block;
|
73 |
-
padding: 5px;
|
74 |
-
min-width: 100px;
|
75 |
-
|
76 |
-
}
|
77 |
-
#fields_control span {
|
78 |
-
display:block;
|
79 |
-
width:100px;
|
80 |
-
height: 100%;
|
81 |
-
margin: 0 auto;
|
82 |
-
padding: 5px;
|
83 |
-
}
|
84 |
-
#fields_control .div1 {
|
85 |
-
width: 60%;
|
86 |
-
float:left;
|
87 |
-
}
|
88 |
-
#fields_control .div2 {
|
89 |
-
width: 40%;
|
90 |
-
float:left;
|
91 |
-
}
|
92 |
-
#fields_control .div_meta label {
|
93 |
-
display: inline-block;
|
94 |
-
padding: 0px;
|
95 |
-
min-width: 100px;
|
96 |
-
}
|
97 |
#order_fields {
|
98 |
list-style-type: none;
|
99 |
margin: 0;
|
@@ -103,55 +18,60 @@
|
|
103 |
overflow-x: hidden;
|
104 |
height: 630px;
|
105 |
}
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
|
|
|
|
|
|
124 |
padding: 3px;
|
125 |
}
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
129 |
}
|
130 |
-
|
131 |
-
|
|
|
132 |
padding: 3px;
|
133 |
}
|
|
|
134 |
.mapping_fieldname {
|
135 |
-
width:100%;
|
136 |
font-weight: normal;
|
137 |
}
|
138 |
|
139 |
-
.select2-search__field:focus
|
140 |
-
|
141 |
-
border
|
142 |
-
|
143 |
-
|
144 |
-
box-shadow: 0 0 2px rgba(30,140,190,0) !important;
|
145 |
}
|
146 |
|
147 |
-
.select2-search__field{
|
148 |
-
border-color: rgba(30,140,190,0) !important;
|
149 |
-
border:none;
|
150 |
-
-webkit-box-shadow: 0 0 2px rgba(30,140,190,0) !important;
|
151 |
-
box-shadow: 0 0 2px rgba(30,140,190,0) !important;
|
152 |
}
|
153 |
|
154 |
-
input.date{
|
155 |
width: 25%;
|
156 |
}
|
157 |
|
@@ -161,137 +81,85 @@ input.date{
|
|
161 |
border: 1px #969696 solid;
|
162 |
}
|
163 |
|
164 |
-
#sort_products
|
165 |
list-style-type: none;
|
166 |
}
|
167 |
|
168 |
-
.btn-edit{
|
169 |
-
padding: 2px 3px!important;
|
170 |
-
}
|
171 |
-
.btn-trash{
|
172 |
padding: 2px 3px !important;
|
173 |
}
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
padding: 10px;
|
178 |
}
|
179 |
|
180 |
-
.
|
181 |
-
|
182 |
-
float: left;
|
183 |
-
}
|
184 |
-
.weekday label {
|
185 |
-
width: 10px;
|
186 |
-
float: left;
|
187 |
-
margin: 0px 15px;
|
188 |
-
font-weight: bold;
|
189 |
-
}
|
190 |
-
.weekday {
|
191 |
-
float: left;
|
192 |
}
|
193 |
|
194 |
-
.wc-oe-header{
|
195 |
font-size: 15px;
|
196 |
font-weight: bold;
|
197 |
padding-bottom: 5px;
|
198 |
}
|
199 |
-
.wc_oe-select-interval{
|
200 |
-
width: 150px;
|
201 |
-
}
|
202 |
-
.wc_oe-select-weekday {
|
203 |
-
width: 80px;
|
204 |
-
}
|
205 |
-
#d-shedule-3 input[type="submit"] {
|
206 |
-
margin: 3px;
|
207 |
-
}
|
208 |
-
|
209 |
|
210 |
.clearfix:before,
|
211 |
.clearfix:after,
|
212 |
-
.wc_oe-row:after{
|
213 |
-
content:"";
|
214 |
-
display:table;
|
215 |
}
|
|
|
216 |
.clearfix:after,
|
217 |
-
.wc_oe-row:after{
|
218 |
-
clear:both;
|
219 |
-
}
|
220 |
-
.clearfix,
|
221 |
-
.wc_oe-row:after{
|
222 |
-
zoom:1; /* For IE 6/7 (trigger hasLayout) */
|
223 |
}
|
224 |
|
225 |
-
.
|
226 |
-
|
227 |
-
|
228 |
-
#custom_interval{
|
229 |
-
display: none;
|
230 |
}
|
231 |
|
232 |
-
|
233 |
-
margin-top: 8px;
|
234 |
-
}
|
235 |
-
#schedule-2,
|
236 |
-
#schedule-3,
|
237 |
-
#schedule-4 {
|
238 |
-
margin-top: 8px;
|
239 |
-
}
|
240 |
-
.ftp-settings label{
|
241 |
-
display: block;
|
242 |
-
}
|
243 |
-
.ftp-settings .wc_oe-inline{
|
244 |
-
width:80px;
|
245 |
-
display: inline;
|
246 |
-
}
|
247 |
-
.tr-pad{
|
248 |
vertical-align: top;
|
249 |
}
|
250 |
-
|
251 |
-
padding-bottom: 10px;
|
252 |
-
}
|
253 |
.padding-bottom-10 {
|
254 |
padding-bottom: 10px;
|
255 |
}
|
256 |
-
|
|
|
257 |
width: 100%;
|
258 |
}
|
259 |
-
|
|
|
260 |
width: 5%;
|
261 |
}
|
262 |
-
|
|
|
263 |
width: 15%;
|
264 |
}
|
265 |
-
.set-estination{
|
266 |
-
display: none;
|
267 |
-
}
|
268 |
|
269 |
-
.
|
270 |
-
margin: 7px;
|
271 |
-
}
|
272 |
-
.col-50pr{
|
273 |
float: left;
|
274 |
width: 50%;
|
275 |
}
|
276 |
-
|
|
|
277 |
float: left;
|
278 |
width: 100%;
|
279 |
}
|
280 |
|
281 |
-
.all-input-100pr input[type="text"]{
|
282 |
-
width: 100%;
|
283 |
-
}
|
284 |
-
.hide-destination{
|
285 |
-
text-align: center;
|
286 |
width: 100%;
|
287 |
}
|
288 |
|
289 |
-
.xml-title{
|
290 |
display: inline-block;
|
291 |
width: 125px;
|
292 |
}
|
293 |
|
294 |
-
.my-block{
|
295 |
border-width: 1px;
|
296 |
border-style: solid;
|
297 |
border-radius: 3px;
|
@@ -299,55 +167,47 @@ input.date{
|
|
299 |
padding: 10px 5px 10px 10px;
|
300 |
}
|
301 |
|
302 |
-
.my-
|
303 |
-
border-width: 1px !important;
|
304 |
-
border-style: solid !important;
|
305 |
-
border-radius: 3px !important;
|
306 |
-
border-color: #ccc !important;
|
307 |
-
margin-left: 0px !important;
|
308 |
-
}
|
309 |
-
|
310 |
-
.my-icon-triangle{
|
311 |
vertical-align: middle;
|
312 |
-
display: inline-block;
|
313 |
}
|
314 |
-
|
|
|
315 |
cursor: pointer;
|
316 |
font-size: 13px;
|
317 |
font-weight: bold;
|
318 |
text-decoration: underline;
|
319 |
}
|
320 |
|
321 |
-
|
322 |
-
display: inline-block;
|
323 |
-
width: 47%;
|
324 |
-
}
|
325 |
-
|
326 |
-
.my-manage-li:nth-child(2n){
|
327 |
-
margin-left: 10px;
|
328 |
-
float: right;
|
329 |
-
}
|
330 |
-
#my-quick-export-btn{
|
331 |
display: inline-block !important;
|
332 |
margin-left: 10px !important;
|
333 |
}
|
334 |
|
335 |
-
#add_attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
font-size: large;
|
337 |
}
|
338 |
|
339 |
-
.select2-selection-single{
|
340 |
margin-bottom: 5px;
|
341 |
}
|
342 |
|
343 |
-
#select_attributes
|
344 |
width: 120px;
|
345 |
}
|
346 |
-
|
|
|
347 |
margin-top: 3px;
|
348 |
}
|
349 |
|
350 |
-
#progress_div{
|
351 |
z-index: 10001;
|
352 |
position: absolute;
|
353 |
top: 50%;
|
@@ -391,7 +251,7 @@ input.date{
|
|
391 |
background: -o-linear-gradient(top, #0099FF, #1a82f7);
|
392 |
}
|
393 |
|
394 |
-
#background.loading{
|
395 |
position: fixed;
|
396 |
z-index: 10000;
|
397 |
top: 0;
|
@@ -405,19 +265,18 @@ input.date{
|
|
405 |
opacity: 0.55;
|
406 |
}
|
407 |
|
408 |
-
.email_body_textarea
|
409 |
-
{
|
410 |
height: 451px;
|
411 |
width: 100%;
|
412 |
}
|
413 |
-
|
414 |
-
{
|
415 |
width: 60px;
|
416 |
margin-top: 0px;
|
417 |
margin-right: 6px;
|
418 |
}
|
419 |
|
420 |
-
#custom_meta_products_mode input, #custom_meta_coupons_mode input
|
421 |
width: auto;
|
422 |
}
|
423 |
|
@@ -437,21 +296,15 @@ input.date{
|
|
437 |
}
|
438 |
|
439 |
.woe-tab {
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
}
|
|
|
445 |
.woe-tab .form-group label input {
|
446 |
-
|
447 |
-
|
448 |
-
}
|
449 |
-
.woe-separator {
|
450 |
-
height: 1px;
|
451 |
-
border-top: 1px solid #ddd;
|
452 |
-
margin: 2em auto;
|
453 |
-
width: 100%;
|
454 |
-
clear: both;
|
455 |
}
|
456 |
|
457 |
#woe-admin .woe-tab {
|
@@ -477,37 +330,47 @@ input.date{
|
|
477 |
padding: 0.41667rem 0.66667rem;
|
478 |
transition: border-color 100ms, background-color 250ms;
|
479 |
}
|
|
|
480 |
#woe-admin .woe-input-simple textarea:focus {
|
481 |
background-color: #003553;
|
482 |
color: #fff;
|
483 |
}
|
|
|
484 |
#woe-admin .tools-textarea {
|
485 |
width: 66.66667%;
|
486 |
}
|
|
|
487 |
#woe-admin .woe-input-simple input, #woe-admin .woe-select input, #woe-admin .woe-input-simple textarea, #woe-admin .woe-select textarea, .woe-calendar-wrapper .woe-input-simple input, .woe-calendar-wrapper .woe-select input, .woe-calendar-wrapper .woe-input-simple textarea, .woe-calendar-wrapper .woe-select textarea, #woe-admin .woe-checkbox label, #woe-admin .woe-radiobox label, #woe-admin .woe-switch label, #woe-admin .woe-select.woe-select-info-label .woe-label-big label, .woe-calendar-wrapper .woe-select.woe-select-info-label #woe-admin .woe-label-big label, .woe-calendar-wrapper .woe-checkbox label, .woe-calendar-wrapper .woe-radiobox label, .woe-calendar-wrapper .woe-switch label, .woe-calendar-wrapper .woe-select.woe-select-info-label .woe-label-big label, #woe-admin .woe-checkbutton input + label, .woe-calendar-wrapper .woe-checkbutton input + label, #woe-admin .col-time, .woe-calendar-wrapper .col-time, #woe-admin .woe-box-title, .woe-calendar-wrapper .woe-box-title, .select2-container.select2-container-woe .select2-selection-single, .select2-container.select2-container-woe .select2-selection-multiple {
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
|
|
|
|
493 |
#woe-admin .woe-input-simple input, #woe-admin .woe-select input, #woe-admin .woe-input-simple textarea, #woe-admin .woe-select textarea, .woe-calendar-wrapper .woe-input-simple input, .woe-calendar-wrapper .woe-select input, .woe-calendar-wrapper .woe-input-simple textarea, .woe-calendar-wrapper .woe-select textarea, #woe-admin .woe-checkbox label, #woe-admin .woe-radiobox label, #woe-admin .woe-switch label, #woe-admin .woe-select.woe-select-info-label .woe-label-big label, .woe-calendar-wrapper .woe-select.woe-select-info-label #woe-admin .woe-label-big label, .woe-calendar-wrapper .woe-checkbox label, .woe-calendar-wrapper .woe-radiobox label, .woe-calendar-wrapper .woe-switch label, .woe-calendar-wrapper .woe-select.woe-select-info-label .woe-label-big label, #woe-admin .woe-checkbutton input + label, .woe-calendar-wrapper .woe-checkbutton input + label, #woe-admin .col-time, .woe-calendar-wrapper .col-time, #woe-admin .woe-box-title, .woe-calendar-wrapper .woe-box-title, .select2-container.select2-container-woe .select2-selection-single, .select2-container.select2-container-woe .select2-selection-multiple {
|
494 |
-
|
|
|
|
|
495 |
|
496 |
#woe-admin .woe-input-simple label, #woe-admin .woe-select label, .woe-calendar-wrapper .woe-input-simple label, .woe-calendar-wrapper .woe-select label, #woe-admin .woe-fake-label, .woe-calendar-wrapper .woe-fake-label, #woe-admin .woe-btn-big, #woe-admin p.submit, #woe-admin .woe-btn-big input, #woe-admin p.submit input, #woe-admin .woe-btn-big button, #woe-admin p.submit button, .woe-calendar-wrapper .woe-btn-big, .woe-calendar-wrapper p.submit, .woe-calendar-wrapper .woe-btn-big input, .woe-calendar-wrapper p.submit input, .woe-calendar-wrapper .woe-btn-big button, .woe-calendar-wrapper p.submit button, #woe-admin .woe-box-maininfo p, .woe-calendar-wrapper .woe-box-maininfo p, #woe-admin .woe-box-title span, .woe-calendar-wrapper .woe-box-title span, #woe-admin .woe-box-info .woe-box-info-content, .woe-calendar-wrapper .woe-box-info .woe-box-info-content, #woe-admin .woe-box-info .woe-box-info-content h5, .woe-calendar-wrapper .woe-box-info .woe-box-info-content h5, #woe-admin .woe-message, .woe-calendar-wrapper .woe-message, .select2-container.select2-container-woe .select2-dropdown, .select2-container.select2-container-woe .select2-search-dropdown .select2-search__field {
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
|
|
501 |
|
502 |
#woe-admin .woe-input-simple p, #woe-admin .woe-checkbox p, #woe-admin .woe-radiobox p, #woe-admin .woe-switch p, #woe-admin .woe-select p, .woe-calendar-wrapper .woe-input-simple p, .woe-calendar-wrapper .woe-checkbox p, .woe-calendar-wrapper .woe-radiobox p, .woe-calendar-wrapper .woe-switch p, .woe-calendar-wrapper .woe-select p, #woe-admin .woe-btn-medium, #woe-admin .nav-tab-wrapper .nav-tab,
|
503 |
#woe-admin h2.nav-tab-wrapper .nav-tab, .woe-calendar-wrapper .nav-tab-wrapper #woe-admin .nav-tab, #woe-admin .woe-admin-nav a, .woe-calendar-wrapper .woe-admin-nav #woe-admin a, #woe-admin .woe-btn-medium input, #woe-admin .nav-tab-wrapper .nav-tab input, .woe-calendar-wrapper .nav-tab-wrapper #woe-admin .nav-tab input, #woe-admin .woe-admin-nav a input, .woe-calendar-wrapper .woe-admin-nav #woe-admin a input, #woe-admin .woe-btn-medium button, #woe-admin .nav-tab-wrapper .nav-tab button, .woe-calendar-wrapper .nav-tab-wrapper #woe-admin .nav-tab button, #woe-admin .woe-admin-nav a button, .woe-calendar-wrapper .woe-admin-nav #woe-admin a button, .woe-calendar-wrapper .woe-btn-medium, .woe-calendar-wrapper .nav-tab-wrapper .nav-tab,
|
504 |
.woe-calendar-wrapper h2.nav-tab-wrapper .nav-tab, .woe-calendar-wrapper .woe-admin-nav a, .woe-calendar-wrapper .woe-btn-medium input, .woe-calendar-wrapper .nav-tab-wrapper .nav-tab input, .woe-calendar-wrapper .woe-admin-nav a input, .woe-calendar-wrapper .woe-btn-medium button, .woe-calendar-wrapper .nav-tab-wrapper .nav-tab button, .woe-calendar-wrapper .woe-admin-nav a button, #woe-admin .woe-btn-small, .woe-calendar-wrapper .woe-btn-small, #woe-admin .woe-btn-small-round, .woe-calendar-wrapper .woe-btn-small-round, #woe-admin .woe-box-maininfo, .woe-calendar-wrapper .woe-box-maininfo {
|
505 |
-
|
506 |
-
|
507 |
-
|
|
|
508 |
|
509 |
#woe-admin .woe-box-maininfo p, #woe-admin .woe-box-title span, #woe-admin .woe-box-info .woe-box-info-content, .woe-calendar-wrapper .woe-box-info .woe-box-info-content, #woe-admin .woe-box-info .woe-box-info-content h5, .woe-calendar-wrapper .woe-box-info .woe-box-info-content h5 {
|
510 |
-
|
|
|
511 |
|
512 |
#woe-admin .woe-input-simple p {
|
513 |
color: #888;
|
@@ -519,11 +382,14 @@ input.date{
|
|
519 |
#woe-admin .woe-input-simple {
|
520 |
padding-bottom: 15px;
|
521 |
}
|
|
|
522 |
#woe-admin .woe-input-simple input, #woe-admin .woe-select input, #woe-admin .woe-input-simple textarea, #woe-admin .woe-select textarea {
|
523 |
-
|
|
|
524 |
|
525 |
#woe-admin .woe-input-simple input:focus, #woe-admin .woe-select input:focus, #woe-admin .woe-input-simple textarea:focus, #woe-admin .woe-select textarea:focus {
|
526 |
-
|
|
|
527 |
|
528 |
.woe-btn-tools {
|
529 |
display: inline-block;
|
@@ -555,6 +421,7 @@ input.date{
|
|
555 |
width: 30%;
|
556 |
font-weight: normal;
|
557 |
}
|
|
|
558 |
#my-sort {
|
559 |
font-weight: bold;
|
560 |
}
|
@@ -568,13 +435,12 @@ input.date{
|
|
568 |
display: none !important;
|
569 |
}
|
570 |
|
571 |
-
|
572 |
.without-dropdown.select2-dropdown,
|
573 |
.without-dropdown .select2-search--inline {
|
574 |
display: none;
|
575 |
}
|
576 |
|
577 |
-
.profiles #bulk_action{
|
578 |
width: 70px;
|
579 |
}
|
580 |
|
@@ -582,80 +448,6 @@ input.date{
|
|
582 |
width: 120px;
|
583 |
}
|
584 |
|
585 |
-
#d-schedule-3 .block,
|
586 |
-
#d-schedule-4 .block,
|
587 |
-
#d-schedule-5 .block {
|
588 |
-
margin-left: 20px;
|
589 |
-
margin-right: 5px;
|
590 |
-
}
|
591 |
-
|
592 |
-
#d-schedule-3 .block.disabled,
|
593 |
-
#d-schedule-4 .block.disabled,
|
594 |
-
#d-schedule-5 .block.disabled {
|
595 |
-
pointer-events: none;
|
596 |
-
opacity: 0.7;
|
597 |
-
}
|
598 |
-
|
599 |
-
#d-schedule-3 .input-times,
|
600 |
-
#d-schedule-4 .input-date-times {
|
601 |
-
width: 100%;
|
602 |
-
min-height: 30px;
|
603 |
-
background-color: white;
|
604 |
-
border: 1px solid #aaa;
|
605 |
-
border-radius: 4px;
|
606 |
-
cursor: text;
|
607 |
-
margin: 3px;
|
608 |
-
display: inline-block;
|
609 |
-
}
|
610 |
-
|
611 |
-
#d-schedule-3 .time,
|
612 |
-
#d-schedule-4 .time {
|
613 |
-
background-color: #e4e4e4;
|
614 |
-
border: 1px solid #aaa;
|
615 |
-
border-radius: 4px;
|
616 |
-
cursor: default;
|
617 |
-
float: left;
|
618 |
-
margin: 5px;
|
619 |
-
padding: 0 5px;
|
620 |
-
}
|
621 |
-
|
622 |
-
#d-schedule-3 .btn-delete,
|
623 |
-
#d-schedule-4 .btn-delete {
|
624 |
-
color: #999;
|
625 |
-
cursor: pointer;
|
626 |
-
display: inline-block;
|
627 |
-
font-weight: bold;
|
628 |
-
margin-right: 2px;
|
629 |
-
}
|
630 |
-
|
631 |
-
#d-schedule-3 .btn-delete:hover,
|
632 |
-
#d-schedule-4 .btn-delete:hover {
|
633 |
-
color: #333;
|
634 |
-
}
|
635 |
-
|
636 |
-
#d-schedule-4 .date-picker .datetimes-date {
|
637 |
-
max-width: 120px;
|
638 |
-
height: 28px;
|
639 |
-
vertical-align: middle;
|
640 |
-
background: url("../img/calendar.png") 98px 5px no-repeat;
|
641 |
-
}
|
642 |
-
|
643 |
-
.woe-row-sort-handle {
|
644 |
-
width: 20px;
|
645 |
-
height: 20px;
|
646 |
-
color: black;
|
647 |
-
cursor: move;
|
648 |
-
}
|
649 |
-
|
650 |
-
#reorder_section {
|
651 |
-
display: inline-block;
|
652 |
-
margin-top: 10px;
|
653 |
-
}
|
654 |
-
|
655 |
-
#reorder_section #apply_reorder, #reorder_section #cancel_reorder {
|
656 |
-
display: none;
|
657 |
-
}
|
658 |
-
|
659 |
.wp-wrap .column-order {
|
660 |
width: 2.2em;
|
661 |
}
|
@@ -678,30 +470,6 @@ input.date{
|
|
678 |
display: none;
|
679 |
}
|
680 |
|
681 |
-
.license_paragraph {
|
682 |
-
margin : 15px 0 15px 0;
|
683 |
-
}
|
684 |
-
|
685 |
-
#license_help_text {
|
686 |
-
background-color: white;
|
687 |
-
border: 1px #b2b2b2 solid;
|
688 |
-
border-radius: 5px;
|
689 |
-
padding:10px;
|
690 |
-
margin: 15px 0 15px 0;
|
691 |
-
}
|
692 |
-
|
693 |
-
#my-shedule-days .wc_oe-select-interval {
|
694 |
-
width: 55%;
|
695 |
-
}
|
696 |
-
|
697 |
-
#my-shedule-days .input-mins-custom-interval {
|
698 |
-
max-width: 100px;
|
699 |
-
}
|
700 |
-
|
701 |
-
.flat_format_controls div {
|
702 |
-
margin: 10px;
|
703 |
-
}
|
704 |
-
|
705 |
.mapping_row.segment_products {
|
706 |
background-color: #c5ffbb;
|
707 |
}
|
@@ -710,8 +478,6 @@ input.date{
|
|
710 |
background-color: #c2bdff;
|
711 |
}
|
712 |
|
713 |
-
|
714 |
-
|
715 |
.segment_choice {
|
716 |
cursor: pointer;
|
717 |
}
|
@@ -744,7 +510,9 @@ input.date{
|
|
744 |
}
|
745 |
|
746 |
@keyframes blinker {
|
747 |
-
50% {
|
|
|
|
|
748 |
}
|
749 |
|
750 |
.section {
|
@@ -773,7 +541,6 @@ input.date{
|
|
773 |
max-width: 50px;
|
774 |
}
|
775 |
|
776 |
-
|
777 |
#order_fields #sortable_products,
|
778 |
#order_fields #sortable_coupons {
|
779 |
min-height: 40px;
|
@@ -811,8 +578,8 @@ input.date{
|
|
811 |
}
|
812 |
|
813 |
.tab-actions-forms span {
|
814 |
-
display:block;
|
815 |
-
width:100px;
|
816 |
height: 100%;
|
817 |
margin: 0 auto;
|
818 |
padding: 5px;
|
@@ -830,6 +597,7 @@ input.date{
|
|
830 |
|
831 |
.tab-actions-forms .segment-form select {
|
832 |
margin-left: 1px;
|
|
|
833 |
}
|
834 |
|
835 |
#fields .fields-control-block .display_as {
|
@@ -853,7 +621,7 @@ input.date{
|
|
853 |
}
|
854 |
|
855 |
#fields .fields-control-block .display_as.duplicate_rows_options > div label,
|
856 |
-
#fields .fields-control-block .display_as.duplicate_inside_one_cell_options > div label{
|
857 |
margin: 0 5px 0 5px;
|
858 |
}
|
859 |
|
@@ -901,7 +669,7 @@ input.date{
|
|
901 |
padding-right: 35px;
|
902 |
}
|
903 |
|
904 |
-
#order_fields .mapping_row
|
905 |
position: absolute;
|
906 |
top: 5px;
|
907 |
right: 5px;
|
@@ -913,11 +681,67 @@ input.date{
|
|
913 |
vertical-align: top;
|
914 |
}
|
915 |
|
916 |
-
.pdf_two_col_block input[type=number]{
|
917 |
width: 40%;
|
918 |
}
|
919 |
|
920 |
#unselected_fields_list {
|
921 |
overflow-y: scroll;
|
922 |
height: 700px;
|
923 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
padding-top: 0px;
|
9 |
|
10 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
#order_fields {
|
13 |
list-style-type: none;
|
14 |
margin: 0;
|
18 |
overflow-x: hidden;
|
19 |
height: 630px;
|
20 |
}
|
21 |
+
|
22 |
+
#output_preview {
|
23 |
+
border-color: green;
|
24 |
+
border-style: dashed;
|
25 |
+
border-width: 1px;
|
26 |
+
display: none;
|
27 |
+
width: 90%
|
28 |
+
}
|
29 |
+
|
30 |
+
.spit-settings-cols {
|
31 |
+
width: 20px
|
32 |
+
}
|
33 |
+
|
34 |
+
.mapping_header {
|
35 |
+
display: table-row;
|
36 |
+
font-weight: bold;
|
37 |
+
}
|
38 |
+
|
39 |
+
.mapping_col_1 {
|
40 |
+
display: table-cell;
|
41 |
+
width: 50px;
|
42 |
padding: 3px;
|
43 |
}
|
44 |
+
|
45 |
+
.mapping_col_2 {
|
46 |
+
display: table-cell;
|
47 |
+
min-width: 150px;
|
48 |
}
|
49 |
+
|
50 |
+
.mapping_col_3 {
|
51 |
+
display: table-cell;
|
52 |
padding: 3px;
|
53 |
}
|
54 |
+
|
55 |
.mapping_fieldname {
|
56 |
+
width: 100%;
|
57 |
font-weight: normal;
|
58 |
}
|
59 |
|
60 |
+
.select2-search__field:focus {
|
61 |
+
border-color: rgba(30, 140, 190, 0) !important;
|
62 |
+
border: none;
|
63 |
+
-webkit-box-shadow: 0 0 2px rgba(30, 140, 190, 0) !important;
|
64 |
+
box-shadow: 0 0 2px rgba(30, 140, 190, 0) !important;
|
|
|
65 |
}
|
66 |
|
67 |
+
.select2-search__field {
|
68 |
+
border-color: rgba(30, 140, 190, 0) !important;
|
69 |
+
border: none;
|
70 |
+
-webkit-box-shadow: 0 0 2px rgba(30, 140, 190, 0) !important;
|
71 |
+
box-shadow: 0 0 2px rgba(30, 140, 190, 0) !important;
|
72 |
}
|
73 |
|
74 |
+
input.date {
|
75 |
width: 25%;
|
76 |
}
|
77 |
|
81 |
border: 1px #969696 solid;
|
82 |
}
|
83 |
|
84 |
+
#sort_products, #sort_coupons {
|
85 |
list-style-type: none;
|
86 |
}
|
87 |
|
88 |
+
.btn-edit {
|
|
|
|
|
|
|
89 |
padding: 2px 3px !important;
|
90 |
}
|
91 |
|
92 |
+
.btn-trash {
|
93 |
+
padding: 2px 3px !important;
|
|
|
94 |
}
|
95 |
|
96 |
+
.padding-10 {
|
97 |
+
padding: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
|
100 |
+
.wc-oe-header {
|
101 |
font-size: 15px;
|
102 |
font-weight: bold;
|
103 |
padding-bottom: 5px;
|
104 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
.clearfix:before,
|
107 |
.clearfix:after,
|
108 |
+
.wc_oe-row:after {
|
109 |
+
content: "";
|
110 |
+
display: table;
|
111 |
}
|
112 |
+
|
113 |
.clearfix:after,
|
114 |
+
.wc_oe-row:after {
|
115 |
+
clear: both;
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
+
.clearfix,
|
119 |
+
.wc_oe-row:after {
|
120 |
+
zoom: 1; /* For IE 6/7 (trigger hasLayout) */
|
|
|
|
|
121 |
}
|
122 |
|
123 |
+
.tr-pad {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
vertical-align: top;
|
125 |
}
|
126 |
+
|
|
|
|
|
127 |
.padding-bottom-10 {
|
128 |
padding-bottom: 10px;
|
129 |
}
|
130 |
+
|
131 |
+
.width-100 {
|
132 |
width: 100%;
|
133 |
}
|
134 |
+
|
135 |
+
.width-5 {
|
136 |
width: 5%;
|
137 |
}
|
138 |
+
|
139 |
+
.width-15 {
|
140 |
width: 15%;
|
141 |
}
|
|
|
|
|
|
|
142 |
|
143 |
+
.col-50pr {
|
|
|
|
|
|
|
144 |
float: left;
|
145 |
width: 50%;
|
146 |
}
|
147 |
+
|
148 |
+
.col-100pr {
|
149 |
float: left;
|
150 |
width: 100%;
|
151 |
}
|
152 |
|
153 |
+
.all-input-100pr input[type="text"] {
|
|
|
|
|
|
|
|
|
154 |
width: 100%;
|
155 |
}
|
156 |
|
157 |
+
.xml-title {
|
158 |
display: inline-block;
|
159 |
width: 125px;
|
160 |
}
|
161 |
|
162 |
+
.my-block {
|
163 |
border-width: 1px;
|
164 |
border-style: solid;
|
165 |
border-radius: 3px;
|
167 |
padding: 10px 5px 10px 10px;
|
168 |
}
|
169 |
|
170 |
+
.my-icon-triangle {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
vertical-align: middle;
|
172 |
+
display: inline-block !important;
|
173 |
}
|
174 |
+
|
175 |
+
.my-hide-next {
|
176 |
cursor: pointer;
|
177 |
font-size: 13px;
|
178 |
font-weight: bold;
|
179 |
text-decoration: underline;
|
180 |
}
|
181 |
|
182 |
+
#my-quick-export-btn {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
display: inline-block !important;
|
184 |
margin-left: 10px !important;
|
185 |
}
|
186 |
|
187 |
+
#add_attributes,
|
188 |
+
#add_taxonomies,
|
189 |
+
#add_shipping_locations,
|
190 |
+
#add_billing_locations,
|
191 |
+
#add_custom_fields,
|
192 |
+
#add_product_custom_fields,
|
193 |
+
#add_item_names,
|
194 |
+
#add_item_metadata {
|
195 |
font-size: large;
|
196 |
}
|
197 |
|
198 |
+
.select2-selection-single {
|
199 |
margin-bottom: 5px;
|
200 |
}
|
201 |
|
202 |
+
#select_attributes, #select_taxonomies, #text_shipping_locations, #text_billing_locations, #select_custom_fields, #select_product_custom_fields, #select_itemmeta, #text_item_names, #text_item_metadata {
|
203 |
width: 120px;
|
204 |
}
|
205 |
+
|
206 |
+
.dashicons {
|
207 |
margin-top: 3px;
|
208 |
}
|
209 |
|
210 |
+
#progress_div {
|
211 |
z-index: 10001;
|
212 |
position: absolute;
|
213 |
top: 50%;
|
251 |
background: -o-linear-gradient(top, #0099FF, #1a82f7);
|
252 |
}
|
253 |
|
254 |
+
#background.loading {
|
255 |
position: fixed;
|
256 |
z-index: 10000;
|
257 |
top: 0;
|
265 |
opacity: 0.55;
|
266 |
}
|
267 |
|
268 |
+
.email_body_textarea {
|
|
|
269 |
height: 451px;
|
270 |
width: 100%;
|
271 |
}
|
272 |
+
|
273 |
+
.select_compare {
|
274 |
width: 60px;
|
275 |
margin-top: 0px;
|
276 |
margin-right: 6px;
|
277 |
}
|
278 |
|
279 |
+
#custom_meta_products_mode input, #custom_meta_coupons_mode input {
|
280 |
width: auto;
|
281 |
}
|
282 |
|
296 |
}
|
297 |
|
298 |
.woe-tab {
|
299 |
+
border: 1px solid #ccc;
|
300 |
+
border-top-width: 0;
|
301 |
+
background: #f1f1f1;
|
302 |
+
padding: 30px;
|
303 |
}
|
304 |
+
|
305 |
.woe-tab .form-group label input {
|
306 |
+
display: inline-block;
|
307 |
+
margin-top: -3px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
}
|
309 |
|
310 |
#woe-admin .woe-tab {
|
330 |
padding: 0.41667rem 0.66667rem;
|
331 |
transition: border-color 100ms, background-color 250ms;
|
332 |
}
|
333 |
+
|
334 |
#woe-admin .woe-input-simple textarea:focus {
|
335 |
background-color: #003553;
|
336 |
color: #fff;
|
337 |
}
|
338 |
+
|
339 |
#woe-admin .tools-textarea {
|
340 |
width: 66.66667%;
|
341 |
}
|
342 |
+
|
343 |
#woe-admin .woe-input-simple input, #woe-admin .woe-select input, #woe-admin .woe-input-simple textarea, #woe-admin .woe-select textarea, .woe-calendar-wrapper .woe-input-simple input, .woe-calendar-wrapper .woe-select input, .woe-calendar-wrapper .woe-input-simple textarea, .woe-calendar-wrapper .woe-select textarea, #woe-admin .woe-checkbox label, #woe-admin .woe-radiobox label, #woe-admin .woe-switch label, #woe-admin .woe-select.woe-select-info-label .woe-label-big label, .woe-calendar-wrapper .woe-select.woe-select-info-label #woe-admin .woe-label-big label, .woe-calendar-wrapper .woe-checkbox label, .woe-calendar-wrapper .woe-radiobox label, .woe-calendar-wrapper .woe-switch label, .woe-calendar-wrapper .woe-select.woe-select-info-label .woe-label-big label, #woe-admin .woe-checkbutton input + label, .woe-calendar-wrapper .woe-checkbutton input + label, #woe-admin .col-time, .woe-calendar-wrapper .col-time, #woe-admin .woe-box-title, .woe-calendar-wrapper .woe-box-title, .select2-container.select2-container-woe .select2-selection-single, .select2-container.select2-container-woe .select2-selection-multiple {
|
344 |
+
font-family: "Open sans", serif;
|
345 |
+
font-size: 0.83333rem;
|
346 |
+
line-height: 1.41667rem;
|
347 |
+
line-height: 1.41667rem;
|
348 |
+
}
|
349 |
+
|
350 |
+
@media only screen and (min-width: 768px) {
|
351 |
#woe-admin .woe-input-simple input, #woe-admin .woe-select input, #woe-admin .woe-input-simple textarea, #woe-admin .woe-select textarea, .woe-calendar-wrapper .woe-input-simple input, .woe-calendar-wrapper .woe-select input, .woe-calendar-wrapper .woe-input-simple textarea, .woe-calendar-wrapper .woe-select textarea, #woe-admin .woe-checkbox label, #woe-admin .woe-radiobox label, #woe-admin .woe-switch label, #woe-admin .woe-select.woe-select-info-label .woe-label-big label, .woe-calendar-wrapper .woe-select.woe-select-info-label #woe-admin .woe-label-big label, .woe-calendar-wrapper .woe-checkbox label, .woe-calendar-wrapper .woe-radiobox label, .woe-calendar-wrapper .woe-switch label, .woe-calendar-wrapper .woe-select.woe-select-info-label .woe-label-big label, #woe-admin .woe-checkbutton input + label, .woe-calendar-wrapper .woe-checkbutton input + label, #woe-admin .col-time, .woe-calendar-wrapper .col-time, #woe-admin .woe-box-title, .woe-calendar-wrapper .woe-box-title, .select2-container.select2-container-woe .select2-selection-single, .select2-container.select2-container-woe .select2-selection-multiple {
|
352 |
+
font-size: 1rem;
|
353 |
+
}
|
354 |
+
}
|
355 |
|
356 |
#woe-admin .woe-input-simple label, #woe-admin .woe-select label, .woe-calendar-wrapper .woe-input-simple label, .woe-calendar-wrapper .woe-select label, #woe-admin .woe-fake-label, .woe-calendar-wrapper .woe-fake-label, #woe-admin .woe-btn-big, #woe-admin p.submit, #woe-admin .woe-btn-big input, #woe-admin p.submit input, #woe-admin .woe-btn-big button, #woe-admin p.submit button, .woe-calendar-wrapper .woe-btn-big, .woe-calendar-wrapper p.submit, .woe-calendar-wrapper .woe-btn-big input, .woe-calendar-wrapper p.submit input, .woe-calendar-wrapper .woe-btn-big button, .woe-calendar-wrapper p.submit button, #woe-admin .woe-box-maininfo p, .woe-calendar-wrapper .woe-box-maininfo p, #woe-admin .woe-box-title span, .woe-calendar-wrapper .woe-box-title span, #woe-admin .woe-box-info .woe-box-info-content, .woe-calendar-wrapper .woe-box-info .woe-box-info-content, #woe-admin .woe-box-info .woe-box-info-content h5, .woe-calendar-wrapper .woe-box-info .woe-box-info-content h5, #woe-admin .woe-message, .woe-calendar-wrapper .woe-message, .select2-container.select2-container-woe .select2-dropdown, .select2-container.select2-container-woe .select2-search-dropdown .select2-search__field {
|
357 |
+
font-family: "Open sans", serif;
|
358 |
+
font-size: 0.75rem;
|
359 |
+
font-weight: normal;
|
360 |
+
line-height: 1.16667rem;
|
361 |
+
}
|
362 |
|
363 |
#woe-admin .woe-input-simple p, #woe-admin .woe-checkbox p, #woe-admin .woe-radiobox p, #woe-admin .woe-switch p, #woe-admin .woe-select p, .woe-calendar-wrapper .woe-input-simple p, .woe-calendar-wrapper .woe-checkbox p, .woe-calendar-wrapper .woe-radiobox p, .woe-calendar-wrapper .woe-switch p, .woe-calendar-wrapper .woe-select p, #woe-admin .woe-btn-medium, #woe-admin .nav-tab-wrapper .nav-tab,
|
364 |
#woe-admin h2.nav-tab-wrapper .nav-tab, .woe-calendar-wrapper .nav-tab-wrapper #woe-admin .nav-tab, #woe-admin .woe-admin-nav a, .woe-calendar-wrapper .woe-admin-nav #woe-admin a, #woe-admin .woe-btn-medium input, #woe-admin .nav-tab-wrapper .nav-tab input, .woe-calendar-wrapper .nav-tab-wrapper #woe-admin .nav-tab input, #woe-admin .woe-admin-nav a input, .woe-calendar-wrapper .woe-admin-nav #woe-admin a input, #woe-admin .woe-btn-medium button, #woe-admin .nav-tab-wrapper .nav-tab button, .woe-calendar-wrapper .nav-tab-wrapper #woe-admin .nav-tab button, #woe-admin .woe-admin-nav a button, .woe-calendar-wrapper .woe-admin-nav #woe-admin a button, .woe-calendar-wrapper .woe-btn-medium, .woe-calendar-wrapper .nav-tab-wrapper .nav-tab,
|
365 |
.woe-calendar-wrapper h2.nav-tab-wrapper .nav-tab, .woe-calendar-wrapper .woe-admin-nav a, .woe-calendar-wrapper .woe-btn-medium input, .woe-calendar-wrapper .nav-tab-wrapper .nav-tab input, .woe-calendar-wrapper .woe-admin-nav a input, .woe-calendar-wrapper .woe-btn-medium button, .woe-calendar-wrapper .nav-tab-wrapper .nav-tab button, .woe-calendar-wrapper .woe-admin-nav a button, #woe-admin .woe-btn-small, .woe-calendar-wrapper .woe-btn-small, #woe-admin .woe-btn-small-round, .woe-calendar-wrapper .woe-btn-small-round, #woe-admin .woe-box-maininfo, .woe-calendar-wrapper .woe-box-maininfo {
|
366 |
+
font-family: "Open sans", serif;
|
367 |
+
font-size: 0.66667rem;
|
368 |
+
line-height: 0.91667rem;
|
369 |
+
}
|
370 |
|
371 |
#woe-admin .woe-box-maininfo p, #woe-admin .woe-box-title span, #woe-admin .woe-box-info .woe-box-info-content, .woe-calendar-wrapper .woe-box-info .woe-box-info-content, #woe-admin .woe-box-info .woe-box-info-content h5, .woe-calendar-wrapper .woe-box-info .woe-box-info-content h5 {
|
372 |
+
color: #444;
|
373 |
+
}
|
374 |
|
375 |
#woe-admin .woe-input-simple p {
|
376 |
color: #888;
|
382 |
#woe-admin .woe-input-simple {
|
383 |
padding-bottom: 15px;
|
384 |
}
|
385 |
+
|
386 |
#woe-admin .woe-input-simple input, #woe-admin .woe-select input, #woe-admin .woe-input-simple textarea, #woe-admin .woe-select textarea {
|
387 |
+
color: #003553;
|
388 |
+
}
|
389 |
|
390 |
#woe-admin .woe-input-simple input:focus, #woe-admin .woe-select input:focus, #woe-admin .woe-input-simple textarea:focus, #woe-admin .woe-select textarea:focus {
|
391 |
+
color: #0C6EB6;
|
392 |
+
}
|
393 |
|
394 |
.woe-btn-tools {
|
395 |
display: inline-block;
|
421 |
width: 30%;
|
422 |
font-weight: normal;
|
423 |
}
|
424 |
+
|
425 |
#my-sort {
|
426 |
font-weight: bold;
|
427 |
}
|
435 |
display: none !important;
|
436 |
}
|
437 |
|
|
|
438 |
.without-dropdown.select2-dropdown,
|
439 |
.without-dropdown .select2-search--inline {
|
440 |
display: none;
|
441 |
}
|
442 |
|
443 |
+
.profiles #bulk_action {
|
444 |
width: 70px;
|
445 |
}
|
446 |
|
448 |
width: 120px;
|
449 |
}
|
450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
.wp-wrap .column-order {
|
452 |
width: 2.2em;
|
453 |
}
|
470 |
display: none;
|
471 |
}
|
472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
.mapping_row.segment_products {
|
474 |
background-color: #c5ffbb;
|
475 |
}
|
478 |
background-color: #c2bdff;
|
479 |
}
|
480 |
|
|
|
|
|
481 |
.segment_choice {
|
482 |
cursor: pointer;
|
483 |
}
|
510 |
}
|
511 |
|
512 |
@keyframes blinker {
|
513 |
+
50% {
|
514 |
+
opacity: 0;
|
515 |
+
}
|
516 |
}
|
517 |
|
518 |
.section {
|
541 |
max-width: 50px;
|
542 |
}
|
543 |
|
|
|
544 |
#order_fields #sortable_products,
|
545 |
#order_fields #sortable_coupons {
|
546 |
min-height: 40px;
|
578 |
}
|
579 |
|
580 |
.tab-actions-forms span {
|
581 |
+
display: block;
|
582 |
+
width: 100px;
|
583 |
height: 100%;
|
584 |
margin: 0 auto;
|
585 |
padding: 5px;
|
597 |
|
598 |
.tab-actions-forms .segment-form select {
|
599 |
margin-left: 1px;
|
600 |
+
width: 80%;
|
601 |
}
|
602 |
|
603 |
#fields .fields-control-block .display_as {
|
621 |
}
|
622 |
|
623 |
#fields .fields-control-block .display_as.duplicate_rows_options > div label,
|
624 |
+
#fields .fields-control-block .display_as.duplicate_inside_one_cell_options > div label {
|
625 |
margin: 0 5px 0 5px;
|
626 |
}
|
627 |
|
669 |
padding-right: 35px;
|
670 |
}
|
671 |
|
672 |
+
#order_fields .mapping_row .mapping_row-delete_field_block {
|
673 |
position: absolute;
|
674 |
top: 5px;
|
675 |
right: 5px;
|
681 |
vertical-align: top;
|
682 |
}
|
683 |
|
684 |
+
.pdf_two_col_block input[type=number] {
|
685 |
width: 40%;
|
686 |
}
|
687 |
|
688 |
#unselected_fields_list {
|
689 |
overflow-y: scroll;
|
690 |
height: 700px;
|
691 |
+
}
|
692 |
+
|
693 |
+
/*date time picker start*/
|
694 |
+
.datetime-picker-control {
|
695 |
+
width: 100px;
|
696 |
+
display: inline-block;
|
697 |
+
vertical-align: middle;
|
698 |
+
text-align: center;
|
699 |
+
margin: 2px;
|
700 |
+
}
|
701 |
+
|
702 |
+
.datetime-picker-control input {
|
703 |
+
margin: 0 auto;
|
704 |
+
}
|
705 |
+
|
706 |
+
.datetime-picker-control .upper,
|
707 |
+
.datetime-picker-control .footer
|
708 |
+
{
|
709 |
+
width: 100%;
|
710 |
+
margin: 2px;
|
711 |
+
}
|
712 |
+
|
713 |
+
.datetime-picker-control .date {
|
714 |
+
width: 100%;
|
715 |
+
}
|
716 |
+
|
717 |
+
.datetime-picker-control .hours,
|
718 |
+
.datetime-picker-control .minutes,
|
719 |
+
.datetime-picker-control .seconds
|
720 |
+
{
|
721 |
+
display: inline-block;
|
722 |
+
max-width: 45px;
|
723 |
+
}
|
724 |
+
|
725 |
+
.datetime-picker-control .delimiter {
|
726 |
+
display: inline-block;
|
727 |
+
width: 10px;
|
728 |
+
}
|
729 |
+
/*date time picker finish*/
|
730 |
+
|
731 |
+
.summary-products-report .summary-products-mode-tip {
|
732 |
+
display: block;
|
733 |
+
}
|
734 |
+
|
735 |
+
.summary-products-mode-tip {
|
736 |
+
margin-top: 20px;
|
737 |
+
color: red;
|
738 |
+
display: none;
|
739 |
+
}
|
740 |
+
|
741 |
+
#custom_meta_products_mode {
|
742 |
+
margin-top: 10px;
|
743 |
+
}
|
744 |
+
|
745 |
+
.add_form_tip {
|
746 |
+
color: green;
|
747 |
+
}
|
assets/img/1
DELETED
File without changes
|
assets/js/buttons.js
ADDED
@@ -0,0 +1,371 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function woe_show_preview( response ) {
|
2 |
+
var id = 'output_preview';
|
3 |
+
if ( woe_is_flat_format( output_format ) ) {
|
4 |
+
id = 'output_preview_csv';
|
5 |
+
}
|
6 |
+
if ( woe_is_object_format( output_format ) ) {
|
7 |
+
jQuery( '#' + id ).text( response );
|
8 |
+
}
|
9 |
+
else {
|
10 |
+
jQuery( '#' + id ).html( response );
|
11 |
+
}
|
12 |
+
jQuery( '#' + id ).show();
|
13 |
+
window.scrollTo( 0, document.body.scrollHeight );
|
14 |
+
}
|
15 |
+
|
16 |
+
function woe_preview( size ) {
|
17 |
+
|
18 |
+
jQuery( '#output_preview, #output_preview_csv' ).hide();
|
19 |
+
|
20 |
+
var data = 'json=' + woe_make_json_var( jQuery( '#export_job_settings' ) );
|
21 |
+
|
22 |
+
var estimate_data = data + "&action=order_exporter&method=estimate&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + settings_form.woe_nonce + '&tab=' + settings_form.woe_active_tab;
|
23 |
+
|
24 |
+
jQuery.post( ajaxurl, estimate_data, function ( response ) {
|
25 |
+
if ( ! response || typeof response.total == 'undefined' ) {
|
26 |
+
woe_show_error_message( response );
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
jQuery( '#output_preview_total' ).find( 'span' ).html( response.total );
|
30 |
+
jQuery( '#preview_actions' ).removeClass( 'hide' );
|
31 |
+
}, "json" ).fail( function ( xhr, textStatus, errorThrown ) {
|
32 |
+
woe_show_error_message( xhr.responseText );
|
33 |
+
} );
|
34 |
+
|
35 |
+
|
36 |
+
data = data + "&action=order_exporter&method=preview&limit=" + size + "&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + settings_form.woe_nonce + '&tab=' + settings_form.woe_active_tab;
|
37 |
+
|
38 |
+
jQuery.post( ajaxurl, data, woe_show_preview, "html" ).fail( function ( xhr, textStatus, errorThrown ) {
|
39 |
+
woe_show_preview( xhr.responseText );
|
40 |
+
} );
|
41 |
+
}
|
42 |
+
|
43 |
+
function woe_is_object_format( format ) {
|
44 |
+
return (
|
45 |
+
settings_form.object_formats.indexOf( format ) > - 1
|
46 |
+
);
|
47 |
+
}
|
48 |
+
|
49 |
+
// EXPORT FUNCTIONS
|
50 |
+
|
51 |
+
function woe_close_waiting_dialog() {
|
52 |
+
jQuery( "#background" ).removeClass( "loading" );
|
53 |
+
}
|
54 |
+
|
55 |
+
function woe_get_data() {
|
56 |
+
var data = new Array();
|
57 |
+
data.push( {name: 'json', value: woe_make_json( jQuery( '#export_job_settings' ) )} );
|
58 |
+
data.push( {name: 'action', value: 'order_exporter'} );
|
59 |
+
data.push( {name: 'mode', value: mode} );
|
60 |
+
data.push( {name: 'id', value: job_id} );
|
61 |
+
return data;
|
62 |
+
}
|
63 |
+
|
64 |
+
function woe_validate_export() {
|
65 |
+
|
66 |
+
if ( (
|
67 |
+
mode == settings_form.EXPORT_PROFILE
|
68 |
+
) && (
|
69 |
+
! jQuery( "[name='settings[title]']" ).val()
|
70 |
+
) ) {
|
71 |
+
alert( export_messages.empty_title );
|
72 |
+
jQuery( "[name='settings[title]']" ).focus();
|
73 |
+
return false;
|
74 |
+
}
|
75 |
+
|
76 |
+
if ( (
|
77 |
+
jQuery( "#from_date" ).val()
|
78 |
+
) && (
|
79 |
+
jQuery( "#to_date" ).val()
|
80 |
+
) ) {
|
81 |
+
var d1 = new Date( jQuery( "#from_date" ).val() );
|
82 |
+
var d2 = new Date( jQuery( "#to_date" ).val() );
|
83 |
+
if ( d1.getTime() > d2.getTime() ) {
|
84 |
+
alert( export_messages.wrong_date_range );
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
if ( jQuery( '#order_fields > li' ).length == 0 ) {
|
90 |
+
alert( export_messages.no_fields );
|
91 |
+
return false;
|
92 |
+
}
|
93 |
+
|
94 |
+
return true;
|
95 |
+
}
|
96 |
+
|
97 |
+
function woe_is_ipad_or_iphone() {
|
98 |
+
return navigator.platform.match( /i(Phone|Pad)/i )
|
99 |
+
}
|
100 |
+
|
101 |
+
function woe_waiting_dialog() {
|
102 |
+
|
103 |
+
jQuery( "#background" ).addClass( "loading" );
|
104 |
+
|
105 |
+
jQuery( '#wpbody-content' ).keydown( function ( event ) {
|
106 |
+
if ( event.keyCode == 27 ) {
|
107 |
+
if ( ! window.cancelling ) {
|
108 |
+
event.preventDefault();
|
109 |
+
window.cancelling = true;
|
110 |
+
|
111 |
+
jQuery.ajax( {
|
112 |
+
type: "post",
|
113 |
+
data: {
|
114 |
+
action: 'order_exporter',
|
115 |
+
method: 'cancel_export',
|
116 |
+
file_id: window.file_id,
|
117 |
+
},
|
118 |
+
cache: false,
|
119 |
+
url: ajaxurl,
|
120 |
+
dataType: "json",
|
121 |
+
error: function ( xhr, status, error ) {
|
122 |
+
alert( xhr.responseText );
|
123 |
+
woe_export_progress( 100, jQuery( '#progressBar' ) );
|
124 |
+
},
|
125 |
+
success: function ( response ) {
|
126 |
+
woe_export_progress( 100, jQuery( '#progressBar' ) );
|
127 |
+
}
|
128 |
+
} );
|
129 |
+
|
130 |
+
window.count = 0;
|
131 |
+
window.file_id = '';
|
132 |
+
jQuery( '#wpbody-content' ).off( 'keydown' );
|
133 |
+
}
|
134 |
+
return false;
|
135 |
+
}
|
136 |
+
} );
|
137 |
+
}
|
138 |
+
|
139 |
+
function woe_export_progress( percent, $element ) {
|
140 |
+
|
141 |
+
if ( percent == 0 ) {
|
142 |
+
$element.find( 'div' ).html( percent + "% " ).animate( {width: 0}, 0 );
|
143 |
+
woe_waiting_dialog();
|
144 |
+
jQuery( '#progress_div' ).show();
|
145 |
+
}
|
146 |
+
else {
|
147 |
+
var progressBarWidth = percent * $element.width() / 100;
|
148 |
+
$element.find( 'div' ).html( percent + "% " ).animate( {width: progressBarWidth}, 200 );
|
149 |
+
|
150 |
+
if ( percent >= 100 ) {
|
151 |
+
if ( ! woe_is_ipad_or_iphone() && ! ( output_format == 'HTML' && settings_form.settings.display_html_report_in_browser ) ) {
|
152 |
+
jQuery( '#progress_div' ).hide();
|
153 |
+
woe_close_waiting_dialog();
|
154 |
+
}
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
function woe_get_all( start, percent, method ) {
|
160 |
+
|
161 |
+
if ( window.cancelling ) {
|
162 |
+
return;
|
163 |
+
}
|
164 |
+
|
165 |
+
woe_export_progress( parseInt( percent, 10 ), jQuery( '#progressBar' ) );
|
166 |
+
|
167 |
+
if ( percent < 100 ) {
|
168 |
+
data = woe_get_data();
|
169 |
+
data.push( {name: 'method', value: method} );
|
170 |
+
data.push( {name: 'start', value: start} );
|
171 |
+
data.push( {name: 'file_id', value: window.file_id} );
|
172 |
+
data.push( {name: 'woe_nonce', value: settings_form.woe_nonce} );
|
173 |
+
data.push( {name: 'tab', value: settings_form.woe_active_tab} );
|
174 |
+
|
175 |
+
jQuery.ajax( {
|
176 |
+
type: "post",
|
177 |
+
data: data,
|
178 |
+
cache: false,
|
179 |
+
url: ajaxurl,
|
180 |
+
dataType: "json",
|
181 |
+
error: function ( xhr, status, error ) {
|
182 |
+
woe_show_error_message( xhr.responseText );
|
183 |
+
woe_export_progress( 100, jQuery( '#progressBar' ) );
|
184 |
+
},
|
185 |
+
success: function ( response ) {
|
186 |
+
if ( ! response ) {
|
187 |
+
woe_show_error_message( response );
|
188 |
+
} else if ( typeof response.error !== 'undefined' ) {
|
189 |
+
woe_show_error_message( response.error );
|
190 |
+
} else {
|
191 |
+
woe_get_all( response.start, (
|
192 |
+
response.start / window.count
|
193 |
+
) * 100, method )
|
194 |
+
}
|
195 |
+
}
|
196 |
+
} );
|
197 |
+
}
|
198 |
+
else {
|
199 |
+
data = woe_get_data();
|
200 |
+
data.push( {name: 'method', value: 'export_finish'} );
|
201 |
+
data.push( {name: 'file_id', value: window.file_id} );
|
202 |
+
data.push( {name: 'woe_nonce', value: settings_form.woe_nonce} );
|
203 |
+
data.push( {name: 'tab', value: settings_form.woe_active_tab} );
|
204 |
+
jQuery.ajax( {
|
205 |
+
type: "post",
|
206 |
+
data: data,
|
207 |
+
cache: false,
|
208 |
+
url: ajaxurl,
|
209 |
+
dataType: "json",
|
210 |
+
error: function ( xhr, status, error ) {
|
211 |
+
alert( xhr.responseText );
|
212 |
+
},
|
213 |
+
success: function ( response ) {
|
214 |
+
var download_format = output_format;
|
215 |
+
if ( output_format == 'XLS' && ! jQuery( '#format_xls_use_xls_format' ).prop( 'checked' ) ) {
|
216 |
+
download_format = 'XLSX';
|
217 |
+
}
|
218 |
+
|
219 |
+
if ( woe_is_ipad_or_iphone() || ( output_format == 'HTML' && settings_form.settings.display_html_report_in_browser ) ) {
|
220 |
+
|
221 |
+
$( '#progress_div .title-download a' ).attr( 'href', ajaxurl + (
|
222 |
+
ajaxurl.indexOf( '?' ) === - 1 ? '?' : '&'
|
223 |
+
) + 'action=order_exporter&method=export_download&format=' + download_format + '&file_id=' + window.file_id + '&tab=' + settings_form.woe_active_tab );
|
224 |
+
jQuery( '#progress_div .title-download' ).show();
|
225 |
+
jQuery( '#progress_div .title-cancel' ).hide();
|
226 |
+
jQuery( '#progressBar' ).hide();
|
227 |
+
} else {
|
228 |
+
jQuery( '#export_new_window_frame' ).attr( "src", ajaxurl + (
|
229 |
+
ajaxurl.indexOf( '?' ) === - 1 ? '?' : '&'
|
230 |
+
) + 'action=order_exporter&method=export_download&format=' + download_format + '&file_id=' + window.file_id + '&tab=' + settings_form.woe_active_tab );
|
231 |
+
}
|
232 |
+
|
233 |
+
woe_reset_date_filter_for_cron();
|
234 |
+
}
|
235 |
+
} );
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
jQuery( document ).ready( function ( $ ) {
|
240 |
+
|
241 |
+
$( ".preview-btn" ).click( function () {
|
242 |
+
woe_preview( jQuery( this ).attr( 'data-limit' ) );
|
243 |
+
return false;
|
244 |
+
} );
|
245 |
+
|
246 |
+
$( "#export-btn, #my-quick-export-btn" ).click( function () {
|
247 |
+
|
248 |
+
window.cancelling = false;
|
249 |
+
|
250 |
+
data = woe_get_data();
|
251 |
+
|
252 |
+
data.push( {name: 'method', value: 'export_start'} );
|
253 |
+
data.push( {name: 'woe_nonce', value: settings_form.woe_nonce} );
|
254 |
+
data.push( {name: 'tab', value: settings_form.woe_active_tab} );
|
255 |
+
|
256 |
+
if ( (
|
257 |
+
$( "#from_date" ).val()
|
258 |
+
) && (
|
259 |
+
$( "#to_date" ).val()
|
260 |
+
) ) {
|
261 |
+
var d1 = new Date( $( "#from_date" ).val() );
|
262 |
+
var d2 = new Date( $( "#to_date" ).val() );
|
263 |
+
if ( d1.getTime() > d2.getTime() ) {
|
264 |
+
alert( export_messages.wrong_date_range );
|
265 |
+
return false;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
if ( $( '#order_fields > li' ).length == 0 ) {
|
270 |
+
alert( export_messages.no_fields );
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
|
274 |
+
jQuery.ajax( {
|
275 |
+
type: "post",
|
276 |
+
data: data,
|
277 |
+
cache: false,
|
278 |
+
url: ajaxurl,
|
279 |
+
dataType: "json",
|
280 |
+
error: function ( xhr, status, error ) {
|
281 |
+
woe_show_error_message( xhr.responseText.replace( /<\/?[^>]+(>|$)/g, "" ) );
|
282 |
+
},
|
283 |
+
success: function ( response ) {
|
284 |
+
if ( ! response || typeof response['total'] == 'undefined' ) {
|
285 |
+
woe_show_error_message( response );
|
286 |
+
return;
|
287 |
+
}
|
288 |
+
window.count = response['total'];
|
289 |
+
window.file_id = response['file_id'];
|
290 |
+
console.log( window.count );
|
291 |
+
|
292 |
+
if ( window.count > 0 ) {
|
293 |
+
woe_get_all( 0, 0, 'export_part' );
|
294 |
+
} else {
|
295 |
+
alert( export_messages.no_results );
|
296 |
+
woe_reset_date_filter_for_cron();
|
297 |
+
}
|
298 |
+
}
|
299 |
+
} );
|
300 |
+
|
301 |
+
return false;
|
302 |
+
} );
|
303 |
+
|
304 |
+
$( "#export-wo-pb-btn" ).click( function () {
|
305 |
+
$( '#export_wo_pb_form' ).attr( "action", ajaxurl );
|
306 |
+
$( '#export_wo_pb_form' ).find( '[name=json]' ).val( woe_make_json( $( '#export_job_settings' ) ) );
|
307 |
+
$( '#export_wo_pb_form' ).submit();
|
308 |
+
return false;
|
309 |
+
} );
|
310 |
+
|
311 |
+
$( "#reset-profile" ).click( function () {
|
312 |
+
if ( confirm( localize_settings_form.reset_profile_confirm ) ) {
|
313 |
+
var data = "action=order_exporter&method=reset_profile&mode=" + mode + "&id=" + '&woe_nonce=' + settings_form.woe_nonce + '&tab=' + settings_form.woe_active_tab;
|
314 |
+
$.post( ajaxurl, data, function ( response ) {
|
315 |
+
if ( response.success ) {
|
316 |
+
document.location.reload();
|
317 |
+
}
|
318 |
+
}, "json" );
|
319 |
+
}
|
320 |
+
|
321 |
+
return false;
|
322 |
+
} );
|
323 |
+
|
324 |
+
$( "#save-only-btn" ).click( function () {
|
325 |
+
|
326 |
+
if ( ! woe_validate_export() ) {
|
327 |
+
return false;
|
328 |
+
}
|
329 |
+
|
330 |
+
woe_set_form_submitting();
|
331 |
+
|
332 |
+
var data = 'json=' + woe_make_json_var( $( '#export_job_settings' ) )
|
333 |
+
data = data + "&action=order_exporter&method=save_settings&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + settings_form.woe_nonce + '&tab=' + settings_form.woe_active_tab;
|
334 |
+
|
335 |
+
$( '#Settings_updated' ).hide();
|
336 |
+
|
337 |
+
$.post( ajaxurl, data, function ( response ) {
|
338 |
+
$( '#Settings_updated' ).show().delay( 5000 ).fadeOut();
|
339 |
+
}, "json" );
|
340 |
+
|
341 |
+
return false;
|
342 |
+
} );
|
343 |
+
|
344 |
+
$( "#save-btn" ).click( function () {
|
345 |
+
|
346 |
+
if ( ! woe_validate_export() ) {
|
347 |
+
return false;
|
348 |
+
}
|
349 |
+
|
350 |
+
woe_set_form_submitting();
|
351 |
+
|
352 |
+
var data = 'json=' + woe_make_json_var( $( '#export_job_settings' ) )
|
353 |
+
|
354 |
+
data = data + "&action=order_exporter&method=save_settings&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + settings_form.woe_nonce + '&tab=' + settings_form.woe_active_tab;
|
355 |
+
|
356 |
+
$.post( ajaxurl, data, function ( response ) {
|
357 |
+
document.location = settings_form.save_settings_url;
|
358 |
+
}, "json" );
|
359 |
+
|
360 |
+
return false;
|
361 |
+
} );
|
362 |
+
|
363 |
+
$( '#progress_div .title-download' ).click( function () {
|
364 |
+
$( '#progress_div .title-download' ).hide();
|
365 |
+
$( '#progress_div .title-cancel' ).show();
|
366 |
+
$( '#progressBar' ).show();
|
367 |
+
jQuery( '#progress_div' ).hide();
|
368 |
+
woe_close_waiting_dialog();
|
369 |
+
} );
|
370 |
+
|
371 |
+
} );
|
assets/js/export-fields.js
ADDED
@@ -0,0 +1,1368 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function woe_create_selected_fields( old_output_format, format, format_changed ) {
|
2 |
+
|
3 |
+
var $old_format_order_fields = jQuery( "#order_fields" ).clone();
|
4 |
+
|
5 |
+
setTimeout( function () {
|
6 |
+
woe_create_unselected_fields( old_output_format, format, format_changed, $old_format_order_fields );
|
7 |
+
}, 0 );
|
8 |
+
|
9 |
+
//jQuery( '#export_job_settings' ).prepend( jQuery( "#fields_control_products" ) );
|
10 |
+
//jQuery( '#export_job_settings' ).prepend( jQuery( "#fields_control_coupons" ) );
|
11 |
+
|
12 |
+
jQuery( "#fields .fields-control-block" ).addClass( 'hidden' );
|
13 |
+
jQuery( "#order_fields" ).addClass( 'non_flat_height' );
|
14 |
+
|
15 |
+
/*
|
16 |
+
Clone elements for using in create_modal_fields ($old_format_order_fields) and
|
17 |
+
before insert fields in 'order_fields' element ($old_format_modal_content) for
|
18 |
+
able to migrate checkbox values from pop up to 'order_fields' element and vice versa
|
19 |
+
*/
|
20 |
+
|
21 |
+
var html = '';
|
22 |
+
var fields_control_block_elements = [];
|
23 |
+
|
24 |
+
if ( woe_is_flat_format( format ) ) {
|
25 |
+
fields_control_block_elements.push( woe_make_repeat_options( 'products' ) );
|
26 |
+
fields_control_block_elements.push( woe_make_repeat_options( 'coupons' ) );
|
27 |
+
}
|
28 |
+
|
29 |
+
jQuery.each( window['selected_order_fields'], function ( i, value ) {
|
30 |
+
|
31 |
+
var index = value.key;
|
32 |
+
var colname = value.colname;
|
33 |
+
|
34 |
+
colname = woe_escape_str( colname );
|
35 |
+
value.label = woe_escape_str( value.label );
|
36 |
+
index = woe_escape_str( index );
|
37 |
+
value.value = woe_escape_str( value.value );
|
38 |
+
|
39 |
+
if ( format_changed ) {
|
40 |
+
if ( woe_is_flat_format( format ) ) {
|
41 |
+
colname = value.label;
|
42 |
+
} else if ( woe_is_xml_format( format ) ) {
|
43 |
+
colname = woe_to_xml_tags( index );
|
44 |
+
} else {
|
45 |
+
colname = index;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( index == 'products' || index == 'coupons' ) {
|
50 |
+
|
51 |
+
var row = '';
|
52 |
+
|
53 |
+
jQuery( "#fields_control .segment_" + index ).remove();
|
54 |
+
|
55 |
+
if ( ! woe_is_flat_format( format ) ) {
|
56 |
+
// TODO fix segment names for product and coupon fields
|
57 |
+
row = '<li class="mapping_row segment_' + value.segment + 's' + ' flat-' + index + '-group" style="display: none">\
|
58 |
+
<div class="mapping_col_1" style="width: 10px">\
|
59 |
+
<input type=hidden name="orders[][segment]" value="' + value.segment + '">\
|
60 |
+
<input type=hidden name="orders[][key]" value="' + index + '">\
|
61 |
+
<input type=hidden name="orders[][label]" value="' + value.label + '">\
|
62 |
+
<input type=hidden name="orders[][format]" value="' + value.format + '">\
|
63 |
+
</div>\
|
64 |
+
<div class="mapping_col_2">' + value.label + '</div>\
|
65 |
+
<div class="mapping_col_3">';
|
66 |
+
row += '<div class="segment_' + index + '">';
|
67 |
+
row += '<input class="mapping_fieldname" type=input name="orders[][colname]" value="' + colname + '">';
|
68 |
+
row += '</div>';
|
69 |
+
row += '</div>';
|
70 |
+
row += '<ul id="sortable_' + index + '">' + woe_create_group_fields( format, index, format_changed, old_output_format, $old_format_order_fields ) + '</ul>';
|
71 |
+
row += '</li>';
|
72 |
+
} else {
|
73 |
+
row = '<div class="hide flat-' + index + '-group">';
|
74 |
+
row += '<input type=hidden name="orders[][segment]" value="' + value.segment + '">';
|
75 |
+
row += '<input type=hidden name="orders[][key]" value="' + index + '">';
|
76 |
+
row += '<input class="mapping_fieldname" type=hidden name="orders[][colname]" value="' + colname + '">';
|
77 |
+
row += '<input type=hidden name="orders[][label]" value="' + value.label + '">';
|
78 |
+
row += '<input type=hidden name="orders[][format]" value="' + value.format + '"></div>';
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
}
|
83 |
+
else {
|
84 |
+
|
85 |
+
if ( ! woe_is_flat_format( format ) && (
|
86 |
+
value.segment === "products" || value.segment === "coupons"
|
87 |
+
) ) {
|
88 |
+
return true;
|
89 |
+
}
|
90 |
+
|
91 |
+
var value_part = ''
|
92 |
+
var label_part = '';
|
93 |
+
var delete_btn = '<div class="mapping_col_3 mapping_row-delete_field_block"><a href="" class="mapping_row-delete_field"><span class="dashicons dashicons-trash"></span></a></div>';
|
94 |
+
var label_prefix = '';
|
95 |
+
var index_api = index;
|
96 |
+
|
97 |
+
if ( index.indexOf( 'static_field' ) >= 0 ) {
|
98 |
+
value_part = '<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="orders[][value]" value="' + value.value + '"></div>';
|
99 |
+
}
|
100 |
+
|
101 |
+
// label prefix for products and coupons
|
102 |
+
if ( woe_is_flat_format( format ) ) {
|
103 |
+
if ( value.segment === 'products' ) {
|
104 |
+
label_prefix = '[P] ';
|
105 |
+
index_api = index_api.replace( "plain_products_", "" );
|
106 |
+
}
|
107 |
+
if ( value.segment === 'coupons' ) {
|
108 |
+
label_prefix = '[C] ';
|
109 |
+
index_api = index_api.replace( "plain_coupons_", "" );
|
110 |
+
}
|
111 |
+
}
|
112 |
+
var row = '<li class="mapping_row segment_' + value.segment + '">\
|
113 |
+
<div class="mapping_col_1" style="width: 10px">\
|
114 |
+
<input type=hidden name="orders[][segment]" value="' + value.segment + '">\
|
115 |
+
<input type=hidden name="orders[][key]" value="' + index + '">\
|
116 |
+
<input type=hidden name="orders[][label]" value="' + value.label + '">\
|
117 |
+
<input type=hidden name="orders[][format]" value="' + value.format + '">\
|
118 |
+
</div>\
|
119 |
+
<div class="mapping_col_2" title="' + index_api + '">' + '<span class="field-prefix">' + label_prefix + '</span>' + value.label + label_part + '</div>\
|
120 |
+
<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="orders[][colname]" value="' + colname + '"></div> ' + value_part + delete_btn + '\
|
121 |
+
</li>\
|
122 |
+
';
|
123 |
+
}
|
124 |
+
|
125 |
+
html += row;
|
126 |
+
|
127 |
+
} );
|
128 |
+
|
129 |
+
jQuery( "#order_fields" ).html( html );
|
130 |
+
|
131 |
+
if ( ! jQuery( "#fields .fields-control-block" ).html() ) {
|
132 |
+
fields_control_block_elements.forEach( function ( currentValue ) {
|
133 |
+
jQuery( "#fields .fields-control-block" ).append( currentValue );
|
134 |
+
} );
|
135 |
+
}
|
136 |
+
|
137 |
+
if ( fields_control_block_elements.length > 0 ) {
|
138 |
+
jQuery( "#fields .fields-control-block" ).removeClass( 'hidden' );
|
139 |
+
jQuery( "#order_fields" ).removeClass( 'non_flat_height' );
|
140 |
+
}
|
141 |
+
|
142 |
+
woe_add_bind_for_custom_fields( 'products', output_format, jQuery( "#order_fields" ) );
|
143 |
+
woe_add_bind_for_custom_fields( 'coupons', output_format, jQuery( "#order_fields" ) );
|
144 |
+
|
145 |
+
jQuery( "#sortable_products" ).sortable();
|
146 |
+
jQuery( "#sortable_coupons" ).sortable();
|
147 |
+
|
148 |
+
woe_check_sortable_groups();
|
149 |
+
|
150 |
+
woe_moving_products_and_coupons_group_blocks_to_first_item( output_format );
|
151 |
+
}
|
152 |
+
|
153 |
+
function woe_create_group_fields( format, index_p, format_changed ) {
|
154 |
+
|
155 |
+
var html = '';
|
156 |
+
|
157 |
+
jQuery.each( window['selected_order_' + index_p + '_fields'], function ( i, value ) {
|
158 |
+
|
159 |
+
var index = value.key;
|
160 |
+
var colname = value.colname;
|
161 |
+
|
162 |
+
colname = woe_escape_str( colname );
|
163 |
+
value.label = woe_escape_str( value.label );
|
164 |
+
index = woe_escape_str( index );
|
165 |
+
value.value = woe_escape_str( value.value );
|
166 |
+
|
167 |
+
if ( format_changed ) {
|
168 |
+
if ( woe_is_flat_format( format ) ) {
|
169 |
+
colname = value.label;
|
170 |
+
} else {
|
171 |
+
colname = index.replace( 'plain_' + index_p + '_', '' );
|
172 |
+
if ( woe_is_xml_format( format ) ) {
|
173 |
+
colname = woe_to_xml_tags( colname );
|
174 |
+
}
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
var value_part = '';
|
179 |
+
var label_part = '';
|
180 |
+
var delete_btn = '<div class="mapping_col_3 mapping_row-delete_field_block"><a href="#" class="mapping_row-delete_field"><span class="dashicons dashicons-trash"></span></a></div>';
|
181 |
+
|
182 |
+
if ( index.indexOf( 'static_field' ) >= 0 ) {
|
183 |
+
value_part = '<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="' + index_p + '[][value]" value="' + value.value + '"></div>';
|
184 |
+
}
|
185 |
+
|
186 |
+
var row = '<li class="mapping_row segment_' + index_p + '">\
|
187 |
+
<div class="mapping_col_1" style="width: 10px">\
|
188 |
+
<input type=hidden name="' + index_p + '[][label]" value="' + value.label + '">\
|
189 |
+
<input type=hidden name="' + index_p + '[][key]" value="' + index + '">\
|
190 |
+
<input type=hidden name="' + index_p + '[][segment]" value="' + index_p + '">\
|
191 |
+
<input type=hidden name="' + index_p + '[][format]" value="' + value.format + '">\
|
192 |
+
</div>\
|
193 |
+
<div class="mapping_col_2" title="' + index + '">' + value.label + label_part + '</div>\
|
194 |
+
<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="' + index_p + '[][colname]" value="' + colname + '"></div> ' + value_part + delete_btn + '\
|
195 |
+
</li>\
|
196 |
+
';
|
197 |
+
|
198 |
+
html += row;
|
199 |
+
|
200 |
+
} );
|
201 |
+
|
202 |
+
return html;
|
203 |
+
}
|
204 |
+
|
205 |
+
function woe_moving_products_and_coupons_group_blocks_to_first_item( format ) {
|
206 |
+
|
207 |
+
if ( woe_is_flat_format( format ) ) {
|
208 |
+
|
209 |
+
var first_products_field = jQuery( '#order_fields [value*="plain_products_"]' ).first().closest( 'li' );
|
210 |
+
var first_coupons_field = jQuery( '#order_fields [value*="plain_coupons_"]' ).first().closest( 'li' );
|
211 |
+
|
212 |
+
if ( first_products_field.length ) {
|
213 |
+
var products_group_block = jQuery( '#order_fields .flat-products-group' ).clone();
|
214 |
+
jQuery( '#order_fields .flat-products-group' ).remove();
|
215 |
+
first_products_field.before( products_group_block );
|
216 |
+
}
|
217 |
+
|
218 |
+
if ( first_coupons_field.length ) {
|
219 |
+
var coupons_group_block = jQuery( '#order_fields .flat-coupons-group' ).clone();
|
220 |
+
jQuery( '#order_fields .flat-coupons-group' ).remove();
|
221 |
+
first_coupons_field.before( coupons_group_block );
|
222 |
+
}
|
223 |
+
|
224 |
+
return;
|
225 |
+
}
|
226 |
+
|
227 |
+
var first_products_field = jQuery( '#order_fields [name="products[][key]"]' ).first().closest( 'li' );
|
228 |
+
|
229 |
+
if ( ! jQuery( '#sortable_products > li' ).length && first_products_field.length ) {
|
230 |
+
var products_group_block = jQuery( '#order_fields .flat-products-group' ).clone();
|
231 |
+
jQuery( '#order_fields .flat-products-group' ).remove();
|
232 |
+
first_products_field.before( products_group_block );
|
233 |
+
}
|
234 |
+
|
235 |
+
var first_coupons_field = jQuery( '#order_fields [name="coupons[][key]"]' ).first().closest( 'li' );
|
236 |
+
|
237 |
+
if ( ! jQuery( '#sortable_coupons > li' ).length && first_coupons_field.length ) {
|
238 |
+
var coupons_group_block = jQuery( '#order_fields .flat-coupons-group' ).clone();
|
239 |
+
jQuery( '#order_fields .flat-coupons-group' ).remove();
|
240 |
+
first_coupons_field.before( coupons_group_block );
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
function woe_synch_selected_fields( old_format, new_format ) {
|
245 |
+
|
246 |
+
var settings = jQuery( '#export_job_settings' ).serializeJSON();
|
247 |
+
|
248 |
+
if ( woe_is_flat_format( old_format ) && woe_is_flat_format( new_format ) ) {
|
249 |
+
window['selected_order_fields'] = settings.orders || [];
|
250 |
+
window['selected_order_products_fields'] = [];
|
251 |
+
window['selected_order_coupons_fields'] = [];
|
252 |
+
return;
|
253 |
+
}
|
254 |
+
|
255 |
+
if ( ! woe_is_flat_format( old_format ) && ! woe_is_flat_format( new_format ) ) {
|
256 |
+
window['selected_order_fields'] = settings.orders || [];
|
257 |
+
window['selected_order_products_fields'] = settings.products || [];
|
258 |
+
window['selected_order_coupons_fields'] = settings.coupons || [];
|
259 |
+
return;
|
260 |
+
}
|
261 |
+
|
262 |
+
if ( woe_is_flat_format( old_format ) && ! woe_is_flat_format( new_format ) ) {
|
263 |
+
|
264 |
+
var products = [];
|
265 |
+
var coupons = [];
|
266 |
+
var orders = [];
|
267 |
+
|
268 |
+
(
|
269 |
+
settings.orders || []
|
270 |
+
).forEach( function ( item ) {
|
271 |
+
|
272 |
+
if ( item.key.indexOf( 'plain_products' ) > - 1 ) {
|
273 |
+
item.key = item.key.replace( 'plain_products_', '' );
|
274 |
+
products.push( item );
|
275 |
+
return true;
|
276 |
+
}
|
277 |
+
|
278 |
+
if ( item.key.indexOf( 'plain_coupons' ) > - 1 ) {
|
279 |
+
item.key = item.key.replace( 'plain_coupons_', '' );
|
280 |
+
coupons.push( item );
|
281 |
+
return true;
|
282 |
+
}
|
283 |
+
|
284 |
+
orders.push( item );
|
285 |
+
} );
|
286 |
+
|
287 |
+
window['selected_order_fields'] = orders;
|
288 |
+
window['selected_order_products_fields'] = products;
|
289 |
+
window['selected_order_coupons_fields'] = coupons;
|
290 |
+
|
291 |
+
return;
|
292 |
+
}
|
293 |
+
|
294 |
+
if ( ! woe_is_flat_format( old_format ) && woe_is_flat_format( new_format ) ) {
|
295 |
+
|
296 |
+
var products = [];
|
297 |
+
var coupons = [];
|
298 |
+
var orders = [];
|
299 |
+
|
300 |
+
(
|
301 |
+
settings.products || []
|
302 |
+
).forEach( function ( item ) {
|
303 |
+
item.key = 'plain_products_' + item.key;
|
304 |
+
products.push( item );
|
305 |
+
} );
|
306 |
+
|
307 |
+
(
|
308 |
+
settings.coupons || []
|
309 |
+
).forEach( function ( item ) {
|
310 |
+
item.key = 'plain_coupons_' + item.key;
|
311 |
+
coupons.push( item );
|
312 |
+
} );
|
313 |
+
|
314 |
+
(
|
315 |
+
settings.orders || []
|
316 |
+
).forEach( function ( item ) {
|
317 |
+
|
318 |
+
orders.push( item );
|
319 |
+
|
320 |
+
if ( item.key === 'products' ) {
|
321 |
+
orders = orders.concat( products );
|
322 |
+
}
|
323 |
+
|
324 |
+
if ( item.key === 'coupons' ) {
|
325 |
+
orders = orders.concat( coupons );
|
326 |
+
}
|
327 |
+
} );
|
328 |
+
|
329 |
+
window['selected_order_fields'] = orders;
|
330 |
+
window['selected_order_products_fields'] = [];
|
331 |
+
window['selected_order_coupons_fields'] = [];
|
332 |
+
|
333 |
+
return;
|
334 |
+
}
|
335 |
+
|
336 |
+
}
|
337 |
+
|
338 |
+
function woe_create_unselected_fields( old_output_format, format, format_changed, old_format_order_fields ) {
|
339 |
+
|
340 |
+
var $unselected_fields_list = jQuery( '#unselected_fields_list' );
|
341 |
+
|
342 |
+
var $unselected_segment_id = '%s_unselected_segment';
|
343 |
+
|
344 |
+
var active_segment_id = $unselected_fields_list.find( '.section.active' ).attr( 'id' );
|
345 |
+
|
346 |
+
$unselected_fields_list.html( "" );
|
347 |
+
$unselected_fields_list.append( woe_make_segments( $unselected_segment_id ) );
|
348 |
+
|
349 |
+
if ( active_segment_id ) {
|
350 |
+
jQuery( '#unselected_fields_list #' + active_segment_id ).addClass( 'active' );
|
351 |
+
}
|
352 |
+
|
353 |
+
jQuery.each( window['all_fields'], function ( segment, fields ) {
|
354 |
+
|
355 |
+
fields.forEach( function ( value ) {
|
356 |
+
|
357 |
+
var $unselected_field_segment = jQuery( '#' + woe_sprintf( $unselected_segment_id, segment ) );
|
358 |
+
var index = value.key;
|
359 |
+
|
360 |
+
$unselected_field_segment.append(
|
361 |
+
woe_make_unselected_field( index, value, format, format_changed, segment )
|
362 |
+
);
|
363 |
+
|
364 |
+
woe_activate_draggable_field(
|
365 |
+
$unselected_field_segment.find( '.segment_field' ),
|
366 |
+
segment,
|
367 |
+
format
|
368 |
+
);
|
369 |
+
} )
|
370 |
+
|
371 |
+
} );
|
372 |
+
}
|
373 |
+
|
374 |
+
function woe_make_segments( $segment_id ) {
|
375 |
+
|
376 |
+
var $segments_list = jQuery( '<ul></ul>' );
|
377 |
+
|
378 |
+
jQuery.each( window['order_segments'], function ( index, label ) {
|
379 |
+
var $segment = jQuery( '<div id="' + woe_sprintf( $segment_id, index ) + '" class="section settings-segment"></div>' )
|
380 |
+
$segments_list.append( $segment );
|
381 |
+
} );
|
382 |
+
|
383 |
+
return $segments_list;
|
384 |
+
}
|
385 |
+
|
386 |
+
function woe_sprintf( format ) {
|
387 |
+
for ( var i = 1; i < arguments.length; i ++ ) {
|
388 |
+
format = format.replace( /%s/, arguments[i] );
|
389 |
+
}
|
390 |
+
return format;
|
391 |
+
}
|
392 |
+
|
393 |
+
function woe_make_unselected_field( $index, $field_data, $format, $format_changed, $segment ) {
|
394 |
+
|
395 |
+
var label_part = '';
|
396 |
+
var label_prefix = '';
|
397 |
+
var value_part = '';
|
398 |
+
|
399 |
+
var $mapping_col_1 = jQuery( '<div class="mapping_col_1" style="width: 10px"></div>' );
|
400 |
+
|
401 |
+
var $mapping_col_2 = jQuery( '<div class="mapping_col_2" title="' + woe_escape_str( $index ) + '"></div>' );
|
402 |
+
var $mapping_col_3 = jQuery( '<div class="mapping_col_3"></div>' );
|
403 |
+
|
404 |
+
var colname = woe_escape_str( $field_data.colname );
|
405 |
+
|
406 |
+
var _index = $index;
|
407 |
+
|
408 |
+
if ( woe_is_flat_format( $format ) && ['products', 'coupons'].indexOf( $segment ) > - 1 ) {
|
409 |
+
_index = 'plain_' + $segment + '_' + $index;
|
410 |
+
}
|
411 |
+
|
412 |
+
if ( $format_changed ) {
|
413 |
+
if ( woe_is_flat_format( $format ) ) {
|
414 |
+
colname = $field_data.label;
|
415 |
+
} else {
|
416 |
+
|
417 |
+
colname = $index;
|
418 |
+
|
419 |
+
if ( woe_is_xml_format( $format ) ) {
|
420 |
+
colname = woe_to_xml_tags( colname );
|
421 |
+
}
|
422 |
+
}
|
423 |
+
}
|
424 |
+
|
425 |
+
if ( ! woe_is_flat_format( $format ) && ['products', 'coupons'].indexOf( $segment ) > - 1 ) {
|
426 |
+
|
427 |
+
$mapping_col_1
|
428 |
+
.append( woe_make_input( 'hidden', null, $segment + '[][label]', $field_data.label, false ) )
|
429 |
+
.append( woe_make_input( 'hidden', null, $segment + '[][format]', $field_data.format, false ) )
|
430 |
+
.append( woe_make_input( 'hidden', null, $segment + '[][segment]', $segment, false ) )
|
431 |
+
.append( woe_make_input( 'hidden', null, $segment + '[][key]', $index, false ) );
|
432 |
+
|
433 |
+
$mapping_col_3.append( woe_make_input( 'input', 'mapping_fieldname', $segment + '[][colname]', colname ) );
|
434 |
+
|
435 |
+
if ( $index.indexOf( 'static_field' ) >= 0 ) {
|
436 |
+
value_part = '<div class="mapping_col_3 custom-field-value"><input class="mapping_fieldname" type=input name="' + $segment + '[][value]" value="' + $field_data.value + '"></div>';
|
437 |
+
}
|
438 |
+
|
439 |
+
} else {
|
440 |
+
|
441 |
+
if ( $segment === 'products' ) {
|
442 |
+
label_prefix = '[P] '
|
443 |
+
}
|
444 |
+
|
445 |
+
if ( $segment === 'coupons' ) {
|
446 |
+
label_prefix = '[C] '
|
447 |
+
}
|
448 |
+
|
449 |
+
$mapping_col_1
|
450 |
+
.append( woe_make_input( 'hidden', null, 'orders[][segment]', $segment, false ) )
|
451 |
+
.append( woe_make_input( 'hidden', null, 'orders[][key]', _index, false ) )
|
452 |
+
.append( woe_make_input( 'hidden', null, 'orders[][label]', $field_data.label, false ) )
|
453 |
+
.append( woe_make_input( 'hidden', null, 'orders[][format]', $field_data.format, false ) );
|
454 |
+
|
455 |
+
$mapping_col_3.append( woe_make_input( 'input', 'mapping_fieldname', 'orders[][colname]', colname ) );
|
456 |
+
|
457 |
+
if ( $index.indexOf( 'static_field' ) >= 0 ) {
|
458 |
+
value_part = '<div class="mapping_col_3 custom-field-value"><input class="mapping_fieldname" type=input name="' + 'orders[][value]" value="' + $field_data.value + '"></div>';
|
459 |
+
}
|
460 |
+
|
461 |
+
}
|
462 |
+
var delete_btn = '<div class="mapping_col_3 mapping_row-delete_field_block"><a href="#" class="mapping_row-delete_field"><span class="dashicons dashicons-trash"></span></a></div>';
|
463 |
+
|
464 |
+
$mapping_col_2.append( '<span class="field-prefix">' + label_prefix + '</span>' + $field_data.label + label_part );
|
465 |
+
|
466 |
+
if ( $index.charAt( 0 ) === '_' || $index.substr( 0, 3 ) === 'pa_' || ! $field_data.default || $index.indexOf( 'static_field' ) > - 1 ) {
|
467 |
+
$mapping_col_2.append( '<a href="#" onclick="return woe_remove_custom_field(this);" class="mapping_row-delete_custom_field" style="float: right;"><span class="ui-icon ui-icon-trash"></span></a>' );
|
468 |
+
}
|
469 |
+
|
470 |
+
var $field = jQuery( '<li class="mapping_row segment_field segment_' + $segment + '"></li>' );
|
471 |
+
|
472 |
+
$field
|
473 |
+
.append( $mapping_col_1 )
|
474 |
+
.append( $mapping_col_2 )
|
475 |
+
.append( $mapping_col_3 )
|
476 |
+
.append( value_part )
|
477 |
+
.append( delete_btn );
|
478 |
+
|
479 |
+
$field.find( 'input' ).prop( 'disabled', 'disabled' );
|
480 |
+
|
481 |
+
return $field;
|
482 |
+
}
|
483 |
+
|
484 |
+
function woe_activate_draggable_field( el, segment, format ) {
|
485 |
+
|
486 |
+
var no_flat_sortable_selector = '#manage_fields #order_fields #sortable_' + segment;
|
487 |
+
var flat_sortable_selector = '#manage_fields #order_fields';
|
488 |
+
|
489 |
+
el.draggable( {
|
490 |
+
connectToSortable: [no_flat_sortable_selector, flat_sortable_selector].join( ',' ),
|
491 |
+
helper: "clone",
|
492 |
+
revert: "invalid",
|
493 |
+
start: function ( event, ui ) {
|
494 |
+
jQuery( ui.helper[0] ).removeClass( 'blink' );
|
495 |
+
},
|
496 |
+
stop: function ( event, ui ) {
|
497 |
+
el.removeClass( 'blink' );
|
498 |
+
|
499 |
+
var moved_to_sortable = jQuery( ui.helper[0] ).closest( flat_sortable_selector ).length;
|
500 |
+
var move_to_sortable_group = jQuery( ui.helper[0] ).closest( no_flat_sortable_selector ).length;
|
501 |
+
|
502 |
+
if ( ! moved_to_sortable ) {
|
503 |
+
return;
|
504 |
+
}
|
505 |
+
|
506 |
+
woe_moving_products_and_coupons_group_blocks_to_first_item( format );
|
507 |
+
|
508 |
+
// change static field key index to prevent fields with identical keys
|
509 |
+
var tmp_prefix = ['products', 'coupons'].indexOf( segment ) === - 1 ? '' : 'plain_' + segment + '_';
|
510 |
+
if ( jQuery( ui.helper[0] ).find( 'input[value*="' + tmp_prefix + 'static_field"]' ).length > 0 ) {
|
511 |
+
var suffix = 0;
|
512 |
+
jQuery( '#order_fields input[value*="' + tmp_prefix + 'static_field_"]' ).each( function () {
|
513 |
+
|
514 |
+
var match = jQuery( this ).attr( 'value' ).match( /.*static_field_(\d+)/ );
|
515 |
+
|
516 |
+
if ( ! match ) {
|
517 |
+
return true;
|
518 |
+
}
|
519 |
+
|
520 |
+
var n = parseInt( match[1] );
|
521 |
+
|
522 |
+
if ( n > suffix ) {
|
523 |
+
suffix = n;
|
524 |
+
}
|
525 |
+
} );
|
526 |
+
|
527 |
+
var field_key = tmp_prefix + 'static_field_' + (
|
528 |
+
suffix + 1
|
529 |
+
);
|
530 |
+
jQuery( ui.helper[0] ).find( 'input[name="orders[][key]"]' ).first().val( field_key );
|
531 |
+
}
|
532 |
+
// end change static field key
|
533 |
+
|
534 |
+
var moving_copy_original_el = jQuery( ui.helper[0] );
|
535 |
+
|
536 |
+
moving_copy_original_el
|
537 |
+
.attr( 'style', '' )
|
538 |
+
.addClass( 'ui-draggabled' )
|
539 |
+
.removeClass( 'segment_field' )
|
540 |
+
.find( 'input' ).prop( 'disabled', false );
|
541 |
+
|
542 |
+
|
543 |
+
if ( woe_is_flat_format( format ) || move_to_sortable_group || [
|
544 |
+
'products',
|
545 |
+
'coupons'
|
546 |
+
].indexOf( segment ) === - 1 ) {
|
547 |
+
return;
|
548 |
+
}
|
549 |
+
|
550 |
+
jQuery( no_flat_sortable_selector ).append( moving_copy_original_el.clone() );
|
551 |
+
|
552 |
+
moving_copy_original_el.remove();
|
553 |
+
|
554 |
+
woe_check_sortable_groups();
|
555 |
+
},
|
556 |
+
} );
|
557 |
+
|
558 |
+
}
|
559 |
+
|
560 |
+
function woe_check_sortable_groups() {
|
561 |
+
jQuery( '#sortable_products' ).closest( '.mapping_row' ).toggle( ! ! jQuery( '#sortable_products li' ).length );
|
562 |
+
jQuery( '#sortable_coupons' ).closest( '.mapping_row' ).toggle( ! ! jQuery( '#sortable_coupons li' ).length );
|
563 |
+
}
|
564 |
+
|
565 |
+
//for XML labels
|
566 |
+
function woe_to_xml_tags( str ) {
|
567 |
+
var arr = str.split( /_/ );
|
568 |
+
for ( var i = 0, l = arr.length; i < l; i ++ ) {
|
569 |
+
arr[i] = arr[i].substr( 0, 1 ).toUpperCase() + (
|
570 |
+
arr[i].length > 1 ? arr[i].substr( 1 ).toLowerCase() : ""
|
571 |
+
);
|
572 |
+
}
|
573 |
+
return arr.join( "_" );
|
574 |
+
}
|
575 |
+
|
576 |
+
function woe_make_repeat_options( index ) {
|
577 |
+
|
578 |
+
var repeat_select = jQuery( '<select name="duplicated_fields_settings[' + index + '][repeat]"></select>' );
|
579 |
+
var repeat_options_html = {};
|
580 |
+
|
581 |
+
jQuery.each( localize_settings_form.repeats, function ( key, currentValue ) {
|
582 |
+
repeat_select.append( '<option value="' + key + '">' + currentValue + '</option>' );
|
583 |
+
repeat_options_html[key] = [];
|
584 |
+
} );
|
585 |
+
|
586 |
+
var duplicate_settings = window.duplicated_fields_settings[index] || {};
|
587 |
+
var repeat_value = (
|
588 |
+
typeof(
|
589 |
+
duplicate_settings.repeat
|
590 |
+
) !== 'undefined'
|
591 |
+
) ? duplicate_settings.repeat : "rows";
|
592 |
+
repeat_select.val( repeat_value );
|
593 |
+
|
594 |
+
// rows options
|
595 |
+
if ( index === 'products' ) {
|
596 |
+
var populate_check_on = duplicate_settings.populate_other_columns === '1' ? 'checked' : '';
|
597 |
+
var populate_check_off = duplicate_settings.populate_other_columns === '1' ? '' : 'checked';
|
598 |
+
var populate_check_html = '<div class="">' +
|
599 |
+
'<label>' + localize_settings_form.js_tpl_popup.fill_order_columns_label + '</label>' +
|
600 |
+
'<label>' +
|
601 |
+
'<input type=radio name="duplicated_fields_settings[' + index + '][populate_other_columns]" value=1 ' + populate_check_on + ' >' +
|
602 |
+
localize_settings_form.js_tpl_popup.for_all_rows_label + '</label>' +
|
603 |
+
'<label>' +
|
604 |
+
'<input type=radio name="duplicated_fields_settings[' + index + '][populate_other_columns]" value=0 ' + populate_check_off + ' >' +
|
605 |
+
localize_settings_form.js_tpl_popup.for_first_row_only_label + '</label>' +
|
606 |
+
'</div>';
|
607 |
+
repeat_options_html['rows'].push( populate_check_html );
|
608 |
+
}
|
609 |
+
|
610 |
+
// columns options
|
611 |
+
var max_cols = (
|
612 |
+
typeof(
|
613 |
+
duplicate_settings.max_cols
|
614 |
+
) !== 'undefined'
|
615 |
+
) ? duplicate_settings.max_cols : "10";
|
616 |
+
|
617 |
+
var max_cols_html = '<div class="">' +
|
618 |
+
'<label>' + localize_settings_form.js_tpl_popup.add + '</label>' +
|
619 |
+
'<input type=text size=2 name="duplicated_fields_settings[' + index + '][max_cols]" value="' + max_cols + '"> ' +
|
620 |
+
'<label>' + localize_settings_form.repeats.columns + '</label>' +
|
621 |
+
'</div>';
|
622 |
+
|
623 |
+
var grouping_by_product_check = duplicate_settings.group_by === 'product' ? 'checked' : '';
|
624 |
+
var group_by_item_check_html = '<div class="">' +
|
625 |
+
'<input type="hidden" name="duplicated_fields_settings[' + index + '][group_by]" value="as_independent_columns" >' +
|
626 |
+
'<input type="checkbox" name="duplicated_fields_settings[' + index + '][group_by]" value="product" ' + grouping_by_product_check + '>' +
|
627 |
+
'<label>' + localize_settings_form.js_tpl_popup.grouping_by[index] + '</label>' +
|
628 |
+
'</div>';
|
629 |
+
repeat_options_html['columns'].push( max_cols_html );
|
630 |
+
repeat_options_html['columns'].push( group_by_item_check_html );
|
631 |
+
|
632 |
+
// inside one cell options
|
633 |
+
var line_delimiter = (
|
634 |
+
typeof(
|
635 |
+
duplicate_settings.line_delimiter
|
636 |
+
) !== 'undefined'
|
637 |
+
) ? duplicate_settings.line_delimiter : '\\n';
|
638 |
+
var line_delimiter_html = '<div class="">' +
|
639 |
+
'<label>' + localize_settings_form.js_tpl_popup.split_values_by +
|
640 |
+
'<input class="input-delimiter" type=text size=1 name="duplicated_fields_settings[' + index + '][line_delimiter]" value="' + line_delimiter + '">' +
|
641 |
+
'</label>' +
|
642 |
+
'</div>';
|
643 |
+
repeat_options_html['inside_one_cell'].push( line_delimiter_html );
|
644 |
+
|
645 |
+
var popup_options = jQuery( '<div class=""></div>' );
|
646 |
+
popup_options.append( jQuery( '<div class="segment-header">' + '<label>' + localize_settings_form.js_tpl_popup.add + ' ' + index + ' ' + localize_settings_form.js_tpl_popup.as + '</label>' + '</div>' ).append( repeat_select ) );
|
647 |
+
|
648 |
+
jQuery.each( repeat_options_html, function ( key, currentValue ) {
|
649 |
+
popup_options.append( jQuery( '<div class="display_as duplicate_' + key + '_options"></div>' ).append( currentValue ) );
|
650 |
+
} );
|
651 |
+
|
652 |
+
popup_options.append( "<hr>" );
|
653 |
+
|
654 |
+
repeat_select.off( 'change' ).on( 'change', function () {
|
655 |
+
jQuery( this ).parent().siblings( '.display_as' ).removeClass( 'active' );
|
656 |
+
jQuery( this ).parent().siblings( '.duplicate_' + this.value + '_options' ).addClass( 'active' );
|
657 |
+
} ).trigger( 'change' );
|
658 |
+
|
659 |
+
return popup_options;
|
660 |
+
}
|
661 |
+
|
662 |
+
function woe_remove_custom_field( item ) {
|
663 |
+
jQuery( item ).parent().parent().remove();
|
664 |
+
return false;
|
665 |
+
}
|
666 |
+
|
667 |
+
function woe_make_input( $type, $classes, $name, $field_data, $is_checked ) {
|
668 |
+
|
669 |
+
var $input = jQuery( '<input>' );
|
670 |
+
|
671 |
+
$input.prop( 'type', $type );
|
672 |
+
|
673 |
+
if ( $classes && jQuery.isArray( $classes ) ) {
|
674 |
+
$input.addClass( $classes.join( ' ' ) );
|
675 |
+
}
|
676 |
+
|
677 |
+
$input.prop( 'name', $name );
|
678 |
+
$input.attr( 'value', $field_data );
|
679 |
+
|
680 |
+
if ( $is_checked ) {
|
681 |
+
$input.prop( 'checked', 'checked' );
|
682 |
+
}
|
683 |
+
|
684 |
+
return $input;
|
685 |
+
}
|
686 |
+
|
687 |
+
function woe_is_xml_format( format ) {
|
688 |
+
return (
|
689 |
+
settings_form.xml_formats.indexOf( format ) > - 1
|
690 |
+
);
|
691 |
+
}
|
692 |
+
|
693 |
+
function woe_add_bind_for_custom_fields( prefix, output_format, $to ) {
|
694 |
+
jQuery( '#button_custom_field_' + prefix + '' ).off();
|
695 |
+
jQuery( '#button_custom_field_' + prefix + '' ).click( function () {
|
696 |
+
var colname = jQuery( '#colname_custom_field_' + prefix + '' ).val();
|
697 |
+
var value = jQuery( '#value_custom_field_' + prefix + '' ).val();
|
698 |
+
var format_field = jQuery( '#format_custom_field_' + prefix + '' ).val();
|
699 |
+
if ( ! colname ) {
|
700 |
+
alert( export_messages.empty_column_name );
|
701 |
+
jQuery( '#colname_custom_field_' + prefix + '' ).focus();
|
702 |
+
return false
|
703 |
+
}
|
704 |
+
if ( ! value && 'products' !== prefix ) {
|
705 |
+
alert( export_messages.empty_value );
|
706 |
+
jQuery( '#value_custom_field_' + prefix + '' ).focus();
|
707 |
+
return false
|
708 |
+
}
|
709 |
+
|
710 |
+
jQuery( '#colname_custom_field_' + prefix + '' ).val( "" );
|
711 |
+
|
712 |
+
jQuery( '#value_custom_field_' + prefix + '' ).val( "" );
|
713 |
+
jQuery( '#format_custom_field_' + prefix + '' ).val( "" );
|
714 |
+
|
715 |
+
var segment = jQuery( '.segment_choice.active' ).attr( 'data-segment' );
|
716 |
+
|
717 |
+
woe_add_custom_field( jQuery( "#" + segment + '_unselected_segment' ), prefix, output_format, colname, value, segment, format_field );
|
718 |
+
|
719 |
+
jQuery( this ).siblings( '.button-cancel' ).trigger( 'click' );
|
720 |
+
|
721 |
+
return false;
|
722 |
+
} );
|
723 |
+
|
724 |
+
jQuery( '#button_custom_meta_' + prefix + '' ).off();
|
725 |
+
jQuery( '#button_custom_meta_' + prefix + '' ).click( function () {
|
726 |
+
var prefix_items = 'order_items',
|
727 |
+
original_prefix = prefix,
|
728 |
+
prefix_items_select = jQuery( '#select_custom_meta_' + prefix_items + '' ),
|
729 |
+
prefix_product_select = jQuery( '#select_custom_meta_' + prefix + '' ),
|
730 |
+
prefix_product_text = jQuery( '#text_custom_meta_' + prefix + '' ),
|
731 |
+
prefix_items_text = jQuery( '#text_custom_meta_' + prefix_items + '' );
|
732 |
+
|
733 |
+
var type = (
|
734 |
+
prefix_items_select.val() ||
|
735 |
+
prefix_product_select.val() ||
|
736 |
+
prefix_product_text.val() ||
|
737 |
+
prefix_items_text.val()
|
738 |
+
) ? 'meta' : 'taxonomies';
|
739 |
+
|
740 |
+
if ( 'meta' === type ) {
|
741 |
+
original_prefix = prefix_product_select.val() || prefix_product_text.val() ? prefix : prefix_items;
|
742 |
+
} else {
|
743 |
+
original_prefix = prefix;
|
744 |
+
}
|
745 |
+
type = type + '_' + original_prefix;
|
746 |
+
var label = jQuery( '#select_custom_' + type + '' ).val();
|
747 |
+
var colname = jQuery( '#colname_custom_meta_' + prefix + '' ).val();
|
748 |
+
var field_format = jQuery( '#format_custom_meta_' + prefix + '' ).val();
|
749 |
+
|
750 |
+
if ( ! label ) //try custom text
|
751 |
+
{
|
752 |
+
label = jQuery( '#text_custom_' + type ).val();
|
753 |
+
}
|
754 |
+
|
755 |
+
if ( ! label ) {
|
756 |
+
alert( export_messages.empty_meta_key_and_taxonomy );
|
757 |
+
return false
|
758 |
+
}
|
759 |
+
if ( colname == undefined || colname == '' ) {
|
760 |
+
colname = label;
|
761 |
+
}
|
762 |
+
if ( ! colname ) {
|
763 |
+
alert( export_messages.empty_column_name );
|
764 |
+
return false
|
765 |
+
}
|
766 |
+
|
767 |
+
var segment = jQuery( '.segment_choice.active' ).attr( 'data-segment' );
|
768 |
+
|
769 |
+
woe_add_custom_meta( jQuery( "#" + segment + '_unselected_segment' ), prefix, output_format, label, colname, segment, field_format );
|
770 |
+
|
771 |
+
jQuery( this ).siblings( '.button-cancel' ).trigger( 'click' );
|
772 |
+
|
773 |
+
jQuery( '#select_custom_' + type + '' ).val( "" );
|
774 |
+
jQuery( '#colname_custom_meta_' + prefix + '' ).val( "" );
|
775 |
+
jQuery( '#format_custom_meta_' + prefix + '' ).val( "" );
|
776 |
+
return false;
|
777 |
+
} );
|
778 |
+
|
779 |
+
}
|
780 |
+
|
781 |
+
function woe_add_custom_field( to, index_p, format, colname, value, segment, format_field ) {
|
782 |
+
|
783 |
+
value = woe_escape_str( value );
|
784 |
+
colname = woe_escape_str( colname );
|
785 |
+
|
786 |
+
if ( woe_is_flat_format( format ) ) {
|
787 |
+
_index = 'plain_' + index_p + '_';
|
788 |
+
_index_p = 'orders[]';
|
789 |
+
} else {
|
790 |
+
_index = '';
|
791 |
+
_index_p = index_p + '[]';
|
792 |
+
}
|
793 |
+
|
794 |
+
var label_prefix = '';
|
795 |
+
|
796 |
+
if ( woe_is_flat_format( format ) ) {
|
797 |
+
|
798 |
+
if ( segment === 'products' ) {
|
799 |
+
label_prefix = '[P] '
|
800 |
+
}
|
801 |
+
|
802 |
+
if ( segment === 'coupons' ) {
|
803 |
+
label_prefix = '[C] '
|
804 |
+
}
|
805 |
+
}
|
806 |
+
|
807 |
+
var suffix = 0;
|
808 |
+
|
809 |
+
jQuery( '#unselected_fields input[value*="static_field_"]' ).each( function () {
|
810 |
+
|
811 |
+
var match = jQuery( this ).attr( 'value' ).match( /static_field_(\d+)/ );
|
812 |
+
|
813 |
+
if ( ! match ) {
|
814 |
+
return true;
|
815 |
+
}
|
816 |
+
|
817 |
+
var n = parseInt( match[1] );
|
818 |
+
|
819 |
+
if ( n > suffix ) {
|
820 |
+
suffix = n;
|
821 |
+
}
|
822 |
+
} );
|
823 |
+
|
824 |
+
var field_key = 'static_field_' + (
|
825 |
+
suffix + 1
|
826 |
+
);
|
827 |
+
|
828 |
+
var delete_btn = '<div class="mapping_col_3 mapping_row-delete_field_block"><a href="#" class="mapping_row-delete_field"><span class="dashicons dashicons-trash"></span></a></div>';
|
829 |
+
|
830 |
+
// console.log( to, index_p, format, colname, value );
|
831 |
+
var row = jQuery( '<li class="mapping_row segment_field segment_' + segment + '">\
|
832 |
+
<div class="mapping_col_1" style="width: 10px">\
|
833 |
+
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[segment]" value="' + (
|
834 |
+
segment ? segment : 'misc'
|
835 |
+
) + '">\
|
836 |
+
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[key]" value="' + _index + field_key + '">\
|
837 |
+
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[label]" value="' + colname + '">\
|
838 |
+
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[format]" value="' + format_field + '">\
|
839 |
+
</div>\
|
840 |
+
<div class="mapping_col_2" title="' + field_key + '">' + '<span class="field-prefix">' + label_prefix + '</span>' + colname + '<a href="#" onclick="return woe_remove_custom_field(this);" class="mapping_row-delete_custom_field" style="float: right;"><span class="ui-icon ui-icon-trash"></span></a></div>\
|
841 |
+
<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="' + _index_p + '[colname]" value="' + colname + '"></div>\
|
842 |
+
<div class="mapping_col_3 custom-field-value"><input class="mapping_fieldname" type=input name="' + _index_p + '[value]" value="' + value + '"></div>' + delete_btn + '\
|
843 |
+
</li>\
|
844 |
+
' );
|
845 |
+
|
846 |
+
row.find( 'input' ).prop( 'disabled', 'disabled' );
|
847 |
+
|
848 |
+
to.prepend( row );
|
849 |
+
|
850 |
+
woe_activate_draggable_field(
|
851 |
+
to.find( '.segment_field' ).first(),
|
852 |
+
segment,
|
853 |
+
format
|
854 |
+
);
|
855 |
+
|
856 |
+
to.find( '.segment_field' ).first().addClass( 'blink' );
|
857 |
+
|
858 |
+
var field = {
|
859 |
+
key: field_key,
|
860 |
+
colname: colname,
|
861 |
+
'default': 0,
|
862 |
+
label: colname,
|
863 |
+
format: 'string',
|
864 |
+
value: value,
|
865 |
+
};
|
866 |
+
|
867 |
+
window.all_fields[segment].unshift( field );
|
868 |
+
}
|
869 |
+
|
870 |
+
function woe_add_custom_meta( to, index_p, format, label, colname, segment, format_field ) {
|
871 |
+
|
872 |
+
label = woe_escape_str( label );
|
873 |
+
colname = woe_escape_str( colname );
|
874 |
+
|
875 |
+
if ( woe_is_flat_format( format ) ) {
|
876 |
+
_index = 'plain_' + index_p + '_' + label;
|
877 |
+
_index_p = 'orders[]';
|
878 |
+
} else {
|
879 |
+
_index = label;
|
880 |
+
_index_p = index_p + '[]';
|
881 |
+
}
|
882 |
+
|
883 |
+
var label_prefix = '';
|
884 |
+
|
885 |
+
if ( woe_is_flat_format( format ) ) {
|
886 |
+
|
887 |
+
if ( segment === 'products' ) {
|
888 |
+
label_prefix = '[P] '
|
889 |
+
}
|
890 |
+
|
891 |
+
if ( segment === 'coupons' ) {
|
892 |
+
label_prefix = '[C] '
|
893 |
+
}
|
894 |
+
}
|
895 |
+
|
896 |
+
var delete_btn = '<div class="mapping_col_3 mapping_row-delete_field_block"><a href="#" class="mapping_row-delete_field"><span class="dashicons dashicons-trash"></span></a></div>';
|
897 |
+
|
898 |
+
var row = jQuery( '<li class="mapping_row segment_field segment_' + segment + '">\
|
899 |
+
<div class="mapping_col_1" style="width: 10px">\
|
900 |
+
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[segment]" value="' + (
|
901 |
+
segment ? segment : 'misc'
|
902 |
+
) + '">\
|
903 |
+
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[key]" value="' + _index + '">\
|
904 |
+
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[label]" value="' + label + '">\
|
905 |
+
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[format]" value="' + format_field + '">\
|
906 |
+
</div>\
|
907 |
+
<div class="mapping_col_2" title="' + label + '">' + '<span class="field-prefix">' + label_prefix + '</span>' + label + '<a href="#" onclick="return woe_remove_custom_field(this);" class="mapping_row-delete_custom_field" style="float: right;"><span class="ui-icon ui-icon-trash"></span></a></div>\
|
908 |
+
<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="' + _index_p + '[colname]" value="' + colname + '"></div>' + delete_btn + '\
|
909 |
+
</li>\
|
910 |
+
' );
|
911 |
+
|
912 |
+
row.find( 'input' ).prop( 'disabled', 'disabled' );
|
913 |
+
|
914 |
+
to.prepend( row );
|
915 |
+
|
916 |
+
woe_activate_draggable_field(
|
917 |
+
to.find( '.segment_field' ).first(),
|
918 |
+
segment,
|
919 |
+
format
|
920 |
+
);
|
921 |
+
|
922 |
+
to.find( '.segment_field' ).first().addClass( 'blink' );
|
923 |
+
|
924 |
+
var field = {
|
925 |
+
key: label,
|
926 |
+
colname: colname,
|
927 |
+
'default': 0,
|
928 |
+
label: label,
|
929 |
+
segment: segment,
|
930 |
+
format: 'string',
|
931 |
+
value: 'undefined',
|
932 |
+
};
|
933 |
+
|
934 |
+
window.all_fields[segment].unshift( field );
|
935 |
+
}
|
936 |
+
|
937 |
+
function woe_reset_field_contorls() {
|
938 |
+
jQuery( '.tab-actions-forms' )
|
939 |
+
.find( 'input,select' )
|
940 |
+
.val( '' );
|
941 |
+
}
|
942 |
+
|
943 |
+
function woe_escape_str( str ) {
|
944 |
+
|
945 |
+
var entityMap = {
|
946 |
+
"&": "&",
|
947 |
+
"<": "<",
|
948 |
+
">": ">",
|
949 |
+
'"': '"',
|
950 |
+
"'": ''',
|
951 |
+
"/": '/'
|
952 |
+
};
|
953 |
+
|
954 |
+
jQuery.each( entityMap, function ( key, value ) {
|
955 |
+
str = String( str ).replace( value, key );
|
956 |
+
} );
|
957 |
+
|
958 |
+
return String( str ).replace( /[&<>"'\/]/g, function ( s ) {
|
959 |
+
return entityMap[s];
|
960 |
+
} );
|
961 |
+
}
|
962 |
+
|
963 |
+
jQuery( document ).ready( function ( $ ) {
|
964 |
+
|
965 |
+
$( '#clear_selected_fields' ).click( function () {
|
966 |
+
if ( confirm( localize_settings_form.remove_all_fields_confirm ) ) {
|
967 |
+
if ( $( '#order_fields .mapping_row-delete_field' ).length > 0 ) {
|
968 |
+
$( '#order_fields .mapping_row-delete_field' ).click();
|
969 |
+
}
|
970 |
+
}
|
971 |
+
} );
|
972 |
+
|
973 |
+
$( '.segment_choice' ).click( function () {
|
974 |
+
|
975 |
+
$( '.segment_choice' ).removeClass( 'active' );
|
976 |
+
$( this ).addClass( 'active' );
|
977 |
+
|
978 |
+
$( '.settings-segment' ).removeClass( 'active' );
|
979 |
+
$( '#' + $( this ).data( 'segment' ) + '_unselected_segment' ).addClass( 'active' );
|
980 |
+
|
981 |
+
window.location.href = $( this ).attr( 'href' );
|
982 |
+
|
983 |
+
jQuery( '.tab-actions-forms .segment-form' ).removeClass( 'active' ).find( 'input,select' ).val( '' );
|
984 |
+
} );
|
985 |
+
|
986 |
+
setTimeout( function () {
|
987 |
+
if ( summary_mode ) {
|
988 |
+
$( '.segment_choice[href="products"]' ).click()
|
989 |
+
} else if ( window.location.hash.indexOf( 'segment' ) !== - 1 ) {
|
990 |
+
$( '.segment_choice[href="' + window.location.hash + '"]' ).click()
|
991 |
+
} else {
|
992 |
+
$( '.segment_choice' ).first().click();
|
993 |
+
}
|
994 |
+
}, 1000 );
|
995 |
+
|
996 |
+
jQuery( '#adjust-fields-btn' ).click( function () {
|
997 |
+
jQuery( '#fields' ).toggle();
|
998 |
+
jQuery( '#fields_control' ).toggle();
|
999 |
+
return false;
|
1000 |
+
} );
|
1001 |
+
|
1002 |
+
woe_create_selected_fields( null, output_format, false );
|
1003 |
+
|
1004 |
+
jQuery( "#sort_products" ).sortable()/*.disableSelection()*/;
|
1005 |
+
jQuery( "#sort_coupons" ).sortable()/*.disableSelection()*/;
|
1006 |
+
|
1007 |
+
jQuery( "#order_fields" ).sortable( {
|
1008 |
+
scroll: true,
|
1009 |
+
scrollSensitivity: 100,
|
1010 |
+
scrollSpeed: 100,
|
1011 |
+
stop: function ( event, ui ) {
|
1012 |
+
woe_moving_products_and_coupons_group_blocks_to_first_item( jQuery( '.output_format:checked' ).val() );
|
1013 |
+
}
|
1014 |
+
} );
|
1015 |
+
|
1016 |
+
jQuery( '.field_section' ).click( function () {
|
1017 |
+
|
1018 |
+
var section = jQuery( this ).val();
|
1019 |
+
var checked = jQuery( this ).is( ':checked' );
|
1020 |
+
|
1021 |
+
jQuery( '.segment_' + section ).each( function ( index ) {
|
1022 |
+
if ( checked ) {
|
1023 |
+
jQuery( this ).show();
|
1024 |
+
//jQuery(this).find('input:checkbox:first').attr('checked', true);
|
1025 |
+
}
|
1026 |
+
else {
|
1027 |
+
jQuery( this ).hide();
|
1028 |
+
jQuery( this ).find( 'input:checkbox:first' ).attr( 'checked', false );
|
1029 |
+
}
|
1030 |
+
} );
|
1031 |
+
|
1032 |
+
} );
|
1033 |
+
|
1034 |
+
jQuery( '#order_fields' ).on( 'click', '.mapping_row-delete_field', function () {
|
1035 |
+
|
1036 |
+
$( this ).closest( '.mapping_row' ).remove();
|
1037 |
+
|
1038 |
+
woe_check_sortable_groups();
|
1039 |
+
|
1040 |
+
return false;
|
1041 |
+
} );
|
1042 |
+
|
1043 |
+
jQuery( '.tab-controls .tab-actions-buttons .add-meta' ).on( 'click', function () {
|
1044 |
+
|
1045 |
+
jQuery( '.tab-actions-forms .segment-form' ).removeClass( 'active' );
|
1046 |
+
|
1047 |
+
if ( jQuery( '.tab-actions-forms .div_meta.segment-form.' +
|
1048 |
+
jQuery( '#unselected_fields .segment_choice.active' ).attr( 'data-segment' ) + '-segment'
|
1049 |
+
).length ) {
|
1050 |
+
jQuery( '.tab-actions-forms .div_meta.segment-form.' +
|
1051 |
+
jQuery( '#unselected_fields .segment_choice.active' ).attr( 'data-segment' ) + '-segment'
|
1052 |
+
).addClass( 'active' );
|
1053 |
+
} else {
|
1054 |
+
jQuery( '.tab-actions-forms .div_meta.segment-form.all-segments' ).addClass( 'active' );
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
return false;
|
1058 |
+
} );
|
1059 |
+
|
1060 |
+
jQuery( '.tab-controls .tab-actions-buttons .add-custom' ).on( 'click', function () {
|
1061 |
+
|
1062 |
+
jQuery( '.tab-actions-forms .segment-form' ).removeClass( 'active' );
|
1063 |
+
|
1064 |
+
if ( jQuery( '.tab-actions-forms .div_custom.segment-form.' +
|
1065 |
+
jQuery( '#unselected_fields .segment_choice.active' ).attr( 'data-segment' ) + '-segment'
|
1066 |
+
).length ) {
|
1067 |
+
jQuery( '.tab-actions-forms .div_custom.segment-form.' +
|
1068 |
+
jQuery( '#unselected_fields .segment_choice.active' ).attr( 'data-segment' ) + '-segment'
|
1069 |
+
).addClass( 'active' );
|
1070 |
+
} else {
|
1071 |
+
jQuery( '.tab-actions-forms .div_custom.segment-form.all-segments' ).addClass( 'active' );
|
1072 |
+
}
|
1073 |
+
|
1074 |
+
return false;
|
1075 |
+
} );
|
1076 |
+
|
1077 |
+
jQuery( '.tab-controls .button-cancel' ).on( 'click', function () {
|
1078 |
+
|
1079 |
+
jQuery( this ).closest( '.segment-form' )
|
1080 |
+
.removeClass( 'active' )
|
1081 |
+
.find( 'input,select' ).val( '' );
|
1082 |
+
|
1083 |
+
return false;
|
1084 |
+
} );
|
1085 |
+
|
1086 |
+
jQuery( '.button_cancel' ).click( function () {
|
1087 |
+
woe_reset_field_contorls();
|
1088 |
+
return false;
|
1089 |
+
} );
|
1090 |
+
|
1091 |
+
jQuery( '#button_custom_field' ).click( function () {
|
1092 |
+
|
1093 |
+
var colname = jQuery( '#colname_custom_field' ).val();
|
1094 |
+
var value = jQuery( '#value_custom_field' ).val();
|
1095 |
+
var format_field = jQuery( '#format_custom_field' ).val();
|
1096 |
+
if ( ! colname ) {
|
1097 |
+
alert( export_messages.empty_column_name );
|
1098 |
+
jQuery( '#colname_custom_field' ).focus();
|
1099 |
+
return false
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
var segment = jQuery( '.segment_choice.active' ).attr( 'data-segment' );
|
1103 |
+
|
1104 |
+
woe_add_custom_field( jQuery( "#" + segment + '_unselected_segment' ), 'orders', output_format, colname, value, segment, format_field );
|
1105 |
+
|
1106 |
+
woe_reset_field_contorls();
|
1107 |
+
|
1108 |
+
jQuery( this ).siblings( '.button-cancel' ).trigger( 'click' );
|
1109 |
+
|
1110 |
+
return false;
|
1111 |
+
} );
|
1112 |
+
|
1113 |
+
jQuery( '#button_custom_meta' ).click( function () {
|
1114 |
+
|
1115 |
+
var label = jQuery( '#select_custom_meta_order' ).val();
|
1116 |
+
var colname = jQuery( '#colname_custom_meta' ).val();
|
1117 |
+
var format_field = jQuery( '#format_custom_meta' ).val();
|
1118 |
+
if ( ! label ) //try custom text
|
1119 |
+
{
|
1120 |
+
label = jQuery( '#text_custom_meta_order' ).val();
|
1121 |
+
}
|
1122 |
+
;
|
1123 |
+
if ( ! label ) {
|
1124 |
+
alert( export_messages.empty_meta_key );
|
1125 |
+
jQuery( '#select_custom_meta_order' ).focus();
|
1126 |
+
return false
|
1127 |
+
}
|
1128 |
+
if ( ! colname ) {
|
1129 |
+
alert( export_messages.empty_column_name );
|
1130 |
+
jQuery( '#colname_custom_meta' ).focus();
|
1131 |
+
return false
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
var segment = jQuery( '.segment_choice.active' ).attr( 'data-segment' );
|
1135 |
+
|
1136 |
+
woe_add_custom_meta( jQuery( "#" + segment + '_unselected_segment' ), 'orders', output_format, label, colname, segment, format_field );
|
1137 |
+
|
1138 |
+
woe_reset_field_contorls();
|
1139 |
+
|
1140 |
+
jQuery( this ).siblings( '.button-cancel' ).trigger( 'click' );
|
1141 |
+
|
1142 |
+
return false;
|
1143 |
+
} );
|
1144 |
+
|
1145 |
+
///*CUSTOM FIELDS BINDS
|
1146 |
+
|
1147 |
+
jQuery( 'input[name=custom_meta_order_mode]' ).change( function () {
|
1148 |
+
|
1149 |
+
var fill_custom_meta_fields = function (source) {
|
1150 |
+
jQuery.each(source, function (index, value) {
|
1151 |
+
var options = '<option></option>';
|
1152 |
+
jQuery.each(value, function (meta_id, meta_label) {
|
1153 |
+
options += '<option value="' + woe_escape_str(meta_label) + '">' + meta_label + '</option>';
|
1154 |
+
});
|
1155 |
+
jQuery('#select_custom_meta_' + index).html(options);
|
1156 |
+
});
|
1157 |
+
};
|
1158 |
+
|
1159 |
+
if (!jQuery(this).prop('checked')) {
|
1160 |
+
fill_custom_meta_fields(window.order_custom_meta_fields);
|
1161 |
+
} else {
|
1162 |
+
var json = woe_make_json_var(jQuery('#export_job_settings'));
|
1163 |
+
var data = "json=" + json + "&action=order_exporter&method=get_used_custom_order_meta&woe_nonce=" + settings_form.woe_nonce + '&tab=' + settings_form.woe_active_tab;
|
1164 |
+
|
1165 |
+
jQuery.post(ajaxurl, data, function (response) {
|
1166 |
+
if (response) {
|
1167 |
+
fill_custom_meta_fields(response);
|
1168 |
+
}
|
1169 |
+
}, 'json');
|
1170 |
+
}
|
1171 |
+
} );
|
1172 |
+
|
1173 |
+
jQuery( 'input[name=custom_meta_products_mode]' ).change( function () {
|
1174 |
+
jQuery( '#select_custom_meta_products' ).prop( "disabled", true );
|
1175 |
+
jQuery( '#select_custom_meta_order_items' ).prop( "disabled", true );
|
1176 |
+
if ( ! jQuery( this ).is( ':checked' ) ) {
|
1177 |
+
var options = '<option></option>';
|
1178 |
+
jQuery.each( window.order_products_custom_meta_fields, function ( index, value ) {
|
1179 |
+
options += '<option value="' + woe_escape_str( value ) + '">' + value + '</option>';
|
1180 |
+
} );
|
1181 |
+
jQuery( '#select_custom_meta_products' ).html( options );
|
1182 |
+
jQuery( '#select_custom_meta_products' ).prop( "disabled", false );
|
1183 |
+
|
1184 |
+
options = '<option></option>';
|
1185 |
+
jQuery.each( window.order_order_item_custom_meta_fields, function ( index, value ) {
|
1186 |
+
options += '<option value="' + woe_escape_str( value ) + '">' + value + '</option>';
|
1187 |
+
} );
|
1188 |
+
jQuery( '#select_custom_meta_order_items' ).html( options );
|
1189 |
+
jQuery( '#select_custom_meta_order_items' ).prop( "disabled", false );
|
1190 |
+
}
|
1191 |
+
else {
|
1192 |
+
// jQuery('#modal-manage-products').html(jQuery('#TB_ajaxContent').html());
|
1193 |
+
var data = jQuery( '#export_job_settings' ).serialize(),
|
1194 |
+
data_products = data + "&action=order_exporter&method=get_used_custom_products_meta&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + settings_form.woe_nonce + '&tab=' + settings_form.woe_active_tab;
|
1195 |
+
data_order_items = data + "&action=order_exporter&method=get_used_custom_order_items_meta&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + settings_form.woe_nonce + '&tab=' + settings_form.woe_active_tab;
|
1196 |
+
|
1197 |
+
jQuery.post( ajaxurl, data_products, function ( response ) {
|
1198 |
+
if ( response ) {
|
1199 |
+
var options = '<option></option>';
|
1200 |
+
jQuery.each( response, function ( index, value ) {
|
1201 |
+
options += '<option value="' + woe_escape_str( value ) + '">' + value + '</option>';
|
1202 |
+
} );
|
1203 |
+
jQuery( '#select_custom_meta_products' ).html( options );
|
1204 |
+
jQuery( '#select_custom_meta_products' ).prop( "disabled", false );
|
1205 |
+
}
|
1206 |
+
}, 'json' );
|
1207 |
+
|
1208 |
+
jQuery.post( ajaxurl, data_order_items, function ( response ) {
|
1209 |
+
if ( response ) {
|
1210 |
+
var options = '<option></option>';
|
1211 |
+
jQuery.each( response, function ( index, value ) {
|
1212 |
+
options += '<option value="' + woe_escape_str( value ) + '">' + value + '</option>';
|
1213 |
+
} );
|
1214 |
+
jQuery( '#select_custom_meta_order_items' ).html( options );
|
1215 |
+
jQuery( '#select_custom_meta_order_items' ).prop( "disabled", false );
|
1216 |
+
}
|
1217 |
+
}, 'json' );
|
1218 |
+
|
1219 |
+
// jQuery('#modal-manage-products').html('');
|
1220 |
+
}
|
1221 |
+
} );
|
1222 |
+
|
1223 |
+
jQuery( 'input[name=custom_meta_products_mode]' ).trigger( 'change' );
|
1224 |
+
|
1225 |
+
jQuery( 'input[name=custom_meta_coupons_mode]' ).change( function () {
|
1226 |
+
|
1227 |
+
if ( jQuery( this ).val() == 'all' ) {
|
1228 |
+
var options = '<option></option>';
|
1229 |
+
jQuery.each( window.order_coupons_custom_meta_fields, function ( index, value ) {
|
1230 |
+
options += '<option value="' + woe_escape_str( value ) + '">' + value + '</option>';
|
1231 |
+
} );
|
1232 |
+
jQuery( '#select_custom_meta_coupons' ).html( options );
|
1233 |
+
}
|
1234 |
+
else {
|
1235 |
+
var data = jQuery( '#export_job_settings' ).serialize()
|
1236 |
+
data = data + "&action=order_exporter&method=get_used_custom_coupons_meta&woe_nonce=" + settings_form.woe_nonce + '&tab=' + settings_form.woe_active_tab;
|
1237 |
+
|
1238 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
1239 |
+
if ( response ) {
|
1240 |
+
var options = '<option></option>';
|
1241 |
+
jQuery.each( response, function ( index, value ) {
|
1242 |
+
options += '<option value="' + woe_escape_str( value ) + '">' + value + '</option>';
|
1243 |
+
} );
|
1244 |
+
jQuery( '#select_custom_meta_coupons' ).html( options );
|
1245 |
+
}
|
1246 |
+
}, 'json' );
|
1247 |
+
}
|
1248 |
+
} );
|
1249 |
+
|
1250 |
+
/////////////END CUSTOM FIELDS BINDS
|
1251 |
+
|
1252 |
+
jQuery( '.output_format' ).click( function () {
|
1253 |
+
|
1254 |
+
var new_format = jQuery( this ).val();
|
1255 |
+
jQuery( '#my-format .my-icon-triangle' ).removeClass( 'ui-icon-triangle-1-n' );
|
1256 |
+
jQuery( '#my-format .my-icon-triangle' ).addClass( 'ui-icon-triangle-1-s' );
|
1257 |
+
|
1258 |
+
if ( new_format != output_format ) {
|
1259 |
+
jQuery( this ).next().removeClass( 'ui-icon-triangle-1-s' );
|
1260 |
+
jQuery( this ).next().addClass( 'ui-icon-triangle-1-n' );
|
1261 |
+
jQuery( '#' + output_format + '_options' ).hide();
|
1262 |
+
jQuery( '#' + new_format + '_options' ).show();
|
1263 |
+
var format_type_changed = ! (
|
1264 |
+
woe_is_flat_format( new_format ) && woe_is_flat_format( output_format )
|
1265 |
+
);
|
1266 |
+
old_output_format = output_format;
|
1267 |
+
output_format = new_format;
|
1268 |
+
woe_synch_selected_fields( old_output_format, output_format );
|
1269 |
+
woe_create_selected_fields( old_output_format, output_format, format_type_changed );
|
1270 |
+
jQuery( '.field_section' ).prop( 'checked', true );
|
1271 |
+
jQuery( '#output_preview, #output_preview_csv' ).hide();
|
1272 |
+
// jQuery( '#fields' ).hide();
|
1273 |
+
// jQuery( '#fields_control' ).hide();
|
1274 |
+
woe_change_filename_ext();
|
1275 |
+
}
|
1276 |
+
else {
|
1277 |
+
if ( ! jQuery( '#' + new_format + '_options' ).is( ':hidden' ) ) {
|
1278 |
+
jQuery( '#' + new_format + '_options' ).hide();
|
1279 |
+
}
|
1280 |
+
else {
|
1281 |
+
if ( jQuery( '#' + new_format + '_options' ).is( ':hidden' ) ) {
|
1282 |
+
jQuery( '#' + new_format + '_options' ).show();
|
1283 |
+
jQuery( this ).next().removeClass( 'ui-icon-triangle-1-s' );
|
1284 |
+
jQuery( this ).next().addClass( 'ui-icon-triangle-1-n' );
|
1285 |
+
}
|
1286 |
+
}
|
1287 |
+
}
|
1288 |
+
|
1289 |
+
woe_check_sortable_groups();
|
1290 |
+
} );
|
1291 |
+
|
1292 |
+
//logic for setup link
|
1293 |
+
jQuery( "#summary_report_by_products_checkbox" ).change( function ( e, action ) {
|
1294 |
+
|
1295 |
+
var summary_report_fields = [];
|
1296 |
+
summary_report_fields.push( $( '#products_unselected_segment input[value="plain_products_summary_report_total_qty"]' ).parents( 'li' ) );
|
1297 |
+
summary_report_fields.push( $( '#products_unselected_segment input[value="plain_products_summary_report_total_amount"]' ).parents( 'li' ) );
|
1298 |
+
|
1299 |
+
jQuery( '#manage_fields' ).toggleClass( 'summary-products-report', ! ! jQuery( this ).prop( 'checked' ) );
|
1300 |
+
|
1301 |
+
$( '#unselected_fields .segment_choice' ).removeClass( 'active' );
|
1302 |
+
$( '#unselected_fields_list .settings-segment' ).removeClass( 'active' );
|
1303 |
+
|
1304 |
+
if ( jQuery( this ).prop( 'checked' ) ) {
|
1305 |
+
|
1306 |
+
var segment = 'products';
|
1307 |
+
|
1308 |
+
// hide product fields starts with 'line' and 'qty'
|
1309 |
+
$( '#products_unselected_segment input, #order_fields input' ).map( function () {
|
1310 |
+
var matches = $( this ).attr( 'value' ).match( /plain_products_(line|qty).*/ );
|
1311 |
+
if ( matches ) {
|
1312 |
+
$( this ).closest( '.mapping_row' ).hide();
|
1313 |
+
}
|
1314 |
+
} );
|
1315 |
+
|
1316 |
+
if ( 'onstart' !== action ) {
|
1317 |
+
// purge summary report fields before insert
|
1318 |
+
$( '#order_fields input[value="plain_products_summary_report_total_qty"]' ).closest( '.mapping_row' ).remove();
|
1319 |
+
$( '#order_fields input[value="plain_products_summary_report_total_amount"]' ).closest( '.mapping_row' ).remove();
|
1320 |
+
|
1321 |
+
// insert summary report fields
|
1322 |
+
jQuery.each( summary_report_fields, function ( i, value ) {
|
1323 |
+
$( value ).show();
|
1324 |
+
var $field_to_copy = $( value ).clone();
|
1325 |
+
$field_to_copy
|
1326 |
+
.attr( 'style', '' )
|
1327 |
+
.addClass( 'ui-draggabled' )
|
1328 |
+
.removeClass( 'segment_field' )
|
1329 |
+
.find( 'input' ).prop( 'disabled', false );
|
1330 |
+
|
1331 |
+
jQuery( '#manage_fields #order_fields' ).append( $field_to_copy );
|
1332 |
+
} );
|
1333 |
+
}
|
1334 |
+
|
1335 |
+
} else {
|
1336 |
+
var segment = window.location.hash.replace( '#segment=', '' );
|
1337 |
+
|
1338 |
+
// show product fields starts with 'line' and 'qty'
|
1339 |
+
$( '#products_unselected_segment input, #order_fields input' ).map( function () {
|
1340 |
+
var $value = $( this ).attr( 'value' );
|
1341 |
+
if ( typeof $value === 'undefined' ) {
|
1342 |
+
return;
|
1343 |
+
}
|
1344 |
+
|
1345 |
+
if ( $value.match( /plain_products_(line|qty).*/ ) ) {
|
1346 |
+
$( this ).closest( '.mapping_row' ).show();
|
1347 |
+
}
|
1348 |
+
} );
|
1349 |
+
|
1350 |
+
// purge summary report fields
|
1351 |
+
$( '#order_fields input[value="plain_products_summary_report_total_qty"]' ).closest( '.mapping_row' ).remove();
|
1352 |
+
$( '#order_fields input[value="plain_products_summary_report_total_amount"]' ).closest( '.mapping_row' ).remove();
|
1353 |
+
|
1354 |
+
jQuery.each( summary_report_fields, function ( i, value ) {
|
1355 |
+
$( value ).hide();
|
1356 |
+
} );
|
1357 |
+
}
|
1358 |
+
|
1359 |
+
$( '#unselected_fields .segment_choice[data-segment="' + segment + '"]' ).addClass( 'active' );
|
1360 |
+
$( '#unselected_fields_list .settings-segment#' + segment + '_unselected_segment' ).addClass( 'active' );
|
1361 |
+
|
1362 |
+
} );
|
1363 |
+
|
1364 |
+
setTimeout( function () {
|
1365 |
+
jQuery( "#summary_report_by_products_checkbox" ).trigger( 'change', 'onstart' );
|
1366 |
+
}, 1 )
|
1367 |
+
|
1368 |
+
} );
|
assets/js/export.js
DELETED
@@ -1,1579 +0,0 @@
|
|
1 |
-
var select2WODropdownOpts = {
|
2 |
-
containerCssClass : 'without-dropdown',
|
3 |
-
dropdownCssClass: 'without-dropdown',
|
4 |
-
};
|
5 |
-
|
6 |
-
String.prototype.hashCode = function() {
|
7 |
-
var hash = 0, i, chr;
|
8 |
-
if (this.length === 0) return hash;
|
9 |
-
for (i = 0; i < this.length; i++) {
|
10 |
-
chr = this.charCodeAt(i);
|
11 |
-
hash = ((hash << 5) - hash) + chr;
|
12 |
-
hash |= 0; // Convert to 32bit integer
|
13 |
-
}
|
14 |
-
return hash;
|
15 |
-
};
|
16 |
-
var formSubmitting = false;
|
17 |
-
|
18 |
-
var setFormSubmitting = function() { formSubmitting = true; };
|
19 |
-
|
20 |
-
window.onload = function () {
|
21 |
-
var form = jQuery( '#export_job_settings' );
|
22 |
-
var on_load_form_data = form.serialize();
|
23 |
-
|
24 |
-
var isDirty = function ( on_load_form_data ) {
|
25 |
-
return on_load_form_data.hashCode() !== form.serialize().hashCode()
|
26 |
-
};
|
27 |
-
|
28 |
-
window.addEventListener( "beforeunload", function ( e ) {
|
29 |
-
if ( isDirty( on_load_form_data ) && ! formSubmitting ) {
|
30 |
-
(
|
31 |
-
e || window.event
|
32 |
-
).returnValue = false; //Gecko + IE
|
33 |
-
return false; //Gecko + Webkit, Safari, Chrome etc.
|
34 |
-
} else {
|
35 |
-
return undefined;
|
36 |
-
}
|
37 |
-
} );
|
38 |
-
|
39 |
-
//force style for popup!
|
40 |
-
// var style = jQuery('<style>#TB_ajaxContent { overflow: auto !important; }</style>');
|
41 |
-
// jQuery('html > head').append(style);
|
42 |
-
};
|
43 |
-
|
44 |
-
function bind_events() {
|
45 |
-
|
46 |
-
// for filter by ORDER custom fields
|
47 |
-
jQuery( '#custom_fields' ).change( function() {
|
48 |
-
|
49 |
-
jQuery( '#select_custom_fields' ).attr( 'disabled', 'disabled' );
|
50 |
-
var data = {
|
51 |
-
'cf_name': jQuery( this ).val(),
|
52 |
-
method: "get_order_custom_fields_values",
|
53 |
-
action: "order_exporter",
|
54 |
-
woe_nonce: woe_nonce,
|
55 |
-
};
|
56 |
-
var val_op = jQuery( '#custom_fields_compare' ).val();
|
57 |
-
jQuery( '#text_custom_fields' ).val( '' );
|
58 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
59 |
-
jQuery( '#select_custom_fields' ).remove();
|
60 |
-
jQuery( '#select_custom_fields--select2 select' ).select2('destroy');
|
61 |
-
jQuery( '#select_custom_fields, #select_custom_fields--select2' ).remove();
|
62 |
-
if ( response ) {
|
63 |
-
var options = '<option>' + export_messages.empty + '</option>';
|
64 |
-
jQuery.each( response, function( index, value ) {
|
65 |
-
options += '<option>' + value + '</option>';
|
66 |
-
} );
|
67 |
-
var $select = jQuery( '<div id="select_custom_fields--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
68 |
-
+ 'display: ' + (('LIKE' === val_op || 'NOT SET' === val_op|| 'IS SET' === val_op) ? 'none' : 'inline-block') + ';">'
|
69 |
-
+ '<select id="select_custom_fields">' + options + '</select></div>' );
|
70 |
-
$select.insertBefore( jQuery( '#add_custom_fields' ) )
|
71 |
-
$select.find('select').select2_i18n({ tags: true });
|
72 |
-
}
|
73 |
-
else {
|
74 |
-
jQuery( '<input type="text" id="select_custom_fields" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_custom_fields' ) );
|
75 |
-
}
|
76 |
-
jQuery( '#custom_fields_compare').trigger('change');
|
77 |
-
}, 'json' );
|
78 |
-
} );
|
79 |
-
jQuery( '#add_custom_fields' ).click( function() {
|
80 |
-
|
81 |
-
var val = !jQuery( "#select_custom_fields" ).is(':disabled') ? jQuery( "#select_custom_fields" ).val() : jQuery( "#text_custom_fields" ).val();
|
82 |
-
var val2 = jQuery( '#custom_fields' ).val();
|
83 |
-
var val_op = jQuery( '#custom_fields_compare' ).val();
|
84 |
-
if ( val != null && val2 != null && val.length && val2.length ) {
|
85 |
-
var result = val2 + ' ' + val_op + ' ' + val;
|
86 |
-
|
87 |
-
var f = true;
|
88 |
-
jQuery( '#custom_fields_check' ).next().find( 'ul li' ).each( function() {
|
89 |
-
if ( jQuery( this ).attr( 'title' ) == val ) {
|
90 |
-
f = false;
|
91 |
-
}
|
92 |
-
} );
|
93 |
-
|
94 |
-
if ( f ) {
|
95 |
-
if ( export_messages.empty === val ) {
|
96 |
-
result = val2 + ' ' + val_op + ' empty';
|
97 |
-
jQuery( '#custom_fields_check' ).append( '<option selected="selected" value="' + result + '">' + result + '</option>' );
|
98 |
-
} else {
|
99 |
-
jQuery( '#custom_fields_check' ).append( '<option selected="selected" value="' + result + '">' + result + '</option>' );
|
100 |
-
}
|
101 |
-
|
102 |
-
jQuery( '#custom_fields_check' ).select2_i18n();
|
103 |
-
|
104 |
-
jQuery( '#custom_fields_check option' ).each( function() {
|
105 |
-
jQuery( '#custom_fields_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
106 |
-
} );
|
107 |
-
|
108 |
-
jQuery( "input#select_custom_fields" ).val( '' );
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
return false;
|
113 |
-
} );
|
114 |
-
|
115 |
-
jQuery( '#custom_fields_compare').change(function() {
|
116 |
-
var val_op = jQuery( '#custom_fields_compare' ).val();
|
117 |
-
if ( 'LIKE' === val_op ) {
|
118 |
-
jQuery( "#select_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
119 |
-
jQuery( "#select_custom_fields--select2" ).hide();
|
120 |
-
jQuery( "#text_custom_fields" ).css('display', 'inline' ).attr( 'disabled', false );
|
121 |
-
}
|
122 |
-
else if ( 'NOT SET' === val_op || 'IS SET' === val_op ) {
|
123 |
-
jQuery( "#select_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' ) . val(' ');
|
124 |
-
jQuery( "#select_custom_fields--select2" ).hide();
|
125 |
-
jQuery( "#text_custom_fields" ).css('display', 'none' ).attr( 'disabled', false ). val(' ');
|
126 |
-
}
|
127 |
-
else {
|
128 |
-
jQuery( "#select_custom_fields" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
129 |
-
jQuery( '#select_custom_fields--select2' ).css('display', 'inline' );
|
130 |
-
jQuery( "#text_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
131 |
-
}
|
132 |
-
});
|
133 |
-
//end of change
|
134 |
-
|
135 |
-
// for filter by USER custom fields
|
136 |
-
bind_events_users();
|
137 |
-
|
138 |
-
//PRODUCT ATTRIBUTES BEGIN
|
139 |
-
jQuery( '#attributes' ).change( function() {
|
140 |
-
|
141 |
-
jQuery( '#select_attributes' ).attr( 'disabled', 'disabled' );
|
142 |
-
var data = {
|
143 |
-
'attr': jQuery( this ).val(),
|
144 |
-
method: "get_products_attributes_values",
|
145 |
-
action: "order_exporter",
|
146 |
-
woe_nonce: woe_nonce,
|
147 |
-
};
|
148 |
-
|
149 |
-
var val_op = jQuery( '#attributes_compare' ).val();
|
150 |
-
jQuery( '#text_attributes' ).val( '' );
|
151 |
-
|
152 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
153 |
-
jQuery( '#select_attributes--select2 select' ).select2('destroy');
|
154 |
-
jQuery( '#select_attributes, #select_attributes--select2' ).remove();
|
155 |
-
|
156 |
-
if ( response ) {
|
157 |
-
var options = '';
|
158 |
-
jQuery.each( response, function( index, value ) {
|
159 |
-
options += '<option>' + value + '</option>';
|
160 |
-
} );
|
161 |
-
var $select = jQuery( '<div id="select_attributes--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
162 |
-
+ 'display: ' + (('LIKE' === val_op) ? 'none' : 'inline-block') + ';">'
|
163 |
-
+ '<select id="select_attributes">' + options + '</select></div>' );
|
164 |
-
$select.insertBefore( jQuery( '#add_attributes' ) )
|
165 |
-
$select.find('select').select2_i18n({ tags: true });
|
166 |
-
}
|
167 |
-
else {
|
168 |
-
jQuery( '<input type="text" id="select_attributes" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_attributes' ) );
|
169 |
-
}
|
170 |
-
}, 'json' );
|
171 |
-
} );
|
172 |
-
|
173 |
-
jQuery( '#add_attributes' ).click( function() {
|
174 |
-
|
175 |
-
var val = !jQuery( "#select_attributes" ).is(':disabled') ? jQuery( "#select_attributes" ).val() : jQuery( "#text_attributes" ).val();
|
176 |
-
var val2 = jQuery( '#attributes' ).val();
|
177 |
-
var val_op = jQuery( '#attributes_compare' ).val();
|
178 |
-
if ( val != null && val2 != null && val.length && val2.length ) {
|
179 |
-
val = val2 + ' ' + val_op + ' ' + val;
|
180 |
-
|
181 |
-
var f = true;
|
182 |
-
jQuery( '#attributes_check' ).next().find( 'ul li' ).each( function() {
|
183 |
-
if ( jQuery( this ).attr( 'title' ) == val ) {
|
184 |
-
f = false;
|
185 |
-
}
|
186 |
-
} );
|
187 |
-
|
188 |
-
if ( f ) {
|
189 |
-
|
190 |
-
jQuery( '#attributes_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
191 |
-
jQuery( '#attributes_check' ).select2_i18n(select2WODropdownOpts);
|
192 |
-
|
193 |
-
jQuery( '#attributes_check option' ).each( function() {
|
194 |
-
jQuery( '#attributes_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
195 |
-
} );
|
196 |
-
|
197 |
-
jQuery( "input#select_attributes" ).val( '' );
|
198 |
-
}
|
199 |
-
}
|
200 |
-
|
201 |
-
return false;
|
202 |
-
} );
|
203 |
-
|
204 |
-
jQuery( '#attributes_compare').change(function() {
|
205 |
-
var val_op = jQuery( '#attributes_compare' ).val();
|
206 |
-
if ( 'LIKE' === val_op ) {
|
207 |
-
jQuery( "#select_attributes" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
208 |
-
jQuery( "#select_attributes--select2" ).hide();
|
209 |
-
jQuery( "#text_attributes" ).css('display', 'inline' ).attr( 'disabled', false );
|
210 |
-
}
|
211 |
-
else {
|
212 |
-
jQuery( "#select_attributes" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
213 |
-
jQuery( "#select_attributes--select2" ).css('display', 'inline' );
|
214 |
-
jQuery( "#text_attributes" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
215 |
-
}
|
216 |
-
});
|
217 |
-
//PRODUCT ATTRIBUTES END
|
218 |
-
|
219 |
-
jQuery( '#itemmeta' ).change( function() {
|
220 |
-
var selected64 = jQuery( this ).find(":selected").data("base64");
|
221 |
-
|
222 |
-
jQuery( '#select_itemmeta' ).attr( 'disabled', 'disabled' );
|
223 |
-
var data = {
|
224 |
-
'item': window.atob(selected64),
|
225 |
-
method: "get_products_itemmeta_values",
|
226 |
-
action: "order_exporter",
|
227 |
-
woe_nonce: woe_nonce,
|
228 |
-
};
|
229 |
-
|
230 |
-
var val_op = jQuery( '#itemmeta_compare' ).val();
|
231 |
-
jQuery( '#text_itemmeta' ).val( '' );
|
232 |
-
|
233 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
234 |
-
jQuery( '#select_itemmeta--select2 select' ).select2('destroy');
|
235 |
-
jQuery( '#select_itemmeta, #select_itemmeta--select2' ).remove();
|
236 |
-
if ( response ) {
|
237 |
-
var options = '';
|
238 |
-
jQuery.each( response, function( index, value ) {
|
239 |
-
options += '<option>' + value + '</option>';
|
240 |
-
} );
|
241 |
-
var $select = jQuery( '<div id="select_itemmeta--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
242 |
-
+ 'display: ' + (('LIKE' === val_op) ? 'none' : 'inline-block') + ';">'
|
243 |
-
+ '<select id="select_itemmeta">' + options + '</select></div>' );
|
244 |
-
$select.insertBefore( jQuery( '#add_itemmeta' ) )
|
245 |
-
$select.find('select').select2_i18n({ tags: true });
|
246 |
-
}
|
247 |
-
else {
|
248 |
-
jQuery( '<input type="text" id="select_itemmeta" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_itemmeta' ) );
|
249 |
-
}
|
250 |
-
}, 'json' );
|
251 |
-
} );
|
252 |
-
|
253 |
-
jQuery( '#add_itemmeta' ).click( function() {
|
254 |
-
|
255 |
-
var val = !jQuery( "#select_itemmeta" ).is(':disabled') ? jQuery( "#select_itemmeta" ).val() : jQuery( "#text_itemmeta" ).val();
|
256 |
-
var selected64 = jQuery( '#itemmeta' ).find(":selected").data("base64");
|
257 |
-
var val2 = window.atob(selected64).replace(/&/g,'&');
|
258 |
-
var val_op = jQuery( '#itemmeta_compare' ).val();
|
259 |
-
if ( val != null && val2 != null && val.length && val2.length ) {
|
260 |
-
val = val2 + ' ' + val_op + ' ' + val;
|
261 |
-
|
262 |
-
var f = true;
|
263 |
-
jQuery( '#itemmeta_check' ).next().find( 'ul li' ).each( function() {
|
264 |
-
if ( jQuery( this ).attr( 'title' ) == val ) {
|
265 |
-
f = false;
|
266 |
-
}
|
267 |
-
} );
|
268 |
-
|
269 |
-
if ( f ) {
|
270 |
-
|
271 |
-
jQuery( '#itemmeta_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
272 |
-
jQuery( '#itemmeta_check' ).select2_i18n(select2WODropdownOpts);
|
273 |
-
|
274 |
-
jQuery( '#itemmeta_check option' ).each( function() {
|
275 |
-
jQuery( '#itemmeta_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove(); // jQuerySelectorEscape ?
|
276 |
-
} );
|
277 |
-
|
278 |
-
jQuery( "input#select_itemmeta" ).val( '' );
|
279 |
-
}
|
280 |
-
}
|
281 |
-
|
282 |
-
return false;
|
283 |
-
} );
|
284 |
-
|
285 |
-
jQuery( '#itemmeta_compare').change(function() {
|
286 |
-
var val_op = jQuery( '#itemmeta_compare' ).val();
|
287 |
-
if ( 'LIKE' === val_op ) {
|
288 |
-
jQuery( "#select_itemmeta" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
289 |
-
jQuery( "#select_itemmeta--select2" ).hide();
|
290 |
-
jQuery( "#text_itemmeta" ).css('display', 'inline' ).attr( 'disabled', false );
|
291 |
-
}
|
292 |
-
else {
|
293 |
-
jQuery( "#select_itemmeta" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
294 |
-
jQuery( "#select_itemmeta--select2" ).css('display', 'inline' );
|
295 |
-
jQuery( "#text_itemmeta" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
296 |
-
}
|
297 |
-
});
|
298 |
-
|
299 |
-
//PRODUCT TAXONOMIES BEGIN
|
300 |
-
jQuery( '#taxonomies' ).change( function() {
|
301 |
-
|
302 |
-
jQuery( '#select_taxonomies' ).attr( 'disabled', 'disabled' );
|
303 |
-
var data = {
|
304 |
-
'tax': jQuery( this ).val(),
|
305 |
-
method: "get_products_taxonomies_values",
|
306 |
-
action: "order_exporter",
|
307 |
-
woe_nonce: woe_nonce,
|
308 |
-
};
|
309 |
-
|
310 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
311 |
-
jQuery( '#select_taxonomies--select2 select' ).select2('destroy');
|
312 |
-
jQuery( '#select_taxonomies, #select_taxonomies--select2' ).remove();
|
313 |
-
if ( response ) {
|
314 |
-
var options = '';
|
315 |
-
jQuery.each( response, function( index, value ) {
|
316 |
-
options += '<option>' + value + '</option>';
|
317 |
-
} );
|
318 |
-
var $select = jQuery( '<div id="select_taxonomies--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top; display: inline-block;">'
|
319 |
-
+ '<select id="select_taxonomies">' + options + '</select></div>' );
|
320 |
-
$select.insertBefore( jQuery( '#add_taxonomies' ) )
|
321 |
-
$select.find('select').select2_i18n({ tags: true });
|
322 |
-
}
|
323 |
-
else {
|
324 |
-
jQuery( '<input type="text" id="select_taxonomies" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_taxonomies' ) );
|
325 |
-
}
|
326 |
-
}, 'json' );
|
327 |
-
} );
|
328 |
-
|
329 |
-
jQuery( '#add_taxonomies' ).click( function() {
|
330 |
-
|
331 |
-
var val = !jQuery( "#select_taxonomies" ).is(':disabled') ? jQuery( "#select_taxonomies" ).val() : jQuery( "#text_taxonomies" ).val();
|
332 |
-
var val2 = jQuery( '#taxonomies' ).val();
|
333 |
-
var val_op = jQuery( '#taxonomies_compare' ).val();
|
334 |
-
if ( val != null && val2 != null && val.length && val2.length ) {
|
335 |
-
val = val2 + ' ' + val_op + ' ' + val;
|
336 |
-
|
337 |
-
var f = true;
|
338 |
-
jQuery( '#taxonomies_check' ).next().find( 'ul li' ).each( function() {
|
339 |
-
if ( jQuery( this ).attr( 'title' ) == val ) {
|
340 |
-
f = false;
|
341 |
-
}
|
342 |
-
} );
|
343 |
-
|
344 |
-
if ( f ) {
|
345 |
-
|
346 |
-
jQuery( '#taxonomies_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
347 |
-
jQuery( '#taxonomies_check' ).select2_i18n(select2WODropdownOpts);
|
348 |
-
|
349 |
-
jQuery( '#taxonomies_check option' ).each( function() {
|
350 |
-
jQuery( '#taxonomies_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
351 |
-
} );
|
352 |
-
|
353 |
-
jQuery( "input#select_taxonomies" ).val( '' );
|
354 |
-
}
|
355 |
-
}
|
356 |
-
|
357 |
-
return false;
|
358 |
-
} );
|
359 |
-
|
360 |
-
jQuery( '#taxonomies_compare').change(function() {
|
361 |
-
var val_op = jQuery( '#taxonomies_compare' ).val();
|
362 |
-
if ( 'LIKE' === val_op ) {
|
363 |
-
jQuery( "#select_taxonomies" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
364 |
-
jQuery( "#text_taxonomies" ).css('display', 'inline' ).attr( 'disabled', false );
|
365 |
-
}
|
366 |
-
else {
|
367 |
-
jQuery( "#select_taxonomies" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
368 |
-
jQuery( "#text_taxonomies" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
369 |
-
}
|
370 |
-
});
|
371 |
-
//PRODUCT TAXONOMIES END
|
372 |
-
|
373 |
-
// for filter by PRODUCT custom fields
|
374 |
-
jQuery( '#product_custom_fields' ).change( function() {
|
375 |
-
|
376 |
-
jQuery( '#select_product_custom_fields' ).attr( 'disabled', 'disabled' );
|
377 |
-
var data = {
|
378 |
-
'cf_name': jQuery( this ).val(),
|
379 |
-
method: "get_product_custom_fields_values",
|
380 |
-
action: "order_exporter",
|
381 |
-
woe_nonce: woe_nonce,
|
382 |
-
};
|
383 |
-
|
384 |
-
var val_op = jQuery( '#product_custom_fields_compare' ).val();
|
385 |
-
jQuery( '#text_product_custom_fields' ).val( '' );
|
386 |
-
|
387 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
388 |
-
jQuery( '#select_product_custom_fields--select2 select' ).select2('destroy');
|
389 |
-
jQuery( '#select_product_custom_fields, #select_product_custom_fields--select2' ).remove();
|
390 |
-
if ( response ) {
|
391 |
-
var options = '';
|
392 |
-
jQuery.each( response, function( index, value ) {
|
393 |
-
options += '<option>' + value + '</option>';
|
394 |
-
} );
|
395 |
-
var $select = jQuery( '<div id="select_product_custom_fields--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
396 |
-
+ 'display: ' + (('LIKE' === val_op) ? 'none' : 'inline-block') + ';">'
|
397 |
-
+ '<select id="select_product_custom_fields">' + options + '</select></div>' );
|
398 |
-
$select.insertBefore( jQuery( '#add_product_custom_fields' ) )
|
399 |
-
$select.find('select').select2_i18n({ tags: true });
|
400 |
-
}
|
401 |
-
else {
|
402 |
-
jQuery( '<input type="text" id="select_product_custom_fields" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_product_custom_fields' ) );
|
403 |
-
}
|
404 |
-
}, 'json' );
|
405 |
-
} );
|
406 |
-
jQuery( '#add_product_custom_fields' ).click( function() {
|
407 |
-
|
408 |
-
var val = !jQuery( "#select_product_custom_fields" ).is(':disabled') ? jQuery( "#select_product_custom_fields" ).val() : jQuery( "#text_product_custom_fields" ).val();
|
409 |
-
var val2 = jQuery( '#product_custom_fields' ).val();
|
410 |
-
var val_op = jQuery( '#product_custom_fields_compare' ).val();
|
411 |
-
if ( val != null && val2 != null && val.length && val2.length ) {
|
412 |
-
val = val2 + ' ' + val_op + ' ' + val;
|
413 |
-
|
414 |
-
var f = true;
|
415 |
-
jQuery( '#product_custom_fields_check' ).next().find( 'ul li' ).each( function() {
|
416 |
-
if ( jQuery( this ).attr( 'title' ) == val ) {
|
417 |
-
f = false;
|
418 |
-
}
|
419 |
-
} );
|
420 |
-
|
421 |
-
if ( f ) {
|
422 |
-
|
423 |
-
jQuery( '#product_custom_fields_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
424 |
-
jQuery( '#product_custom_fields_check' ).select2_i18n(select2WODropdownOpts);
|
425 |
-
|
426 |
-
jQuery( '#product_custom_fields_check option' ).each( function() {
|
427 |
-
jQuery( '#product_custom_fields_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
428 |
-
} );
|
429 |
-
|
430 |
-
jQuery( "input#select_product_custom_fields" ).val( '' );
|
431 |
-
}
|
432 |
-
}
|
433 |
-
|
434 |
-
return false;
|
435 |
-
} );
|
436 |
-
|
437 |
-
jQuery( '#product_custom_fields_compare').change(function() {
|
438 |
-
var val_op = jQuery( '#product_custom_fields_compare' ).val();
|
439 |
-
if ( 'LIKE' === val_op ) {
|
440 |
-
jQuery( "#select_product_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
441 |
-
jQuery( "#select_product_custom_fields--select2" ).hide();
|
442 |
-
jQuery( "#text_product_custom_fields" ).css('display', 'inline' ).attr( 'disabled', false );
|
443 |
-
}
|
444 |
-
else {
|
445 |
-
jQuery( "#select_product_custom_fields" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
446 |
-
jQuery( "#select_product_custom_fields--select2" ).css('display', 'inline' );
|
447 |
-
jQuery( "#text_product_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
448 |
-
}
|
449 |
-
});
|
450 |
-
//end of change
|
451 |
-
|
452 |
-
|
453 |
-
jQuery( '#orders_add_custom_field' ).click( function() {
|
454 |
-
jQuery( "#fields_control > div" ).hide();
|
455 |
-
jQuery( "#fields_control .div_custom" ).show();
|
456 |
-
|
457 |
-
//add_custom_field(jQuery("#order_fields"),'products','CSV');
|
458 |
-
return false;
|
459 |
-
} );
|
460 |
-
jQuery( '#orders_add_custom_meta' ).click( function() {
|
461 |
-
jQuery('#custom_meta_order_mode_used').attr('checked', false);
|
462 |
-
jQuery('#custom_meta_order_mode_used').change();
|
463 |
-
jQuery( "#fields_control > div" ).hide();
|
464 |
-
jQuery( "#fields_control .div_meta" ).show();
|
465 |
-
|
466 |
-
//add_custom_field(jQuery("#order_fields"),'products','CSV');
|
467 |
-
return false;
|
468 |
-
} );
|
469 |
-
|
470 |
-
jQuery( '.button_cancel' ).click( function() {
|
471 |
-
reset_field_contorls();
|
472 |
-
return false;
|
473 |
-
} );
|
474 |
-
|
475 |
-
///*CUSTOM FIELDS BINDS
|
476 |
-
jQuery( '#button_custom_field' ).click( function() {
|
477 |
-
var colname = jQuery( '#colname_custom_field' ).val();
|
478 |
-
var value = jQuery( '#value_custom_field' ).val();
|
479 |
-
var format_field = jQuery( '#format_custom_field' ).val();
|
480 |
-
if ( !colname )
|
481 |
-
{
|
482 |
-
alert( export_messages.empty_column_name );
|
483 |
-
jQuery( '#colname_custom_field' ).focus();
|
484 |
-
return false
|
485 |
-
}
|
486 |
-
|
487 |
-
var segment = jQuery('.segment_choice.active').attr('data-segment');
|
488 |
-
|
489 |
-
add_custom_field( jQuery( "#" + segment + '_unselected_segment' ), 'orders', output_format, colname, value, segment, format_field );
|
490 |
-
|
491 |
-
reset_field_contorls();
|
492 |
-
|
493 |
-
jQuery(this).siblings('.button-cancel').trigger('click');
|
494 |
-
|
495 |
-
return false;
|
496 |
-
} );
|
497 |
-
|
498 |
-
jQuery('input[name=custom_meta_order_mode]').change(function() {
|
499 |
-
if ( !jQuery(this).prop('checked') ) {
|
500 |
-
var options = '<option></option>';
|
501 |
-
jQuery.each( window.order_custom_meta_fields, function( index, value ) {
|
502 |
-
options += '<option value="' + escapeStr(value) + '">' + value + '</option>';
|
503 |
-
} );
|
504 |
-
jQuery( '#select_custom_meta_order' ).html( options );
|
505 |
-
}
|
506 |
-
else {
|
507 |
-
var json = makeJsonVar(jQuery( '#export_job_settings' ));
|
508 |
-
var data = "json="+ json +"&action=order_exporter&method=get_used_custom_order_meta&woe_nonce=" + woe_nonce;
|
509 |
-
|
510 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
511 |
-
if ( response ) {
|
512 |
-
var options = '<option></option>';
|
513 |
-
jQuery.each( response, function( index, value ) {
|
514 |
-
options += '<option value="' + escapeStr(value) + '">' + value + '</option>';
|
515 |
-
} );
|
516 |
-
jQuery( '#select_custom_meta_order' ).html( options );
|
517 |
-
}
|
518 |
-
}, 'json' );
|
519 |
-
}
|
520 |
-
});
|
521 |
-
|
522 |
-
jQuery('input[name=custom_meta_products_mode]').change(function() {
|
523 |
-
jQuery( '#select_custom_meta_products' ).prop( "disabled", true );
|
524 |
-
jQuery( '#select_custom_meta_order_items' ).prop( "disabled", true );
|
525 |
-
if ( !jQuery( this ).is( ':checked' ) ) {
|
526 |
-
var options = '<option></option>';
|
527 |
-
jQuery.each( window.order_products_custom_meta_fields, function( index, value ) {
|
528 |
-
options += '<option value="' + escapeStr(value) + '">' + value + '</option>';
|
529 |
-
} );
|
530 |
-
jQuery( '#select_custom_meta_products' ).html( options );
|
531 |
-
jQuery( '#select_custom_meta_products' ).prop( "disabled", false );
|
532 |
-
|
533 |
-
options = '<option></option>';
|
534 |
-
jQuery.each( window.order_order_item_custom_meta_fields, function( index, value ) {
|
535 |
-
options += '<option value="' + escapeStr(value) + '">' + value + '</option>';
|
536 |
-
} );
|
537 |
-
jQuery( '#select_custom_meta_order_items' ).html( options );
|
538 |
-
jQuery( '#select_custom_meta_order_items' ).prop( "disabled", false );
|
539 |
-
}
|
540 |
-
else {
|
541 |
-
// jQuery('#modal-manage-products').html(jQuery('#TB_ajaxContent').html());
|
542 |
-
var data = jQuery( '#export_job_settings' ).serialize(),
|
543 |
-
data_products = data + "&action=order_exporter&method=get_used_custom_products_meta&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + woe_nonce;
|
544 |
-
data_order_items = data + "&action=order_exporter&method=get_used_custom_order_items_meta&mode=" + mode + "&id=" + job_id + '&woe_nonce='+ woe_nonce;
|
545 |
-
|
546 |
-
jQuery.post( ajaxurl, data_products, function( response ) {
|
547 |
-
if ( response ) {
|
548 |
-
var options = '<option></option>';
|
549 |
-
jQuery.each( response, function( index, value ) {
|
550 |
-
options += '<option value="' + escapeStr(value) + '">' + value + '</option>';
|
551 |
-
} );
|
552 |
-
jQuery( '#select_custom_meta_products' ).html( options );
|
553 |
-
jQuery( '#select_custom_meta_products' ).prop( "disabled", false );
|
554 |
-
}
|
555 |
-
}, 'json' );
|
556 |
-
|
557 |
-
jQuery.post( ajaxurl, data_order_items, function( response ) {
|
558 |
-
if ( response ) {
|
559 |
-
var options = '<option></option>';
|
560 |
-
jQuery.each( response, function( index, value ) {
|
561 |
-
options += '<option value="' + escapeStr(value) + '">' + value + '</option>';
|
562 |
-
} );
|
563 |
-
jQuery( '#select_custom_meta_order_items' ).html( options );
|
564 |
-
jQuery( '#select_custom_meta_order_items' ).prop( "disabled", false );
|
565 |
-
}
|
566 |
-
}, 'json' );
|
567 |
-
|
568 |
-
// jQuery('#modal-manage-products').html('');
|
569 |
-
}
|
570 |
-
});
|
571 |
-
jQuery('input[name=custom_meta_products_mode]').trigger('change');
|
572 |
-
|
573 |
-
jQuery('input[name=custom_meta_coupons_mode]').change(function() {
|
574 |
-
if (jQuery(this).val() == 'all') {
|
575 |
-
var options = '<option></option>';
|
576 |
-
jQuery.each( window.order_coupons_custom_meta_fields, function( index, value ) {
|
577 |
-
options += '<option value="' + escapeStr(value) + '">' + value + '</option>';
|
578 |
-
} );
|
579 |
-
jQuery( '#select_custom_meta_coupons' ).html( options );
|
580 |
-
}
|
581 |
-
else {
|
582 |
-
var data = jQuery( '#export_job_settings' ).serialize()
|
583 |
-
data = data + "&action=order_exporter&method=get_used_custom_coupons_meta&woe_nonce=" + woe_nonce;
|
584 |
-
|
585 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
586 |
-
if ( response ) {
|
587 |
-
var options = '<option></option>';
|
588 |
-
jQuery.each( response, function( index, value ) {
|
589 |
-
options += '<option value="' + escapeStr(value) + '">' + value + '</option>';
|
590 |
-
} );
|
591 |
-
jQuery( '#select_custom_meta_coupons' ).html( options );
|
592 |
-
}
|
593 |
-
}, 'json' );
|
594 |
-
}
|
595 |
-
});
|
596 |
-
|
597 |
-
jQuery( '#button_custom_meta' ).click( function() {
|
598 |
-
var label = jQuery( '#select_custom_meta_order' ).val();
|
599 |
-
var colname = jQuery( '#colname_custom_meta' ).val();
|
600 |
-
var format_field = jQuery( '#format_custom_meta' ).val();
|
601 |
-
if (! label) //try custom text
|
602 |
-
label = jQuery( '#text_custom_meta_order' ).val();;
|
603 |
-
if ( !label )
|
604 |
-
{
|
605 |
-
alert( export_messages.empty_meta_key );
|
606 |
-
jQuery( '#select_custom_meta_order' ).focus();
|
607 |
-
return false
|
608 |
-
}
|
609 |
-
if ( !colname )
|
610 |
-
{
|
611 |
-
alert( export_messages.empty_column_name );
|
612 |
-
jQuery( '#colname_custom_meta' ).focus();
|
613 |
-
return false
|
614 |
-
}
|
615 |
-
|
616 |
-
var segment = jQuery('.segment_choice.active').attr('data-segment');
|
617 |
-
|
618 |
-
add_custom_meta( jQuery( "#" + segment + '_unselected_segment' ), 'orders', output_format, label, colname, segment, format_field );
|
619 |
-
|
620 |
-
reset_field_contorls();
|
621 |
-
|
622 |
-
jQuery(this).siblings('.button-cancel').trigger('click');
|
623 |
-
|
624 |
-
return false;
|
625 |
-
} );
|
626 |
-
|
627 |
-
/////////////END CUSTOM FIELDS BINDS
|
628 |
-
|
629 |
-
// SHIPPING LOCATIONS
|
630 |
-
jQuery( '#shipping_locations' ).change( function() {
|
631 |
-
|
632 |
-
jQuery( '#text_shipping_locations' ).attr( 'disabled', 'disabled' );
|
633 |
-
var data = {
|
634 |
-
'item': jQuery( this ).val(),
|
635 |
-
method: "get_order_shipping_values",
|
636 |
-
action: "order_exporter",
|
637 |
-
woe_nonce: woe_nonce,
|
638 |
-
};
|
639 |
-
|
640 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
641 |
-
jQuery( '#text_shipping_locations--select2 select' ).select2('destroy');
|
642 |
-
jQuery( '#text_shipping_locations, #text_shipping_locations--select2' ).remove();
|
643 |
-
if ( response ) {
|
644 |
-
var options = '';
|
645 |
-
jQuery.each( response, function( index, value ) {
|
646 |
-
options += '<option>' + value + '</option>';
|
647 |
-
} );
|
648 |
-
|
649 |
-
var $select = jQuery( '<div id="text_shipping_locations--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top; display: inline-block;"><select id="text_shipping_locations">' + options + '</select></div>' );
|
650 |
-
$select.insertBefore( jQuery( '#add_shipping_locations' ) )
|
651 |
-
$select.find('select').select2_i18n({ tags: true });
|
652 |
-
}
|
653 |
-
else {
|
654 |
-
jQuery( '<input type="text" id="text_shipping_locations" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_shipping_locations' ) );
|
655 |
-
}
|
656 |
-
}, 'json' );
|
657 |
-
} );
|
658 |
-
|
659 |
-
jQuery( '#add_shipping_locations' ).click( function() {
|
660 |
-
|
661 |
-
var val = jQuery( "#text_shipping_locations" ).val();
|
662 |
-
var val2 = jQuery( '#shipping_locations' ).val();
|
663 |
-
var val_op = jQuery( '#shipping_compare' ).val();
|
664 |
-
if ( val != null && val2 != null && val.length && val2.length ) {
|
665 |
-
val = val2 + val_op + val;
|
666 |
-
|
667 |
-
var f = true;
|
668 |
-
jQuery( '#shipping_locations_check' ).next().find( 'ul li' ).each( function() {
|
669 |
-
if ( jQuery( this ).attr( 'title' ) == val ) {
|
670 |
-
f = false;
|
671 |
-
}
|
672 |
-
} );
|
673 |
-
|
674 |
-
if ( f ) {
|
675 |
-
|
676 |
-
jQuery( '#shipping_locations_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
677 |
-
jQuery( '#shipping_locations_check' ).select2_i18n(select2WODropdownOpts);
|
678 |
-
|
679 |
-
jQuery( '#shipping_locations_check option' ).each( function() {
|
680 |
-
jQuery( '#shipping_locations_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
681 |
-
} );
|
682 |
-
|
683 |
-
jQuery( "input#text_shipping_locations" ).val( '' );
|
684 |
-
}
|
685 |
-
}
|
686 |
-
return false;
|
687 |
-
} );
|
688 |
-
|
689 |
-
// BILLING LOCATIONS
|
690 |
-
jQuery( '#billing_locations' ).change( function() {
|
691 |
-
|
692 |
-
jQuery( '#text_billing_locations' ).attr( 'disabled', 'disabled' );
|
693 |
-
var data = {
|
694 |
-
'item': jQuery( this ).val(),
|
695 |
-
method: "get_order_billing_values",
|
696 |
-
action: "order_exporter",
|
697 |
-
woe_nonce: woe_nonce,
|
698 |
-
};
|
699 |
-
|
700 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
701 |
-
jQuery( '#text_billing_locations--select2 select' ).select2('destroy');
|
702 |
-
jQuery( '#text_billing_locations, #text_billing_locations--select2' ).remove();
|
703 |
-
if ( response ) {
|
704 |
-
var options = '';
|
705 |
-
jQuery.each( response, function( index, value ) {
|
706 |
-
options += '<option>' + value + '</option>';
|
707 |
-
} );
|
708 |
-
var $select = jQuery( '<div id="text_billing_locations--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top; display: inline-block;">'
|
709 |
-
+ '<select id="text_billing_locations">' + options + '</select></div>' );
|
710 |
-
$select.insertBefore( jQuery( '#add_billing_locations' ) )
|
711 |
-
$select.find('select').select2_i18n({ tags: true });
|
712 |
-
}
|
713 |
-
else {
|
714 |
-
jQuery( '<input type="text" id="text_billing_locations" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_billing_locations' ) );
|
715 |
-
}
|
716 |
-
}, 'json' );
|
717 |
-
} );
|
718 |
-
|
719 |
-
jQuery( '#add_billing_locations' ).click( function() {
|
720 |
-
|
721 |
-
var val = jQuery( "#text_billing_locations" ).val();
|
722 |
-
var val2 = jQuery( '#billing_locations' ).val();
|
723 |
-
var val_op = jQuery( '#billing_compare' ).val();
|
724 |
-
if ( val != null && val2 != null && val.length && val2.length ) {
|
725 |
-
val = val2 + val_op + val;
|
726 |
-
|
727 |
-
var f = true;
|
728 |
-
jQuery( '#billing_locations_check' ).next().find( 'ul li' ).each( function() {
|
729 |
-
if ( jQuery( this ).attr( 'title' ) == val ) {
|
730 |
-
f = false;
|
731 |
-
}
|
732 |
-
} );
|
733 |
-
|
734 |
-
if ( f ) {
|
735 |
-
|
736 |
-
jQuery( '#billing_locations_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
737 |
-
jQuery( '#billing_locations_check' ).select2_i18n(select2WODropdownOpts);
|
738 |
-
|
739 |
-
jQuery( '#billing_locations_check option' ).each( function() {
|
740 |
-
jQuery( '#billing_locations_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
741 |
-
} );
|
742 |
-
|
743 |
-
jQuery( "input#text_billing_locations" ).val( '' );
|
744 |
-
}
|
745 |
-
}
|
746 |
-
return false;
|
747 |
-
} )
|
748 |
-
|
749 |
-
|
750 |
-
// ITEM NAMES
|
751 |
-
jQuery( '#item_names' ).change( function() {
|
752 |
-
|
753 |
-
jQuery( '#text_item_names' ).attr( 'disabled', 'disabled' );
|
754 |
-
var data = {
|
755 |
-
'item_type': jQuery( this ).val(),
|
756 |
-
method: "get_order_item_names",
|
757 |
-
action: "order_exporter",
|
758 |
-
woe_nonce: woe_nonce,
|
759 |
-
};
|
760 |
-
|
761 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
762 |
-
jQuery( '#text_item_names--select2 select' ).select2('destroy');
|
763 |
-
jQuery( '#text_item_names, #text_item_names--select2' ).remove();
|
764 |
-
if ( response ) {
|
765 |
-
var options = '';
|
766 |
-
jQuery.each( response, function( index, value ) {
|
767 |
-
options += '<option>' + value + '</option>';
|
768 |
-
} );
|
769 |
-
|
770 |
-
var $select = jQuery( '<div id="text_item_names--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top; display: inline-block;"><select id="text_item_names">' + options + '</select></div>' );
|
771 |
-
$select.insertBefore( jQuery( '#add_item_names' ) )
|
772 |
-
$select.find('select').select2_i18n({ tags: true });
|
773 |
-
}
|
774 |
-
else {
|
775 |
-
jQuery( '<input type="text" id="text_item_names" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_item_names' ) );
|
776 |
-
}
|
777 |
-
}, 'json' );
|
778 |
-
} );
|
779 |
-
|
780 |
-
jQuery( '#add_item_names' ).click( function() {
|
781 |
-
|
782 |
-
var val = jQuery( "#text_item_names" ).val();
|
783 |
-
var val2 = jQuery( '#item_names' ).val();
|
784 |
-
var val_op = jQuery( '#item_name_compare' ).val();
|
785 |
-
if ( val != null && val2 != null && val.length && val2.length ) {
|
786 |
-
val = val2 + val_op + val;
|
787 |
-
|
788 |
-
var f = true;
|
789 |
-
jQuery( '#item_names_check' ).next().find( 'ul li' ).each( function() {
|
790 |
-
if ( jQuery( this ).attr( 'title' ) == val ) {
|
791 |
-
f = false;
|
792 |
-
}
|
793 |
-
} );
|
794 |
-
|
795 |
-
if ( f ) {
|
796 |
-
|
797 |
-
jQuery( '#item_names_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
798 |
-
jQuery( '#item_names_check' ).select2_i18n(select2WODropdownOpts);
|
799 |
-
|
800 |
-
jQuery( '#item_names_check option' ).each( function() {
|
801 |
-
jQuery( '#item_names_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
802 |
-
} );
|
803 |
-
|
804 |
-
jQuery( "input#text_item_names" ).val( '' );
|
805 |
-
}
|
806 |
-
}
|
807 |
-
return false;
|
808 |
-
} );
|
809 |
-
|
810 |
-
// ITEM METADATA
|
811 |
-
jQuery( '#item_metadata' ).change( function() {
|
812 |
-
|
813 |
-
jQuery( '#text_item_metadata' ).attr( 'disabled', 'disabled' );
|
814 |
-
var data = {
|
815 |
-
'meta_key': jQuery( this ).val(),
|
816 |
-
method: "get_order_item_meta_key_values",
|
817 |
-
action: "order_exporter",
|
818 |
-
woe_nonce: woe_nonce,
|
819 |
-
};
|
820 |
-
|
821 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
822 |
-
jQuery( '#text_item_metadata--select2 select' ).select2('destroy');
|
823 |
-
jQuery( '#text_item_metadata, #text_item_metadata--select2' ).remove();
|
824 |
-
if ( response ) {
|
825 |
-
var options = '';
|
826 |
-
jQuery.each( response, function( index, value ) {
|
827 |
-
options += '<option>' + value + '</option>';
|
828 |
-
} );
|
829 |
-
|
830 |
-
var $select = jQuery( '<div id="text_item_metadata--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top; display: inline-block;"><select id="text_item_metadata">' + options + '</select></div>' );
|
831 |
-
$select.insertBefore( jQuery( '#add_item_metadata' ) )
|
832 |
-
$select.find('select').select2_i18n({ tags: true });
|
833 |
-
}
|
834 |
-
else {
|
835 |
-
jQuery( '<input type="text" id="text_item_metadata" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_item_metadata' ) );
|
836 |
-
}
|
837 |
-
}, 'json' );
|
838 |
-
} );
|
839 |
-
|
840 |
-
jQuery( '#add_item_metadata' ).click( function() {
|
841 |
-
|
842 |
-
var val = jQuery( "#text_item_metadata" ).val();
|
843 |
-
var val2 = jQuery( '#item_metadata' ).val();
|
844 |
-
var val_op = jQuery( '#item_metadata_compare' ).val();
|
845 |
-
if ( val != null && val2 != null && val.length && val2.length ) {
|
846 |
-
val = val2 + val_op + val;
|
847 |
-
|
848 |
-
var f = true;
|
849 |
-
jQuery( '#item_metadata_check' ).next().find( 'ul li' ).each( function() {
|
850 |
-
if ( jQuery( this ).attr( 'title' ) == val ) {
|
851 |
-
f = false;
|
852 |
-
}
|
853 |
-
} );
|
854 |
-
|
855 |
-
if ( f ) {
|
856 |
-
|
857 |
-
jQuery( '#item_metadata_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
858 |
-
jQuery( '#item_metadata_check' ).select2_i18n(select2WODropdownOpts);
|
859 |
-
|
860 |
-
jQuery( '#item_metadata_check option' ).each( function() {
|
861 |
-
jQuery( '#item_metadata_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
862 |
-
} );
|
863 |
-
|
864 |
-
jQuery( "input#text_item_metadata" ).val( '' );
|
865 |
-
}
|
866 |
-
}
|
867 |
-
return false;
|
868 |
-
} );
|
869 |
-
|
870 |
-
}
|
871 |
-
|
872 |
-
function bind_events_users() {
|
873 |
-
// for filter by ORDER custom fields
|
874 |
-
jQuery( '#user_custom_fields' ).change( function () {
|
875 |
-
|
876 |
-
jQuery( '#select_user_custom_fields' ).attr( 'disabled', 'disabled' );
|
877 |
-
var data = {
|
878 |
-
'cf_name': jQuery( this ).val(),
|
879 |
-
method: "get_user_custom_fields_values",
|
880 |
-
action: "order_exporter",
|
881 |
-
woe_nonce: woe_nonce,
|
882 |
-
};
|
883 |
-
var val_op = jQuery( '#select_user_custom_fields' ).val();
|
884 |
-
jQuery( '#text_user_custom_fields' ).val( '' );
|
885 |
-
jQuery.post( ajaxurl, data, function ( response ) {
|
886 |
-
jQuery( '#select_user_custom_fields' ).remove();
|
887 |
-
jQuery( '#select_user_custom_fields--select2 select' ).select2( 'destroy' );
|
888 |
-
jQuery( '#select_user_custom_fields, #select_user_custom_fields--select2' ).remove();
|
889 |
-
if ( response ) {
|
890 |
-
var options = '<option>' + export_messages.empty + '</option>';
|
891 |
-
jQuery.each( response, function ( index, value ) {
|
892 |
-
options += '<option>' + value + '</option>';
|
893 |
-
} );
|
894 |
-
var $select = jQuery( '<div id="select_user_custom_fields--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
895 |
-
+ 'display: ' + (
|
896 |
-
(
|
897 |
-
'LIKE' === val_op || 'NOT SET' === val_op || 'IS SET' === val_op
|
898 |
-
) ? 'none' : 'inline-block'
|
899 |
-
) + ';">'
|
900 |
-
+ '<select id="select_user_custom_fields">' + options + '</select></div>' );
|
901 |
-
$select.insertBefore( jQuery( '#add_user_custom_fields' ) )
|
902 |
-
$select.find( 'select' ).select2_i18n( {tags: true} );
|
903 |
-
}
|
904 |
-
else {
|
905 |
-
jQuery( '<input type="text" id="select_user_custom_fields" style="margin-right: 8px;">' ).insertBefore(
|
906 |
-
jQuery( '#add_user_custom_fields' ) );
|
907 |
-
}
|
908 |
-
}, 'json' );
|
909 |
-
} );
|
910 |
-
jQuery( '#add_user_custom_fields' ).click( function () {
|
911 |
-
|
912 |
-
var val = ! jQuery( "#select_user_custom_fields" ).is( ':disabled' ) ? jQuery(
|
913 |
-
"#select_user_custom_fields" ).val() : jQuery( "#text_user_custom_fields" ).val();
|
914 |
-
var val2 = jQuery( '#user_custom_fields' ).val();
|
915 |
-
var val_op = jQuery( '#user_custom_fields_compare' ).val();
|
916 |
-
if ( val != null && val2 != null && val.length && val2.length ) {
|
917 |
-
var result = val2 + ' ' + val_op + ' ' + val;
|
918 |
-
|
919 |
-
var f = true;
|
920 |
-
jQuery( '#user_custom_fields_check' ).next().find( 'ul li' ).each( function () {
|
921 |
-
if ( jQuery( this ).attr( 'title' ) == val ) {
|
922 |
-
f = false;
|
923 |
-
}
|
924 |
-
} );
|
925 |
-
|
926 |
-
if ( f ) {
|
927 |
-
if ( export_messages.empty === val ) {
|
928 |
-
result = val2 + ' ' + val_op + ' empty';
|
929 |
-
jQuery(
|
930 |
-
'#user_custom_fields_check' ).append( '<option selected="selected" value="' + result + '">' + result + '</option>' );
|
931 |
-
} else {
|
932 |
-
jQuery(
|
933 |
-
'#user_custom_fields_check' ).append( '<option selected="selected" value="' + result + '">' + result + '</option>' );
|
934 |
-
}
|
935 |
-
|
936 |
-
jQuery( '#user_custom_fields_check' ).select2_i18n();
|
937 |
-
|
938 |
-
jQuery( '#user_custom_fields_check option' ).each( function () {
|
939 |
-
jQuery( '#user_custom_fields_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
940 |
-
} );
|
941 |
-
|
942 |
-
jQuery( "input#select_user_custom_fields" ).val( '' );
|
943 |
-
}
|
944 |
-
}
|
945 |
-
return false;
|
946 |
-
} );
|
947 |
-
|
948 |
-
jQuery( '#user_custom_fields_compare').change(function() {
|
949 |
-
var val_op = jQuery( '#user_custom_fields_compare' ).val();
|
950 |
-
if ( 'LIKE' === val_op ) {
|
951 |
-
jQuery( "#select_user_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
952 |
-
jQuery( "#select_user_custom_fields--select2" ).hide();
|
953 |
-
jQuery( "#text_user_custom_fields" ).css('display', 'inline' ).attr( 'disabled', false );
|
954 |
-
}
|
955 |
-
else if ( 'NOT SET' === val_op || 'IS SET' === val_op ) {
|
956 |
-
jQuery( "#select_user_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' ) . val(' ');
|
957 |
-
jQuery( "#select_user_custom_fields--select2" ).hide();
|
958 |
-
jQuery( "#text_user_custom_fields" ).css('display', 'none' ).attr( 'disabled', false ). val(' ');
|
959 |
-
}
|
960 |
-
else {
|
961 |
-
jQuery( "#select_user_custom_fields" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
962 |
-
jQuery( '#select_user_custom_fields--select2' ).css('display', 'inline' );
|
963 |
-
jQuery( "#text_user_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
964 |
-
}
|
965 |
-
});
|
966 |
-
}
|
967 |
-
|
968 |
-
function add_bind_for_custom_fields( prefix, output_format, $to ) {
|
969 |
-
jQuery( '#button_custom_field_' + prefix + '' ).off();
|
970 |
-
jQuery( '#button_custom_field_' + prefix + '' ).click( function() {
|
971 |
-
var colname = jQuery( '#colname_custom_field_' + prefix + '' ).val();
|
972 |
-
var value = jQuery( '#value_custom_field_' + prefix + '' ).val();
|
973 |
-
var format_field = jQuery( '#format_custom_field_' + prefix + '' ).val();
|
974 |
-
if ( !colname )
|
975 |
-
{
|
976 |
-
alert( export_messages.empty_column_name );
|
977 |
-
jQuery( '#colname_custom_field_' + prefix + '' ).focus();
|
978 |
-
return false
|
979 |
-
}
|
980 |
-
if ( !value && 'products' !== prefix )
|
981 |
-
{
|
982 |
-
alert( export_messages.empty_value );
|
983 |
-
jQuery( '#value_custom_field_' + prefix + '' ).focus();
|
984 |
-
return false
|
985 |
-
}
|
986 |
-
|
987 |
-
jQuery( '#colname_custom_field_' + prefix + '' ).val( "" );
|
988 |
-
|
989 |
-
jQuery( '#value_custom_field_' + prefix + '' ).val( "" );
|
990 |
-
jQuery( '#format_custom_field_' + prefix + '' ).val( "" );
|
991 |
-
|
992 |
-
var segment = jQuery('.segment_choice.active').attr('data-segment');
|
993 |
-
|
994 |
-
add_custom_field( jQuery( "#" + segment + '_unselected_segment' ), prefix, output_format, colname, value, segment, format_field );
|
995 |
-
|
996 |
-
jQuery(this).siblings('.button-cancel').trigger('click');
|
997 |
-
|
998 |
-
return false;
|
999 |
-
} );
|
1000 |
-
|
1001 |
-
jQuery( '#button_custom_meta_' + prefix + '' ).off();
|
1002 |
-
jQuery( '#button_custom_meta_' + prefix + '' ).click( function() {
|
1003 |
-
var prefix_items = 'order_items',
|
1004 |
-
original_prefix = prefix,
|
1005 |
-
prefix_items_select = jQuery( '#select_custom_meta_' + prefix_items + '' ),
|
1006 |
-
prefix_product_select = jQuery( '#select_custom_meta_' + prefix + '' ),
|
1007 |
-
prefix_product_text = jQuery( '#text_custom_meta_' + prefix + '' ),
|
1008 |
-
prefix_items_text = jQuery( '#text_custom_meta_' + prefix_items + '' );
|
1009 |
-
|
1010 |
-
var type = (
|
1011 |
-
prefix_items_select.val() ||
|
1012 |
-
prefix_product_select.val() ||
|
1013 |
-
prefix_product_text.val() ||
|
1014 |
-
prefix_items_text.val()
|
1015 |
-
) ? 'meta' : 'taxonomies';
|
1016 |
-
|
1017 |
-
if ( 'meta' === type ) {
|
1018 |
-
original_prefix = prefix_product_select.val() || prefix_product_text.val() ? prefix : prefix_items;
|
1019 |
-
} else {
|
1020 |
-
original_prefix = prefix;
|
1021 |
-
}
|
1022 |
-
type = type + '_' + original_prefix;
|
1023 |
-
var label = jQuery( '#select_custom_' + type + '' ).val();
|
1024 |
-
var colname = jQuery( '#colname_custom_meta_' + prefix + '' ).val();
|
1025 |
-
var field_format = jQuery( '#format_custom_meta_' + prefix + '' ).val();
|
1026 |
-
|
1027 |
-
if (! label ) //try custom text
|
1028 |
-
label = jQuery( '#text_custom_' + type ).val();
|
1029 |
-
|
1030 |
-
if ( !label )
|
1031 |
-
{
|
1032 |
-
alert( export_messages.empty_meta_key_and_taxonomy );
|
1033 |
-
return false
|
1034 |
-
}
|
1035 |
-
if ( colname == undefined || colname == '' ) {
|
1036 |
-
colname = label;
|
1037 |
-
}
|
1038 |
-
if ( !colname )
|
1039 |
-
{
|
1040 |
-
alert( export_messages.empty_column_name );
|
1041 |
-
return false
|
1042 |
-
}
|
1043 |
-
|
1044 |
-
var segment = jQuery('.segment_choice.active').attr('data-segment');
|
1045 |
-
|
1046 |
-
add_custom_meta( jQuery( "#" + segment + '_unselected_segment' ), prefix, output_format, label, colname, segment, field_format );
|
1047 |
-
|
1048 |
-
jQuery(this).siblings('.button-cancel').trigger('click');
|
1049 |
-
|
1050 |
-
jQuery( '#select_custom_' + type + '' ).val( "" );
|
1051 |
-
jQuery( '#colname_custom_meta_' + prefix + '' ).val( "" );
|
1052 |
-
jQuery( '#format_custom_meta_' + prefix + '' ).val( "" );
|
1053 |
-
return false;
|
1054 |
-
} );
|
1055 |
-
|
1056 |
-
}
|
1057 |
-
|
1058 |
-
function reset_field_contorls() {
|
1059 |
-
jQuery( '.tab-actions-forms' )
|
1060 |
-
.find( 'input,select' )
|
1061 |
-
.val( '' );
|
1062 |
-
}
|
1063 |
-
|
1064 |
-
function reset_field_contorls_() {
|
1065 |
-
jQuery( '#fields_control' )
|
1066 |
-
.find( 'input' )
|
1067 |
-
.not('.segment_products input')
|
1068 |
-
.not('.segment_coupons input')
|
1069 |
-
.val( '' );
|
1070 |
-
jQuery( "#fields_control > div" ).hide();
|
1071 |
-
jQuery( "#fields_control .div1" ).show();
|
1072 |
-
jQuery( "#fields_control .div2" ).show();
|
1073 |
-
jQuery( "#fields_control .flat_format_controls" ).show();
|
1074 |
-
}
|
1075 |
-
|
1076 |
-
function formatItem( item ) {
|
1077 |
-
var markup = '<div class="clearfix">' +
|
1078 |
-
'<div>';
|
1079 |
-
if ( typeof item.photo_url !== "undefined" )
|
1080 |
-
markup += '<img src="' + item.photo_url + '" style="width: 20%;float:left;" />';
|
1081 |
-
markup += '<div style="width:75%;float:left; padding: 5px;">' + item.text + '</div>' +
|
1082 |
-
'</div>' +
|
1083 |
-
'</div><div style="clear:both"></div>';
|
1084 |
-
|
1085 |
-
return markup;
|
1086 |
-
}
|
1087 |
-
|
1088 |
-
function add_custom_field( to, index_p, format, colname, value, segment, format_field ) {
|
1089 |
-
|
1090 |
-
value = escapeStr(value);
|
1091 |
-
colname = escapeStr(colname);
|
1092 |
-
|
1093 |
-
if ( is_flat_format(format) ) {
|
1094 |
-
_index = 'plain_' + index_p + '_';
|
1095 |
-
_index_p = 'orders[]';
|
1096 |
-
} else {
|
1097 |
-
_index = '';
|
1098 |
-
_index_p = index_p + '[]';
|
1099 |
-
}
|
1100 |
-
|
1101 |
-
var label_prefix = '';
|
1102 |
-
|
1103 |
-
if (is_flat_format(format)) {
|
1104 |
-
|
1105 |
-
if (segment === 'products' ) {
|
1106 |
-
label_prefix = '[P] '
|
1107 |
-
}
|
1108 |
-
|
1109 |
-
if (segment === 'coupons' ) {
|
1110 |
-
label_prefix = '[C] '
|
1111 |
-
}
|
1112 |
-
}
|
1113 |
-
|
1114 |
-
var suffix = 0;
|
1115 |
-
|
1116 |
-
jQuery('#unselected_fields input[value*="static_field_"]').each(function () {
|
1117 |
-
|
1118 |
-
var match = jQuery(this).attr('value').match(/static_field_(\d+)/);
|
1119 |
-
|
1120 |
-
if (!match) {
|
1121 |
-
return true;
|
1122 |
-
}
|
1123 |
-
|
1124 |
-
var n = parseInt(match[1]);
|
1125 |
-
|
1126 |
-
if(n > suffix) {
|
1127 |
-
suffix = n;
|
1128 |
-
}
|
1129 |
-
});
|
1130 |
-
|
1131 |
-
var field_key = 'static_field_' + (suffix + 1);
|
1132 |
-
|
1133 |
-
var delete_btn = '<div class="mapping_col_3 mapping_row-delete_field_block"><a href="#" class="mapping_row-delete_field"><span class="dashicons dashicons-trash"></span></a></div>';
|
1134 |
-
|
1135 |
-
// console.log( to, index_p, format, colname, value );
|
1136 |
-
var row = jQuery('<li class="mapping_row segment_field segment_'+ segment +'">\
|
1137 |
-
<div class="mapping_col_1" style="width: 10px">\
|
1138 |
-
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[segment]" value="'+ (segment ? segment : 'misc') +'">\
|
1139 |
-
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[key]" value="'+ _index + field_key +'">\
|
1140 |
-
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[label]" value="' + colname + '">\
|
1141 |
-
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[format]" value="' + format_field + '">\
|
1142 |
-
</div>\
|
1143 |
-
<div class="mapping_col_2" title="'+field_key+'">' + '<span class="field-prefix">' + label_prefix + '</span>' + colname + '<a href="#" onclick="return remove_custom_field(this);" class="mapping_row-delete_custom_field" style="float: right;"><span class="ui-icon ui-icon-trash"></span></a></div>\
|
1144 |
-
<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="' + _index_p + '[colname]" value="' + colname + '"></div>\
|
1145 |
-
<div class="mapping_col_3 custom-field-value"><input class="mapping_fieldname" type=input name="' + _index_p + '[value]" value="' + value + '"></div>'+ delete_btn +'\
|
1146 |
-
</li>\
|
1147 |
-
');
|
1148 |
-
|
1149 |
-
row.find('input').prop('disabled', 'disabled');
|
1150 |
-
|
1151 |
-
to.prepend( row );
|
1152 |
-
|
1153 |
-
activate_draggable_field(
|
1154 |
-
to.find('.segment_field').first(),
|
1155 |
-
segment,
|
1156 |
-
format
|
1157 |
-
);
|
1158 |
-
|
1159 |
-
to.find('.segment_field').first().addClass('blink');
|
1160 |
-
|
1161 |
-
var field = {
|
1162 |
-
key: field_key,
|
1163 |
-
colname: colname,
|
1164 |
-
'default': 0,
|
1165 |
-
label: colname,
|
1166 |
-
format: 'string',
|
1167 |
-
value: value,
|
1168 |
-
};
|
1169 |
-
|
1170 |
-
window.all_fields[segment].unshift(field);
|
1171 |
-
}
|
1172 |
-
|
1173 |
-
function add_custom_meta( to, index_p, format, label, colname, segment, format_field ) {
|
1174 |
-
|
1175 |
-
label = escapeStr(label);
|
1176 |
-
colname = escapeStr(colname);
|
1177 |
-
|
1178 |
-
if ( is_flat_format(format) ) {
|
1179 |
-
_index = 'plain_' + index_p + '_' + label;
|
1180 |
-
_index_p = 'orders[]';
|
1181 |
-
} else {
|
1182 |
-
_index = label;
|
1183 |
-
_index_p = index_p + '[]';
|
1184 |
-
}
|
1185 |
-
|
1186 |
-
var label_prefix = '';
|
1187 |
-
|
1188 |
-
if (is_flat_format(format)) {
|
1189 |
-
|
1190 |
-
if (segment === 'products' ) {
|
1191 |
-
label_prefix = '[P] '
|
1192 |
-
}
|
1193 |
-
|
1194 |
-
if (segment === 'coupons' ) {
|
1195 |
-
label_prefix = '[C] '
|
1196 |
-
}
|
1197 |
-
}
|
1198 |
-
|
1199 |
-
var delete_btn = '<div class="mapping_col_3 mapping_row-delete_field_block"><a href="#" class="mapping_row-delete_field"><span class="dashicons dashicons-trash"></span></a></div>';
|
1200 |
-
|
1201 |
-
var row = jQuery('<li class="mapping_row segment_field segment_'+ segment +'">\
|
1202 |
-
<div class="mapping_col_1" style="width: 10px">\
|
1203 |
-
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[segment]" value="'+ (segment ? segment : 'misc') +'">\
|
1204 |
-
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[key]" value="'+ _index +'">\
|
1205 |
-
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[label]" value="' + label + '">\
|
1206 |
-
<input class="mapping_fieldname" type=hidden name="' + _index_p + '[format]" value="' + format_field + '">\
|
1207 |
-
</div>\
|
1208 |
-
<div class="mapping_col_2" title="'+label+'">' + '<span class="field-prefix">' + label_prefix + '</span>' + label + '<a href="#" onclick="return remove_custom_field(this);" class="mapping_row-delete_custom_field" style="float: right;"><span class="ui-icon ui-icon-trash"></span></a></div>\
|
1209 |
-
<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="' + _index_p + '[colname]" value="' + colname + '"></div>'+ delete_btn +'\
|
1210 |
-
</li>\
|
1211 |
-
');
|
1212 |
-
|
1213 |
-
row.find('input').prop('disabled', 'disabled');
|
1214 |
-
|
1215 |
-
to.prepend( row );
|
1216 |
-
|
1217 |
-
activate_draggable_field(
|
1218 |
-
to.find('.segment_field').first(),
|
1219 |
-
segment,
|
1220 |
-
format
|
1221 |
-
);
|
1222 |
-
|
1223 |
-
to.find('.segment_field').first().addClass('blink');
|
1224 |
-
|
1225 |
-
var field = {
|
1226 |
-
key: label,
|
1227 |
-
colname: colname,
|
1228 |
-
'default': 0,
|
1229 |
-
label: label,
|
1230 |
-
segment: segment,
|
1231 |
-
format: 'string',
|
1232 |
-
value: 'undefined',
|
1233 |
-
};
|
1234 |
-
|
1235 |
-
window.all_fields[segment].unshift(field);
|
1236 |
-
}
|
1237 |
-
|
1238 |
-
function scroll_to_added_field( to ) {
|
1239 |
-
// scroll to added element
|
1240 |
-
|
1241 |
-
to.parent().scrollTop(to[0].scrollHeight);
|
1242 |
-
|
1243 |
-
if ( to.parent().prop('id') === 'fields' ) {
|
1244 |
-
jQuery( window ).scrollTop( to.parent().offset().top + to.parent().outerHeight() - jQuery( window ).height() / 2 );
|
1245 |
-
}
|
1246 |
-
}
|
1247 |
-
|
1248 |
-
function formatItemSelection( item ) {
|
1249 |
-
return item.text;
|
1250 |
-
}
|
1251 |
-
|
1252 |
-
jQuery.fn.extend(
|
1253 |
-
{
|
1254 |
-
select2_i18n: function ($attrs) {
|
1255 |
-
if ( typeof $attrs !== 'object' ) {
|
1256 |
-
$attrs = {};
|
1257 |
-
}
|
1258 |
-
$attrs = Object.assign({ language: script_data.select2_locale }, $attrs);
|
1259 |
-
jQuery(this).select2($attrs);
|
1260 |
-
}
|
1261 |
-
} );
|
1262 |
-
|
1263 |
-
function select2_inits()
|
1264 |
-
{
|
1265 |
-
jQuery( "#from_status, #to_status" ).select2_i18n({multiple: true});
|
1266 |
-
jQuery( "#statuses" ).select2_i18n();
|
1267 |
-
jQuery( "#shipping_methods" ).select2_i18n();
|
1268 |
-
jQuery( "#user_roles" ).select2_i18n();
|
1269 |
-
jQuery( "#payment_methods" ).select2_i18n();
|
1270 |
-
jQuery( "#attributes" ).select2_i18n( {
|
1271 |
-
width: 150
|
1272 |
-
} );
|
1273 |
-
jQuery( "#attributes_check" ).select2_i18n(select2WODropdownOpts);
|
1274 |
-
jQuery( "#itemmeta" ).select2_i18n( {
|
1275 |
-
width: 220
|
1276 |
-
} );
|
1277 |
-
jQuery( "#itemmeta_check" ).select2_i18n(select2WODropdownOpts);
|
1278 |
-
|
1279 |
-
jQuery( "#custom_fields" ).select2_i18n( {
|
1280 |
-
width: 150
|
1281 |
-
} );
|
1282 |
-
jQuery( "#custom_fields_check" ).select2_i18n();
|
1283 |
-
|
1284 |
-
jQuery( "#product_custom_fields" ).select2_i18n( {
|
1285 |
-
width: 150
|
1286 |
-
} );
|
1287 |
-
jQuery( "#product_custom_fields_check" ).select2_i18n(select2WODropdownOpts);
|
1288 |
-
|
1289 |
-
jQuery( "#user_custom_fields" ).select2_i18n( {
|
1290 |
-
width: 150
|
1291 |
-
} );
|
1292 |
-
jQuery( "#user_custom_fields_check" ).select2_i18n();
|
1293 |
-
|
1294 |
-
jQuery( "#taxonomies" ).select2_i18n( {
|
1295 |
-
width: 150
|
1296 |
-
} );
|
1297 |
-
jQuery( "#taxonomies_check" ).select2_i18n(select2WODropdownOpts);
|
1298 |
-
|
1299 |
-
jQuery( "#shipping_locations" ).select2_i18n( {
|
1300 |
-
width: 150
|
1301 |
-
} );
|
1302 |
-
jQuery( "#shipping_locations_check" ).select2_i18n(select2WODropdownOpts);
|
1303 |
-
|
1304 |
-
jQuery( "#billing_locations" ).select2_i18n( {
|
1305 |
-
width: 150
|
1306 |
-
} );
|
1307 |
-
jQuery( "#billing_locations_check" ).select2_i18n(select2WODropdownOpts);
|
1308 |
-
|
1309 |
-
jQuery( "#item_names" ).select2_i18n( {
|
1310 |
-
width: 150
|
1311 |
-
} );
|
1312 |
-
jQuery( "#item_names_check" ).select2_i18n(select2WODropdownOpts);
|
1313 |
-
|
1314 |
-
jQuery( "#item_metadata" ).select2_i18n( {
|
1315 |
-
width: 150
|
1316 |
-
} );
|
1317 |
-
jQuery( "#item_metadata_check" ).select2_i18n(select2WODropdownOpts);
|
1318 |
-
|
1319 |
-
jQuery( "#product_categories" ).select2_i18n( {
|
1320 |
-
ajax: {
|
1321 |
-
url: ajaxurl,
|
1322 |
-
dataType: 'json',
|
1323 |
-
delay: 250,
|
1324 |
-
data: function( params ) {
|
1325 |
-
return {
|
1326 |
-
q: params.term, // search term
|
1327 |
-
page: params.page,
|
1328 |
-
method: "get_categories",
|
1329 |
-
action: "order_exporter"
|
1330 |
-
};
|
1331 |
-
},
|
1332 |
-
processResults: function( data, page ) {
|
1333 |
-
// parse the results into the format expected by Select2.
|
1334 |
-
// since we are using custom formatting functions we do not need to
|
1335 |
-
// alter the remote JSON data
|
1336 |
-
return {
|
1337 |
-
results: data
|
1338 |
-
};
|
1339 |
-
},
|
1340 |
-
cache: true
|
1341 |
-
},
|
1342 |
-
escapeMarkup: function( markup ) {
|
1343 |
-
return markup;
|
1344 |
-
}, // let our custom formatter work
|
1345 |
-
minimumInputLength: 3,
|
1346 |
-
templateResult: formatItem, // omitted for brevity, see the source of this page
|
1347 |
-
templateSelection: formatItemSelection // omitted for brevity, see the source of this page
|
1348 |
-
} );
|
1349 |
-
|
1350 |
-
jQuery( "#product_vendors" ).select2_i18n( {
|
1351 |
-
ajax: {
|
1352 |
-
url: ajaxurl,
|
1353 |
-
dataType: 'json',
|
1354 |
-
delay: 250,
|
1355 |
-
data: function( params ) {
|
1356 |
-
return {
|
1357 |
-
q: params.term, // search term
|
1358 |
-
page: params.page,
|
1359 |
-
method: "get_vendors",
|
1360 |
-
action: "order_exporter"
|
1361 |
-
};
|
1362 |
-
},
|
1363 |
-
processResults: function( data, page ) {
|
1364 |
-
// parse the results into the format expected by Select2.
|
1365 |
-
// since we are using custom formatting functions we do not need to
|
1366 |
-
// alter the remote JSON data
|
1367 |
-
return {
|
1368 |
-
results: data
|
1369 |
-
};
|
1370 |
-
},
|
1371 |
-
cache: true
|
1372 |
-
},
|
1373 |
-
escapeMarkup: function( markup ) {
|
1374 |
-
return markup;
|
1375 |
-
}, // let our custom formatter work
|
1376 |
-
minimumInputLength: 3,
|
1377 |
-
templateResult: formatItem, // omitted for brevity, see the source of this page
|
1378 |
-
templateSelection: formatItemSelection // omitted for brevity, see the source of this page
|
1379 |
-
} );
|
1380 |
-
|
1381 |
-
jQuery( "#products" ).select2_i18n( {
|
1382 |
-
ajax: {
|
1383 |
-
url: ajaxurl,
|
1384 |
-
dataType: 'json',
|
1385 |
-
delay: 250,
|
1386 |
-
data: function( params ) {
|
1387 |
-
return {
|
1388 |
-
q: params.term, // search term
|
1389 |
-
page: params.page,
|
1390 |
-
method: "get_products",
|
1391 |
-
action: "order_exporter"
|
1392 |
-
};
|
1393 |
-
},
|
1394 |
-
processResults: function( data, page ) {
|
1395 |
-
// parse the results into the format expected by Select2.
|
1396 |
-
// since we are using custom formatting functions we do not need to
|
1397 |
-
// alter the remote JSON data
|
1398 |
-
return {
|
1399 |
-
results: data
|
1400 |
-
};
|
1401 |
-
},
|
1402 |
-
cache: true
|
1403 |
-
},
|
1404 |
-
escapeMarkup: function( markup ) {
|
1405 |
-
return markup;
|
1406 |
-
}, // let our custom formatter work
|
1407 |
-
minimumInputLength: 3,
|
1408 |
-
templateResult: formatItem, // omitted for brevity, see the source of this page
|
1409 |
-
templateSelection: formatItemSelection // omitted for brevity, see the source of this page
|
1410 |
-
} );
|
1411 |
-
|
1412 |
-
jQuery( "#user_names" ).select2_i18n( {
|
1413 |
-
ajax: {
|
1414 |
-
url: ajaxurl,
|
1415 |
-
dataType: 'json',
|
1416 |
-
delay: 250,
|
1417 |
-
data: function( params ) {
|
1418 |
-
return {
|
1419 |
-
q: params.term, // search term
|
1420 |
-
page: params.page,
|
1421 |
-
method: "get_users",
|
1422 |
-
action: "order_exporter"
|
1423 |
-
};
|
1424 |
-
},
|
1425 |
-
processResults: function( data, page ) {
|
1426 |
-
// parse the results into the format expected by Select2.
|
1427 |
-
// since we are using custom formatting functions we do not need to
|
1428 |
-
// alter the remote JSON data
|
1429 |
-
return {
|
1430 |
-
results: data
|
1431 |
-
};
|
1432 |
-
},
|
1433 |
-
cache: true
|
1434 |
-
},
|
1435 |
-
escapeMarkup: function( markup ) {
|
1436 |
-
return markup;
|
1437 |
-
}, // let our custom formatter work
|
1438 |
-
minimumInputLength: 3,
|
1439 |
-
templateResult: formatItem, // omitted for brevity, see the source of this page
|
1440 |
-
templateSelection: formatItemSelection // omitted for brevity, see the source of this page
|
1441 |
-
} );
|
1442 |
-
|
1443 |
-
jQuery( "#coupons" ).select2_i18n( {
|
1444 |
-
ajax: {
|
1445 |
-
url: ajaxurl,
|
1446 |
-
dataType: 'json',
|
1447 |
-
delay: 250,
|
1448 |
-
data: function( params ) {
|
1449 |
-
return {
|
1450 |
-
q: params.term, // search term
|
1451 |
-
page: params.page,
|
1452 |
-
method: "get_coupons",
|
1453 |
-
action: "order_exporter"
|
1454 |
-
};
|
1455 |
-
},
|
1456 |
-
processResults: function( data, page ) {
|
1457 |
-
// parse the results into the format expected by Select2.
|
1458 |
-
// since we are using custom formatting functions we do not need to
|
1459 |
-
// alter the remote JSON data
|
1460 |
-
return {
|
1461 |
-
results: data
|
1462 |
-
};
|
1463 |
-
},
|
1464 |
-
cache: true
|
1465 |
-
},
|
1466 |
-
escapeMarkup: function( markup ) {
|
1467 |
-
return markup;
|
1468 |
-
}, // let our custom formatter work
|
1469 |
-
minimumInputLength: 3,
|
1470 |
-
templateResult: formatItem, // omitted for brevity, see the source of this page
|
1471 |
-
templateSelection: formatItemSelection // omitted for brevity, see the source of this page
|
1472 |
-
} );
|
1473 |
-
}
|
1474 |
-
|
1475 |
-
function escapeStr(str)
|
1476 |
-
{
|
1477 |
-
var entityMap = {
|
1478 |
-
"&": "&",
|
1479 |
-
"<": "<",
|
1480 |
-
">": ">",
|
1481 |
-
'"': '"',
|
1482 |
-
"'": ''',
|
1483 |
-
"/": '/'
|
1484 |
-
};
|
1485 |
-
|
1486 |
-
jQuery.each( entityMap, function( key, value ) {
|
1487 |
-
str = String(str).replace( value, key );
|
1488 |
-
});
|
1489 |
-
|
1490 |
-
return String(str).replace(/[&<>"'\/]/g, function (s) {
|
1491 |
-
return entityMap[s];
|
1492 |
-
});
|
1493 |
-
|
1494 |
-
}
|
1495 |
-
|
1496 |
-
function jQuerySelectorEscape(expression) {
|
1497 |
-
return expression.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~]/g, '\\$&');
|
1498 |
-
}
|
1499 |
-
|
1500 |
-
//for warning
|
1501 |
-
function setup_alert_date_filter() {
|
1502 |
-
default_date_filter_color = jQuery( "#my-date-filter" ).css('color');
|
1503 |
-
try_color_date_filter();
|
1504 |
-
jQuery( '#from_date' ).change( function() { try_color_date_filter(); });
|
1505 |
-
jQuery( '#to_date' ).change( function() { try_color_date_filter(); });
|
1506 |
-
}
|
1507 |
-
function try_color_date_filter() {
|
1508 |
-
var color = default_date_filter_color;
|
1509 |
-
if( jQuery( "#from_date" ).val() || jQuery( "#to_date" ).val() )
|
1510 |
-
color = 'red';
|
1511 |
-
jQuery( "#my-date-filter" ).css('color', color);
|
1512 |
-
}
|
1513 |
-
|
1514 |
-
jQuery( document ).ready( function ($) {
|
1515 |
-
|
1516 |
-
$( "#the-list" ).sortable( { handle: '.woe-row-sort-handle' } );
|
1517 |
-
|
1518 |
-
$( '.check-column .order_part' ).hide();
|
1519 |
-
|
1520 |
-
$start_reorder_button = $( '#start_reorder' );
|
1521 |
-
$apply_reorder_button = $( '#apply_reorder' );
|
1522 |
-
$cancel_reorder_button = $( '#cancel_reorder' );
|
1523 |
-
$start_reorder_button.click( function ( e ) {
|
1524 |
-
$order_ids = $( "#the-list" ).sortable( "toArray", {attribute: 'data-job_id'} );
|
1525 |
-
|
1526 |
-
$start_reorder_button.hide();
|
1527 |
-
$apply_reorder_button.show();
|
1528 |
-
$cancel_reorder_button.show();
|
1529 |
-
|
1530 |
-
$( '.check-column .cb_part' ).hide();
|
1531 |
-
$( '.check-column .order_part' ).show();
|
1532 |
-
|
1533 |
-
|
1534 |
-
} );
|
1535 |
-
|
1536 |
-
$apply_reorder_button.click( function ( e ) {
|
1537 |
-
$start_reorder_button.show();
|
1538 |
-
$apply_reorder_button.hide();
|
1539 |
-
$cancel_reorder_button.hide();
|
1540 |
-
|
1541 |
-
$( '.check-column .cb_part' ).show();
|
1542 |
-
$( '.check-column .order_part' ).hide();
|
1543 |
-
|
1544 |
-
jQuery.ajax({
|
1545 |
-
url: ajaxurl,
|
1546 |
-
data: {
|
1547 |
-
'action': "order_exporter",
|
1548 |
-
'method': 'reorder_jobs',
|
1549 |
-
'new_jobs_order': $( "#the-list" ).sortable( "toArray", {attribute: 'data-job_id'} ),
|
1550 |
-
'tab_name': $tab_name,
|
1551 |
-
woe_nonce: woe_nonce,
|
1552 |
-
},
|
1553 |
-
error: function ( response ) {},
|
1554 |
-
dataType: 'json',
|
1555 |
-
type: 'POST',
|
1556 |
-
success: function() {
|
1557 |
-
|
1558 |
-
}
|
1559 |
-
});
|
1560 |
-
|
1561 |
-
} );
|
1562 |
-
|
1563 |
-
$cancel_reorder_button.click( function ( e ) {
|
1564 |
-
$start_reorder_button.show();
|
1565 |
-
$apply_reorder_button.hide();
|
1566 |
-
$cancel_reorder_button.hide();
|
1567 |
-
|
1568 |
-
$( '.check-column .cb_part' ).show();
|
1569 |
-
$( '.check-column .order_part' ).hide();
|
1570 |
-
|
1571 |
-
$( $order_ids ).each( function ( $key, $job_id ) {
|
1572 |
-
$element = $( '[data-job_id="' + $job_id + '"' ).detach();
|
1573 |
-
$( "#the-list" ).append( $element );
|
1574 |
-
} );
|
1575 |
-
} );
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/filters.js
ADDED
@@ -0,0 +1,882 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery( document ).ready( function ( $ ) {
|
2 |
+
function woe_open_filter( object_id, verify_checkboxes ) {
|
3 |
+
|
4 |
+
verify_checkboxes = verify_checkboxes || 0;
|
5 |
+
|
6 |
+
var f = false;
|
7 |
+
$( '#' + object_id + ' ul' ).each( function ( index ) {
|
8 |
+
if ( $( this ).find( 'li:not(:first)' ).length ) {
|
9 |
+
f = true;
|
10 |
+
}
|
11 |
+
} );
|
12 |
+
|
13 |
+
// show checkboxes for order and coupon section ?
|
14 |
+
if ( f || verify_checkboxes && $( '#' + object_id + " input[type='checkbox']:checked" ).length ) {
|
15 |
+
$( '#' + object_id ).prev().click();
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
//PRODUCT ATTRIBUTES BEGIN
|
20 |
+
jQuery( '#attributes' ).on( 'change', function () {
|
21 |
+
|
22 |
+
jQuery( '#select_attributes' ).attr( 'disabled', 'disabled' );
|
23 |
+
|
24 |
+
var data = {
|
25 |
+
attr: jQuery( this ).val(),
|
26 |
+
method: "get_products_attributes_values",
|
27 |
+
action: "order_exporter",
|
28 |
+
woe_nonce: settings_form.woe_nonce,
|
29 |
+
tab: settings_form.woe_active_tab,
|
30 |
+
};
|
31 |
+
|
32 |
+
var val_op = jQuery( '#attributes_compare' ).val();
|
33 |
+
|
34 |
+
jQuery( '#text_attributes' ).val( '' );
|
35 |
+
|
36 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
37 |
+
|
38 |
+
jQuery( '#select_attributes--select2 select' ).select2( 'destroy' );
|
39 |
+
|
40 |
+
jQuery( '#select_attributes, #select_attributes--select2' ).remove();
|
41 |
+
|
42 |
+
if ( response ) {
|
43 |
+
var options = '';
|
44 |
+
jQuery.each( response, function ( index, value ) {
|
45 |
+
options += '<option>' + value + '</option>';
|
46 |
+
} );
|
47 |
+
var $select = jQuery( '<div id="select_attributes--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
48 |
+
+ 'display: ' + (
|
49 |
+
(
|
50 |
+
'LIKE' === val_op
|
51 |
+
) ? 'none' : 'inline-block'
|
52 |
+
) + ';">'
|
53 |
+
+ '<select id="select_attributes">' + options + '</select></div>' );
|
54 |
+
$select.insertBefore( jQuery( '#add_attributes' ) )
|
55 |
+
$select.find( 'select' ).select2_i18n( {tags: true} );
|
56 |
+
}
|
57 |
+
else {
|
58 |
+
jQuery( '<input type="text" id="select_attributes" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_attributes' ) );
|
59 |
+
}
|
60 |
+
}, 'json' );
|
61 |
+
|
62 |
+
} ).trigger( 'change' );
|
63 |
+
|
64 |
+
jQuery( '#add_attributes' ).on( 'click', function () {
|
65 |
+
|
66 |
+
var val = ! jQuery( "#select_attributes" ).is( ':disabled' ) ? jQuery( "#select_attributes" ).val() : jQuery( "#text_attributes" ).val();
|
67 |
+
var val2 = jQuery( '#attributes' ).val();
|
68 |
+
var val_op = jQuery( '#attributes_compare' ).val();
|
69 |
+
if ( val != null && val2 != null && val.length && val2.length ) {
|
70 |
+
val = val2 + ' ' + val_op + ' ' + val;
|
71 |
+
|
72 |
+
var f = true;
|
73 |
+
jQuery( '#attributes_check' ).next().find( 'ul li' ).each( function () {
|
74 |
+
if ( jQuery( this ).attr( 'title' ) == val ) {
|
75 |
+
f = false;
|
76 |
+
}
|
77 |
+
} );
|
78 |
+
|
79 |
+
if ( f ) {
|
80 |
+
|
81 |
+
jQuery( '#attributes_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
82 |
+
jQuery( '#attributes_check' ).select2_i18n( {}, '', true );
|
83 |
+
|
84 |
+
jQuery( '#attributes_check option' ).each( function () {
|
85 |
+
jQuery( '#attributes_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
86 |
+
} );
|
87 |
+
|
88 |
+
jQuery( "input#select_attributes" ).val( '' );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
return false;
|
93 |
+
} );
|
94 |
+
|
95 |
+
jQuery( '#attributes_compare' ).on( 'change', function () {
|
96 |
+
var val_op = jQuery( '#attributes_compare' ).val();
|
97 |
+
if ( 'LIKE' === val_op ) {
|
98 |
+
jQuery( "#select_attributes" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
99 |
+
jQuery( "#select_attributes--select2" ).hide();
|
100 |
+
jQuery( "#text_attributes" ).css( 'display', 'inline' ).attr( 'disabled', false );
|
101 |
+
}
|
102 |
+
else {
|
103 |
+
jQuery( "#select_attributes" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
104 |
+
jQuery( "#select_attributes--select2" ).css( 'display', 'inline' );
|
105 |
+
jQuery( "#text_attributes" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
106 |
+
}
|
107 |
+
} );
|
108 |
+
//PRODUCT ATTRIBUTES END
|
109 |
+
|
110 |
+
jQuery( '#itemmeta' ).on( 'change', function () {
|
111 |
+
|
112 |
+
var selected64 = jQuery( this ).find( ":selected" ).data( "base64" );
|
113 |
+
|
114 |
+
jQuery( '#select_itemmeta' ).attr( 'disabled', 'disabled' );
|
115 |
+
|
116 |
+
var data = {
|
117 |
+
'item': window.atob( selected64 ),
|
118 |
+
method: "get_products_itemmeta_values",
|
119 |
+
action: "order_exporter",
|
120 |
+
woe_nonce: settings_form.woe_nonce,
|
121 |
+
tab: settings_form.woe_active_tab,
|
122 |
+
};
|
123 |
+
|
124 |
+
var val_op = jQuery( '#itemmeta_compare' ).val();
|
125 |
+
|
126 |
+
jQuery( '#text_itemmeta' ).val( '' );
|
127 |
+
|
128 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
129 |
+
jQuery( '#select_itemmeta--select2 select' ).select2( 'destroy' );
|
130 |
+
jQuery( '#select_itemmeta, #select_itemmeta--select2' ).remove();
|
131 |
+
if ( response ) {
|
132 |
+
var options = '';
|
133 |
+
jQuery.each( response, function ( index, value ) {
|
134 |
+
options += '<option>' + value + '</option>';
|
135 |
+
} );
|
136 |
+
var $select = jQuery( '<div id="select_itemmeta--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
137 |
+
+ 'display: ' + (
|
138 |
+
(
|
139 |
+
'LIKE' === val_op
|
140 |
+
) ? 'none' : 'inline-block'
|
141 |
+
) + ';">'
|
142 |
+
+ '<select id="select_itemmeta">' + options + '</select></div>' );
|
143 |
+
$select.insertBefore( jQuery( '#add_itemmeta' ) )
|
144 |
+
$select.find( 'select' ).select2_i18n( {tags: true} );
|
145 |
+
}
|
146 |
+
else {
|
147 |
+
jQuery( '<input type="text" id="select_itemmeta" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_itemmeta' ) );
|
148 |
+
}
|
149 |
+
}, 'json' );
|
150 |
+
} );
|
151 |
+
|
152 |
+
if ( jQuery( '#itemmeta option' ).length > 0 ) {
|
153 |
+
jQuery( '#itemmeta' ).trigger( 'change' );
|
154 |
+
}
|
155 |
+
|
156 |
+
jQuery( '#add_itemmeta' ).on( 'click', function () {
|
157 |
+
|
158 |
+
var val = ! jQuery( "#select_itemmeta" ).is( ':disabled' ) ? jQuery( "#select_itemmeta" ).val() : jQuery( "#text_itemmeta" ).val();
|
159 |
+
var selected64 = jQuery( '#itemmeta' ).find( ":selected" ).data( "base64" );
|
160 |
+
var val2 = window.atob( selected64 ).replace( /&/g, '&' );
|
161 |
+
var val_op = jQuery( '#itemmeta_compare' ).val();
|
162 |
+
if ( val != null && val2 != null && val.length && val2.length ) {
|
163 |
+
val = val2 + ' ' + val_op + ' ' + val;
|
164 |
+
|
165 |
+
var f = true;
|
166 |
+
jQuery( '#itemmeta_check' ).next().find( 'ul li' ).each( function () {
|
167 |
+
if ( jQuery( this ).attr( 'title' ) == val ) {
|
168 |
+
f = false;
|
169 |
+
}
|
170 |
+
} );
|
171 |
+
|
172 |
+
if ( f ) {
|
173 |
+
|
174 |
+
jQuery( '#itemmeta_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
175 |
+
jQuery( '#itemmeta_check' ).select2_i18n( {}, '', true );
|
176 |
+
|
177 |
+
jQuery( '#itemmeta_check option' ).each( function () {
|
178 |
+
jQuery( '#itemmeta_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove(); // jQuerySelectorEscape ?
|
179 |
+
} );
|
180 |
+
|
181 |
+
jQuery( "input#select_itemmeta" ).val( '' );
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
return false;
|
186 |
+
} );
|
187 |
+
|
188 |
+
jQuery( '#itemmeta_compare' ).on( 'change', function () {
|
189 |
+
var val_op = jQuery( '#itemmeta_compare' ).val();
|
190 |
+
if ( 'LIKE' === val_op ) {
|
191 |
+
jQuery( "#select_itemmeta" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
192 |
+
jQuery( "#select_itemmeta--select2" ).hide();
|
193 |
+
jQuery( "#text_itemmeta" ).css( 'display', 'inline' ).attr( 'disabled', false );
|
194 |
+
}
|
195 |
+
else {
|
196 |
+
jQuery( "#select_itemmeta" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
197 |
+
jQuery( "#select_itemmeta--select2" ).css( 'display', 'inline' );
|
198 |
+
jQuery( "#text_itemmeta" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
199 |
+
}
|
200 |
+
} );
|
201 |
+
|
202 |
+
jQuery( '#item_name_compare' ).on( 'change', function () {
|
203 |
+
var val_op = jQuery( '#item_name_compare' ).val();
|
204 |
+
if ( 'LIKE' === val_op ) {
|
205 |
+
jQuery( "#text_item_names" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
206 |
+
jQuery( "#text_item_names--select2" ).hide();
|
207 |
+
jQuery( "#text_order_item_name" ).css( 'display', 'inline' ).attr( 'disabled', false );
|
208 |
+
}
|
209 |
+
else {
|
210 |
+
jQuery( "#text_item_names" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
211 |
+
jQuery( "#text_item_names--select2" ).css( 'display', 'inline' );
|
212 |
+
jQuery( "#text_order_item_name" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
213 |
+
}
|
214 |
+
} );
|
215 |
+
|
216 |
+
jQuery( '#item_metadata_compare' ).on( 'change', function () {
|
217 |
+
var val_op = jQuery( '#item_metadata_compare' ).val();
|
218 |
+
if ( 'LIKE' === val_op ) {
|
219 |
+
jQuery( "#text_item_metadata" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
220 |
+
jQuery( "#text_item_metadata--select2" ).hide();
|
221 |
+
jQuery( "#text_order_itemmetadata" ).css( 'display', 'inline' ).attr( 'disabled', false );
|
222 |
+
}
|
223 |
+
else {
|
224 |
+
jQuery( "#text_item_metadata" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
225 |
+
jQuery( "#text_item_metadata--select2" ).css( 'display', 'inline' );
|
226 |
+
jQuery( "#text_order_itemmetadata" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
227 |
+
}
|
228 |
+
} );
|
229 |
+
|
230 |
+
//PRODUCT TAXONOMIES BEGIN
|
231 |
+
jQuery( '#taxonomies' ).on( 'change', function () {
|
232 |
+
|
233 |
+
jQuery( '#select_taxonomies' ).attr( 'disabled', 'disabled' );
|
234 |
+
var data = {
|
235 |
+
'tax': jQuery( this ).val(),
|
236 |
+
method: "get_products_taxonomies_values",
|
237 |
+
action: "order_exporter",
|
238 |
+
woe_nonce: settings_form.woe_nonce,
|
239 |
+
tab: settings_form.woe_active_tab,
|
240 |
+
};
|
241 |
+
|
242 |
+
var val_op = jQuery( '#taxonomies_compare' ).val();
|
243 |
+
|
244 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
245 |
+
jQuery( '#select_taxonomies--select2 select' ).select2( 'destroy' );
|
246 |
+
jQuery( '#select_taxonomies, #select_taxonomies--select2' ).remove();
|
247 |
+
if ( response ) {
|
248 |
+
var options = '';
|
249 |
+
jQuery.each( response, function ( index, value ) {
|
250 |
+
options += '<option>' + value + '</option>';
|
251 |
+
} );
|
252 |
+
var $select = jQuery( '<div id="select_taxonomies--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
253 |
+
+ 'display: ' + (
|
254 |
+
(
|
255 |
+
'NOT SET' === val_op || 'IS SET' === val_op
|
256 |
+
) ? 'none' : 'inline-block'
|
257 |
+
) + ';">'
|
258 |
+
+ '<select id="select_taxonomies">' + options + '</select></div>' );
|
259 |
+
|
260 |
+
$select.insertBefore( jQuery( '#add_taxonomies' ) )
|
261 |
+
$select.find( 'select' ).select2_i18n( {tags: true} );
|
262 |
+
}
|
263 |
+
else {
|
264 |
+
jQuery( '<input type="text" id="select_taxonomies" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_taxonomies' ) );
|
265 |
+
}
|
266 |
+
|
267 |
+
jQuery( '#taxonomies_compare' ).trigger( 'change' );
|
268 |
+
}, 'json' );
|
269 |
+
} ).trigger( 'change' );
|
270 |
+
|
271 |
+
jQuery( '#add_taxonomies' ).on( 'click', function () {
|
272 |
+
|
273 |
+
var val = ! jQuery( "#select_taxonomies" ).is( ':disabled' ) ? jQuery( "#select_taxonomies" ).val() : jQuery( "#text_taxonomies" ).val();
|
274 |
+
var val2 = jQuery( '#taxonomies' ).val();
|
275 |
+
var val_op = jQuery( '#taxonomies_compare' ).val();
|
276 |
+
if ( val != null && val2 != null && val.length && val2.length ) {
|
277 |
+
val = val2 + ' ' + val_op + ' ' + val;
|
278 |
+
|
279 |
+
var f = true;
|
280 |
+
jQuery( '#taxonomies_check' ).next().find( 'ul li' ).each( function () {
|
281 |
+
if ( jQuery( this ).attr( 'title' ) == val ) {
|
282 |
+
f = false;
|
283 |
+
}
|
284 |
+
} );
|
285 |
+
|
286 |
+
if ( f ) {
|
287 |
+
|
288 |
+
jQuery( '#taxonomies_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
289 |
+
jQuery( '#taxonomies_check' ).select2_i18n( {}, '', true );
|
290 |
+
|
291 |
+
jQuery( '#taxonomies_check option' ).each( function () {
|
292 |
+
jQuery( '#taxonomies_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
293 |
+
} );
|
294 |
+
|
295 |
+
jQuery( "input#select_taxonomies" ).val( '' );
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
return false;
|
300 |
+
} );
|
301 |
+
|
302 |
+
jQuery( '#taxonomies_compare' ).on( 'change', function () {
|
303 |
+
var val_op = jQuery( '#taxonomies_compare' ).val();
|
304 |
+
if ( 'LIKE' === val_op ) {
|
305 |
+
jQuery( "#select_taxonomies" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
306 |
+
jQuery( "#text_taxonomies" ).css( 'display', 'inline' ).attr( 'disabled', false );
|
307 |
+
}
|
308 |
+
else if ( 'NOT SET' === val_op || 'IS SET' === val_op ) {
|
309 |
+
jQuery( "#select_taxonomies" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' ).val( ' ' );
|
310 |
+
jQuery( "#select_taxonomies--select2" ).hide();
|
311 |
+
jQuery( "#text_taxonomies" ).css( 'display', 'none' ).attr( 'disabled', false ).val( ' ' );
|
312 |
+
}
|
313 |
+
else {
|
314 |
+
jQuery( "#select_taxonomies" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
315 |
+
jQuery( "#select_taxonomies--select2" ).css( 'display', 'inline' );
|
316 |
+
jQuery( "#text_taxonomies" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
317 |
+
}
|
318 |
+
} );
|
319 |
+
//PRODUCT TAXONOMIES END
|
320 |
+
|
321 |
+
// for filter by PRODUCT custom fields
|
322 |
+
jQuery( '#product_custom_fields' ).change( function () {
|
323 |
+
|
324 |
+
jQuery( '#select_product_custom_fields' ).attr( 'disabled', 'disabled' );
|
325 |
+
var data = {
|
326 |
+
'cf_name': jQuery( this ).val(),
|
327 |
+
method: "get_product_custom_fields_values",
|
328 |
+
action: "order_exporter",
|
329 |
+
woe_nonce: settings_form.woe_nonce,
|
330 |
+
tab: settings_form.woe_active_tab,
|
331 |
+
};
|
332 |
+
|
333 |
+
var val_op = jQuery( '#product_custom_fields_compare' ).val();
|
334 |
+
jQuery( '#text_product_custom_fields' ).val( '' );
|
335 |
+
|
336 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
337 |
+
jQuery( '#select_product_custom_fields--select2 select' ).select2( 'destroy' );
|
338 |
+
jQuery( '#select_product_custom_fields, #select_product_custom_fields--select2' ).remove();
|
339 |
+
if ( response ) {
|
340 |
+
var options = '';
|
341 |
+
jQuery.each( response, function ( index, value ) {
|
342 |
+
options += '<option>' + value + '</option>';
|
343 |
+
} );
|
344 |
+
var $select = jQuery( '<div id="select_product_custom_fields--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
345 |
+
+ 'display: ' + (
|
346 |
+
(
|
347 |
+
'LIKE' === val_op || 'NOT SET' === val_op || 'IS SET' === val_op
|
348 |
+
) ? 'none' : 'inline-block'
|
349 |
+
) + ';">'
|
350 |
+
+ '<select id="select_product_custom_fields">' + options + '</select></div>' );
|
351 |
+
$select.insertBefore( jQuery( '#add_product_custom_fields' ) )
|
352 |
+
$select.find( 'select' ).select2_i18n( {tags: true} );
|
353 |
+
}
|
354 |
+
else {
|
355 |
+
jQuery( '<input type="text" id="select_product_custom_fields" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_product_custom_fields' ) );
|
356 |
+
}
|
357 |
+
jQuery( '#product_custom_fields_compare' ).trigger( 'change' );
|
358 |
+
}, 'json' );
|
359 |
+
} ).trigger( 'change' );
|
360 |
+
|
361 |
+
jQuery( '#add_product_custom_fields' ).click( function () {
|
362 |
+
|
363 |
+
var val = ! jQuery( "#select_product_custom_fields" ).is( ':disabled' ) ? jQuery( "#select_product_custom_fields" ).val() : jQuery( "#text_product_custom_fields" ).val();
|
364 |
+
var val2 = jQuery( '#product_custom_fields' ).val();
|
365 |
+
var val_op = jQuery( '#product_custom_fields_compare' ).val();
|
366 |
+
if ( val != null && val2 != null && val.length && val2.length ) {
|
367 |
+
val = val2 + ' ' + val_op + ' ' + val;
|
368 |
+
|
369 |
+
var f = true;
|
370 |
+
jQuery( '#product_custom_fields_check' ).next().find( 'ul li' ).each( function () {
|
371 |
+
if ( jQuery( this ).attr( 'title' ) == val ) {
|
372 |
+
f = false;
|
373 |
+
}
|
374 |
+
} );
|
375 |
+
|
376 |
+
if ( f ) {
|
377 |
+
|
378 |
+
jQuery( '#product_custom_fields_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
379 |
+
jQuery( '#product_custom_fields_check' ).select2_i18n( {}, '', true );
|
380 |
+
|
381 |
+
jQuery( '#product_custom_fields_check option' ).each( function () {
|
382 |
+
jQuery( '#product_custom_fields_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
383 |
+
} );
|
384 |
+
|
385 |
+
jQuery( "input#select_product_custom_fields" ).val( '' );
|
386 |
+
}
|
387 |
+
}
|
388 |
+
|
389 |
+
return false;
|
390 |
+
} );
|
391 |
+
|
392 |
+
jQuery( '#product_custom_fields_compare' ).change( function () {
|
393 |
+
var val_op = jQuery( '#product_custom_fields_compare' ).val();
|
394 |
+
if ( 'LIKE' === val_op ) {
|
395 |
+
jQuery( "#select_product_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
396 |
+
jQuery( "#select_product_custom_fields--select2" ).hide();
|
397 |
+
jQuery( "#text_product_custom_fields" ).css( 'display', 'inline' ).attr( 'disabled', false );
|
398 |
+
}
|
399 |
+
else if ( 'NOT SET' === val_op || 'IS SET' === val_op ) {
|
400 |
+
jQuery( "#select_product_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' ).val( ' ' );
|
401 |
+
jQuery( "#select_product_custom_fields--select2" ).hide();
|
402 |
+
jQuery( "#text_product_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', false ).val( ' ' );
|
403 |
+
}
|
404 |
+
else {
|
405 |
+
jQuery( "#select_product_custom_fields" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
406 |
+
jQuery( "#select_product_custom_fields--select2" ).css( 'display', 'inline' );
|
407 |
+
jQuery( "#text_product_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
408 |
+
}
|
409 |
+
} );
|
410 |
+
//end of change
|
411 |
+
|
412 |
+
// SHIPPING LOCATIONS
|
413 |
+
jQuery( '#shipping_locations' ).change( function () {
|
414 |
+
|
415 |
+
jQuery( '#text_shipping_locations' ).attr( 'disabled', 'disabled' );
|
416 |
+
var data = {
|
417 |
+
'item': jQuery( this ).val(),
|
418 |
+
method: "get_order_shipping_values",
|
419 |
+
action: "order_exporter",
|
420 |
+
woe_nonce: settings_form.woe_nonce,
|
421 |
+
tab: settings_form.woe_active_tab,
|
422 |
+
};
|
423 |
+
|
424 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
425 |
+
jQuery( '#text_shipping_locations--select2 select' ).select2( 'destroy' );
|
426 |
+
jQuery( '#text_shipping_locations, #text_shipping_locations--select2' ).remove();
|
427 |
+
if ( response ) {
|
428 |
+
var options = '';
|
429 |
+
jQuery.each( response, function ( index, value ) {
|
430 |
+
options += '<option>' + value + '</option>';
|
431 |
+
} );
|
432 |
+
|
433 |
+
var $select = jQuery( '<div id="text_shipping_locations--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top; display: inline-block;"><select id="text_shipping_locations">' + options + '</select></div>' );
|
434 |
+
$select.insertBefore( jQuery( '#add_shipping_locations' ) )
|
435 |
+
$select.find( 'select' ).select2_i18n( {tags: true} );
|
436 |
+
}
|
437 |
+
else {
|
438 |
+
jQuery( '<input type="text" id="text_shipping_locations" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_shipping_locations' ) );
|
439 |
+
}
|
440 |
+
}, 'json' );
|
441 |
+
} ).trigger( 'change' );
|
442 |
+
|
443 |
+
jQuery( '#add_shipping_locations' ).click( function () {
|
444 |
+
|
445 |
+
var val = jQuery( "#text_shipping_locations" ).val();
|
446 |
+
var val2 = jQuery( '#shipping_locations' ).val();
|
447 |
+
var val_op = jQuery( '#shipping_compare' ).val();
|
448 |
+
if ( val != null && val2 != null && val.length && val2.length ) {
|
449 |
+
val = val2 + val_op + val;
|
450 |
+
|
451 |
+
var f = true;
|
452 |
+
jQuery( '#shipping_locations_check' ).next().find( 'ul li' ).each( function () {
|
453 |
+
if ( jQuery( this ).attr( 'title' ) == val ) {
|
454 |
+
f = false;
|
455 |
+
}
|
456 |
+
} );
|
457 |
+
|
458 |
+
if ( f ) {
|
459 |
+
|
460 |
+
jQuery( '#shipping_locations_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
461 |
+
jQuery( '#shipping_locations_check' ).select2_i18n( {}, '', true );
|
462 |
+
|
463 |
+
jQuery( '#shipping_locations_check option' ).each( function () {
|
464 |
+
jQuery( '#shipping_locations_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
465 |
+
} );
|
466 |
+
|
467 |
+
jQuery( "input#text_shipping_locations" ).val( '' );
|
468 |
+
}
|
469 |
+
}
|
470 |
+
return false;
|
471 |
+
} );
|
472 |
+
|
473 |
+
// BILLING LOCATIONS
|
474 |
+
jQuery( '#billing_locations' ).change( function () {
|
475 |
+
|
476 |
+
jQuery( '#text_billing_locations' ).attr( 'disabled', 'disabled' );
|
477 |
+
var data = {
|
478 |
+
'item': jQuery( this ).val(),
|
479 |
+
method: "get_order_billing_values",
|
480 |
+
action: "order_exporter",
|
481 |
+
woe_nonce: settings_form.woe_nonce,
|
482 |
+
tab: settings_form.woe_active_tab,
|
483 |
+
};
|
484 |
+
|
485 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
486 |
+
jQuery( '#text_billing_locations--select2 select' ).select2( 'destroy' );
|
487 |
+
jQuery( '#text_billing_locations, #text_billing_locations--select2' ).remove();
|
488 |
+
if ( response ) {
|
489 |
+
var options = '';
|
490 |
+
jQuery.each( response, function ( index, value ) {
|
491 |
+
options += '<option>' + value + '</option>';
|
492 |
+
} );
|
493 |
+
var $select = jQuery( '<div id="text_billing_locations--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top; display: inline-block;">'
|
494 |
+
+ '<select id="text_billing_locations">' + options + '</select></div>' );
|
495 |
+
$select.insertBefore( jQuery( '#add_billing_locations' ) )
|
496 |
+
$select.find( 'select' ).select2_i18n( {tags: true} );
|
497 |
+
}
|
498 |
+
else {
|
499 |
+
jQuery( '<input type="text" id="text_billing_locations" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_billing_locations' ) );
|
500 |
+
}
|
501 |
+
}, 'json' );
|
502 |
+
} ).trigger( 'change' );
|
503 |
+
|
504 |
+
jQuery( '#add_billing_locations' ).click( function () {
|
505 |
+
|
506 |
+
var val = jQuery( "#text_billing_locations" ).val();
|
507 |
+
var val2 = jQuery( '#billing_locations' ).val();
|
508 |
+
var val_op = jQuery( '#billing_compare' ).val();
|
509 |
+
if ( val != null && val2 != null && val.length && val2.length ) {
|
510 |
+
val = val2 + val_op + val;
|
511 |
+
|
512 |
+
var f = true;
|
513 |
+
jQuery( '#billing_locations_check' ).next().find( 'ul li' ).each( function () {
|
514 |
+
if ( jQuery( this ).attr( 'title' ) == val ) {
|
515 |
+
f = false;
|
516 |
+
}
|
517 |
+
} );
|
518 |
+
|
519 |
+
if ( f ) {
|
520 |
+
|
521 |
+
jQuery( '#billing_locations_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
522 |
+
jQuery( '#billing_locations_check' ).select2_i18n( {}, '', true );
|
523 |
+
|
524 |
+
jQuery( '#billing_locations_check option' ).each( function () {
|
525 |
+
jQuery( '#billing_locations_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
526 |
+
} );
|
527 |
+
|
528 |
+
jQuery( "input#text_billing_locations" ).val( '' );
|
529 |
+
}
|
530 |
+
}
|
531 |
+
return false;
|
532 |
+
} )
|
533 |
+
|
534 |
+
// ITEM NAMES
|
535 |
+
jQuery( '#item_names' ).change( function () {
|
536 |
+
var val_op = jQuery( '#item_name_compare' ).val();
|
537 |
+
jQuery( '#text_order_item_name' ).val( '' );
|
538 |
+
jQuery( '#text_item_names' ).attr( 'disabled', 'disabled' );
|
539 |
+
var data = {
|
540 |
+
'item_type': jQuery( this ).val(),
|
541 |
+
method: "get_order_item_names",
|
542 |
+
action: "order_exporter",
|
543 |
+
woe_nonce: settings_form.woe_nonce,
|
544 |
+
tab: settings_form.woe_active_tab,
|
545 |
+
};
|
546 |
+
|
547 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
548 |
+
jQuery( '#text_item_names--select2 select' ).select2( 'destroy' );
|
549 |
+
jQuery( '#text_item_names, #text_item_names--select2' ).remove();
|
550 |
+
if ( response ) {
|
551 |
+
var options = '';
|
552 |
+
jQuery.each( response, function ( index, value ) {
|
553 |
+
options += '<option>' + value + '</option>';
|
554 |
+
} );
|
555 |
+
|
556 |
+
var $select = jQuery( '<div id="text_item_names--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top; '
|
557 |
+
+ 'display: '+ (
|
558 |
+
(
|
559 |
+
'LIKE' === val_op || 'NOT SET' === val_op || 'IS SET' === val_op
|
560 |
+
) ? 'none' : 'inline-block'
|
561 |
+
) + ';"><select id="text_item_names">' + options + '</select></div>' );
|
562 |
+
$select.insertBefore( jQuery( '#add_item_names' ) );
|
563 |
+
$select.find( 'select' ).select2_i18n( {tags: true} );
|
564 |
+
|
565 |
+
if ( 'LIKE' === val_op || 'NOT SET' === val_op || 'IS SET' === val_op ) {
|
566 |
+
jQuery( '#text_item_names' ).attr( 'disabled', 'disabled' );
|
567 |
+
}
|
568 |
+
}
|
569 |
+
else {
|
570 |
+
jQuery( '<input type="text" id="text_item_names" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_item_names' ) );
|
571 |
+
}
|
572 |
+
}, 'json' );
|
573 |
+
} ).trigger( 'change' );
|
574 |
+
|
575 |
+
jQuery( '#add_item_names' ).click( function () {
|
576 |
+
var val = ! jQuery( "#text_item_names" ).is( ':disabled' ) ? jQuery( "#text_item_names" ).val() : jQuery( "#text_order_item_name" ).val();
|
577 |
+
var val2 = jQuery( '#item_names' ).val();
|
578 |
+
var val_op = jQuery( '#item_name_compare' ).val();
|
579 |
+
if ( val != null && val2 != null && val.length && val2.length ) {
|
580 |
+
val = val2 + ' ' + val_op + ' ' + val;
|
581 |
+
|
582 |
+
var f = true;
|
583 |
+
jQuery( '#item_names_check' ).next().find( 'ul li' ).each( function () {
|
584 |
+
if ( jQuery( this ).attr( 'title' ) == val ) {
|
585 |
+
f = false;
|
586 |
+
}
|
587 |
+
} );
|
588 |
+
|
589 |
+
if ( f ) {
|
590 |
+
|
591 |
+
jQuery( '#item_names_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
592 |
+
jQuery( '#item_names_check' ).select2_i18n( {}, '', true );
|
593 |
+
|
594 |
+
jQuery( '#item_names_check option' ).each( function () {
|
595 |
+
jQuery( '#item_names_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
596 |
+
} );
|
597 |
+
|
598 |
+
jQuery( "input#text_item_names" ).val( '' );
|
599 |
+
}
|
600 |
+
}
|
601 |
+
return false;
|
602 |
+
} );
|
603 |
+
|
604 |
+
// ITEM METADATA
|
605 |
+
jQuery( '#item_metadata' ).change( function () {
|
606 |
+
var val_op = jQuery( '#item_metadata_compare' ).val();
|
607 |
+
jQuery( '#text_order_itemmetadata' ).val( '' );
|
608 |
+
jQuery( '#text_item_metadata' ).attr( 'disabled', 'disabled' );
|
609 |
+
var data = {
|
610 |
+
'meta_key': jQuery( this ).val(),
|
611 |
+
method: "get_order_item_meta_key_values",
|
612 |
+
action: "order_exporter",
|
613 |
+
woe_nonce: settings_form.woe_nonce,
|
614 |
+
tab: settings_form.woe_active_tab,
|
615 |
+
};
|
616 |
+
|
617 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
618 |
+
jQuery( '#text_item_metadata--select2 select' ).select2( 'destroy' );
|
619 |
+
jQuery( '#text_item_metadata, #text_item_metadata--select2' ).remove();
|
620 |
+
if ( response ) {
|
621 |
+
var options = '';
|
622 |
+
jQuery.each( response, function ( index, value ) {
|
623 |
+
options += '<option>' + value + '</option>';
|
624 |
+
} );
|
625 |
+
var $select = jQuery( '<div id="text_item_metadata--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top; '
|
626 |
+
+ 'display: '+ (
|
627 |
+
(
|
628 |
+
'LIKE' === val_op || 'NOT SET' === val_op || 'IS SET' === val_op
|
629 |
+
) ? 'none' : 'inline-block'
|
630 |
+
) + ';"><select id="text_item_metadata">' + options + '</select></div>' );
|
631 |
+
$select.insertBefore( jQuery( '#add_item_metadata' ) );
|
632 |
+
$select.find( 'select' ).select2_i18n( {tags: true} );
|
633 |
+
|
634 |
+
if ( 'LIKE' === val_op || 'NOT SET' === val_op || 'IS SET' === val_op ) {
|
635 |
+
jQuery( '#text_item_metadata' ).attr( 'disabled', 'disabled' );
|
636 |
+
}
|
637 |
+
}
|
638 |
+
else {
|
639 |
+
jQuery( '<input type="text" id="text_item_metadata" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_item_metadata' ) );
|
640 |
+
}
|
641 |
+
}, 'json' );
|
642 |
+
} ).trigger( 'change' );
|
643 |
+
|
644 |
+
jQuery( '#add_item_metadata' ).click( function () {
|
645 |
+
|
646 |
+
var val = jQuery( "#text_item_metadata" ).val();
|
647 |
+
var val2 = jQuery( '#item_metadata' ).val();
|
648 |
+
var val_op = jQuery( '#item_metadata_compare' ).val();
|
649 |
+
if ( val != null && val2 != null && val.length && val2.length ) {
|
650 |
+
val = val2 + ' ' + val_op + ' ' + val;
|
651 |
+
|
652 |
+
var f = true;
|
653 |
+
jQuery( '#item_metadata_check' ).next().find( 'ul li' ).each( function () {
|
654 |
+
if ( jQuery( this ).attr( 'title' ) == val ) {
|
655 |
+
f = false;
|
656 |
+
}
|
657 |
+
} );
|
658 |
+
|
659 |
+
if ( f ) {
|
660 |
+
|
661 |
+
jQuery( '#item_metadata_check' ).append( '<option selected="selected" value="' + val + '">' + val + '</option>' );
|
662 |
+
jQuery( '#item_metadata_check' ).select2_i18n( {}, '', true );
|
663 |
+
|
664 |
+
jQuery( '#item_metadata_check option' ).each( function () {
|
665 |
+
jQuery( '#item_metadata_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
666 |
+
} );
|
667 |
+
|
668 |
+
jQuery( "input#text_item_metadata" ).val( '' );
|
669 |
+
}
|
670 |
+
}
|
671 |
+
return false;
|
672 |
+
} );
|
673 |
+
|
674 |
+
// for filter by ORDER custom fields
|
675 |
+
jQuery( '#user_custom_fields' ).change( function () {
|
676 |
+
|
677 |
+
jQuery( '#select_user_custom_fields' ).attr( 'disabled', 'disabled' );
|
678 |
+
var data = {
|
679 |
+
'cf_name': jQuery( this ).val(),
|
680 |
+
method: "get_user_custom_fields_values",
|
681 |
+
action: "order_exporter",
|
682 |
+
woe_nonce: settings_form.woe_nonce,
|
683 |
+
tab: settings_form.woe_active_tab,
|
684 |
+
};
|
685 |
+
var val_op = jQuery( '#select_user_custom_fields' ).val();
|
686 |
+
jQuery( '#text_user_custom_fields' ).val( '' );
|
687 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
688 |
+
jQuery( '#select_user_custom_fields' ).remove();
|
689 |
+
jQuery( '#select_user_custom_fields--select2 select' ).select2( 'destroy' );
|
690 |
+
jQuery( '#select_user_custom_fields, #select_user_custom_fields--select2' ).remove();
|
691 |
+
if ( response ) {
|
692 |
+
var options = '<option>' + export_messages.empty + '</option>';
|
693 |
+
jQuery.each( response, function ( index, value ) {
|
694 |
+
options += '<option>' + value + '</option>';
|
695 |
+
} );
|
696 |
+
var $select = jQuery( '<div id="select_user_custom_fields--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
697 |
+
+ 'display: ' + (
|
698 |
+
(
|
699 |
+
'LIKE' === val_op || 'NOT SET' === val_op || 'IS SET' === val_op
|
700 |
+
) ? 'none' : 'inline-block'
|
701 |
+
) + ';">'
|
702 |
+
+ '<select id="select_user_custom_fields">' + options + '</select></div>' );
|
703 |
+
$select.insertBefore( jQuery( '#add_user_custom_fields' ) )
|
704 |
+
$select.find( 'select' ).select2_i18n( {tags: true} );
|
705 |
+
}
|
706 |
+
else {
|
707 |
+
jQuery( '<input type="text" id="select_user_custom_fields" style="margin-right: 8px;">' ).insertBefore(
|
708 |
+
jQuery( '#add_user_custom_fields' ) );
|
709 |
+
}
|
710 |
+
}, 'json' );
|
711 |
+
} ).trigger( 'change' );
|
712 |
+
|
713 |
+
jQuery( '#add_user_custom_fields' ).click( function () {
|
714 |
+
|
715 |
+
var val = ! jQuery( "#select_user_custom_fields" ).is( ':disabled' ) ? jQuery(
|
716 |
+
"#select_user_custom_fields" ).val() : jQuery( "#text_user_custom_fields" ).val();
|
717 |
+
var val2 = jQuery( '#user_custom_fields' ).val();
|
718 |
+
var val_op = jQuery( '#user_custom_fields_compare' ).val();
|
719 |
+
if ( val != null && val2 != null && val.length && val2.length ) {
|
720 |
+
var result = val2 + ' ' + val_op + ' ' + val;
|
721 |
+
|
722 |
+
var f = true;
|
723 |
+
jQuery( '#user_custom_fields_check' ).next().find( 'ul li' ).each( function () {
|
724 |
+
if ( jQuery( this ).attr( 'title' ) == val ) {
|
725 |
+
f = false;
|
726 |
+
}
|
727 |
+
} );
|
728 |
+
|
729 |
+
if ( f ) {
|
730 |
+
if ( export_messages.empty === val ) {
|
731 |
+
result = val2 + ' ' + val_op + ' empty';
|
732 |
+
jQuery(
|
733 |
+
'#user_custom_fields_check' ).append( '<option selected="selected" value="' + result + '">' + result + '</option>' );
|
734 |
+
} else {
|
735 |
+
jQuery(
|
736 |
+
'#user_custom_fields_check' ).append( '<option selected="selected" value="' + result + '">' + result + '</option>' );
|
737 |
+
}
|
738 |
+
|
739 |
+
jQuery( '#user_custom_fields_check' ).select2_i18n();
|
740 |
+
|
741 |
+
jQuery( '#user_custom_fields_check option' ).each( function () {
|
742 |
+
jQuery( '#user_custom_fields_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
743 |
+
} );
|
744 |
+
|
745 |
+
jQuery( "input#select_user_custom_fields" ).val( '' );
|
746 |
+
}
|
747 |
+
}
|
748 |
+
return false;
|
749 |
+
} );
|
750 |
+
|
751 |
+
jQuery( '#user_custom_fields_compare' ).change( function () {
|
752 |
+
var val_op = jQuery( '#user_custom_fields_compare' ).val();
|
753 |
+
if ( 'LIKE' === val_op ) {
|
754 |
+
jQuery( "#select_user_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
755 |
+
jQuery( "#select_user_custom_fields--select2" ).hide();
|
756 |
+
jQuery( "#text_user_custom_fields" ).css( 'display', 'inline' ).attr( 'disabled', false );
|
757 |
+
}
|
758 |
+
else if ( 'NOT SET' === val_op || 'IS SET' === val_op ) {
|
759 |
+
jQuery( "#select_user_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' ).val( ' ' );
|
760 |
+
jQuery( "#select_user_custom_fields--select2" ).hide();
|
761 |
+
jQuery( "#text_user_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', false ).val( ' ' );
|
762 |
+
}
|
763 |
+
else {
|
764 |
+
jQuery( "#select_user_custom_fields" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
765 |
+
jQuery( '#select_user_custom_fields--select2' ).css( 'display', 'inline' );
|
766 |
+
jQuery( "#text_user_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
767 |
+
}
|
768 |
+
} );
|
769 |
+
|
770 |
+
// for filter by ORDER custom fields
|
771 |
+
jQuery( '#custom_fields' ).change( function () {
|
772 |
+
|
773 |
+
jQuery( '#select_custom_fields' ).attr( 'disabled', 'disabled' );
|
774 |
+
|
775 |
+
var data = {
|
776 |
+
'cf_name': jQuery( this ).val(),
|
777 |
+
method: "get_order_custom_fields_values",
|
778 |
+
action: "order_exporter",
|
779 |
+
woe_nonce: settings_form.woe_nonce,
|
780 |
+
tab: settings_form.woe_active_tab,
|
781 |
+
};
|
782 |
+
|
783 |
+
var val_op = jQuery( '#custom_fields_compare' ).val();
|
784 |
+
jQuery( '#text_custom_fields' ).val( '' );
|
785 |
+
jQuery.post( ajaxurl, data, function ( response ) {
|
786 |
+
jQuery( '#select_custom_fields' ).remove();
|
787 |
+
jQuery( '#select_custom_fields--select2 select' ).select2( 'destroy' );
|
788 |
+
jQuery( '#select_custom_fields, #select_custom_fields--select2' ).remove();
|
789 |
+
if ( response ) {
|
790 |
+
var options = '<option>' + export_messages.empty + '</option>';
|
791 |
+
jQuery.each( response, function ( index, value ) {
|
792 |
+
options += '<option>' + value + '</option>';
|
793 |
+
} );
|
794 |
+
var $select = jQuery( '<div id="select_custom_fields--select2" style="margin-top: 0px;margin-right: 6px; vertical-align: top;'
|
795 |
+
+ 'display: ' + (
|
796 |
+
(
|
797 |
+
'LIKE' === val_op || 'NOT SET' === val_op || 'IS SET' === val_op
|
798 |
+
) ? 'none' : 'inline-block'
|
799 |
+
) + ';">'
|
800 |
+
+ '<select id="select_custom_fields">' + options + '</select></div>' );
|
801 |
+
$select.insertBefore( jQuery( '#add_custom_fields' ) )
|
802 |
+
$select.find( 'select' ).select2_i18n( {tags: true} );
|
803 |
+
}
|
804 |
+
else {
|
805 |
+
jQuery( '<input type="text" id="select_custom_fields" style="margin-right: 8px;">' ).insertBefore( jQuery( '#add_custom_fields' ) );
|
806 |
+
}
|
807 |
+
jQuery( '#custom_fields_compare' ).trigger( 'change' );
|
808 |
+
}, 'json' );
|
809 |
+
} ).trigger( 'change' );
|
810 |
+
|
811 |
+
jQuery( '#add_custom_fields' ).click( function () {
|
812 |
+
|
813 |
+
var val = ! jQuery( "#select_custom_fields" ).is( ':disabled' ) ? jQuery( "#select_custom_fields" ).val() : jQuery( "#text_custom_fields" ).val();
|
814 |
+
var val2 = jQuery( '#custom_fields' ).val();
|
815 |
+
var val_op = jQuery( '#custom_fields_compare' ).val();
|
816 |
+
if ( val != null && val2 != null && val.length && val2.length ) {
|
817 |
+
var result = val2 + ' ' + val_op + ' ' + val;
|
818 |
+
|
819 |
+
var f = true;
|
820 |
+
jQuery( '#custom_fields_check' ).next().find( 'ul li' ).each( function () {
|
821 |
+
if ( jQuery( this ).attr( 'title' ) == val ) {
|
822 |
+
f = false;
|
823 |
+
}
|
824 |
+
} );
|
825 |
+
|
826 |
+
if ( f ) {
|
827 |
+
if ( export_messages.empty === val ) {
|
828 |
+
result = val2 + ' ' + val_op + ' empty';
|
829 |
+
jQuery( '#custom_fields_check' ).append( '<option selected="selected" value="' + result + '">' + result + '</option>' );
|
830 |
+
} else {
|
831 |
+
jQuery( '#custom_fields_check' ).append( '<option selected="selected" value="' + result + '">' + result + '</option>' );
|
832 |
+
}
|
833 |
+
|
834 |
+
jQuery( '#custom_fields_check' ).select2_i18n();
|
835 |
+
|
836 |
+
jQuery( '#custom_fields_check option' ).each( function () {
|
837 |
+
jQuery( '#custom_fields_check option[value=\"' + jQuery( this ).val() + '\"]:not(:last)' ).remove();
|
838 |
+
} );
|
839 |
+
|
840 |
+
jQuery( "input#select_custom_fields" ).val( '' );
|
841 |
+
}
|
842 |
+
}
|
843 |
+
|
844 |
+
return false;
|
845 |
+
} );
|
846 |
+
|
847 |
+
jQuery( '#custom_fields_compare' ).change( function () {
|
848 |
+
var val_op = jQuery( '#custom_fields_compare' ).val();
|
849 |
+
if ( 'LIKE' === val_op ) {
|
850 |
+
jQuery( "#select_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
851 |
+
jQuery( "#select_custom_fields--select2" ).hide();
|
852 |
+
jQuery( "#text_custom_fields" ).css( 'display', 'inline' ).attr( 'disabled', false );
|
853 |
+
}
|
854 |
+
else if ( 'NOT SET' === val_op || 'IS SET' === val_op ) {
|
855 |
+
jQuery( "#select_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' ).val( ' ' );
|
856 |
+
jQuery( "#select_custom_fields--select2" ).hide();
|
857 |
+
jQuery( "#text_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', false ).val( ' ' );
|
858 |
+
}
|
859 |
+
else {
|
860 |
+
jQuery( "#select_custom_fields" ).css( 'display', 'inline-block' ).attr( 'disabled', false );
|
861 |
+
jQuery( '#select_custom_fields--select2' ).css( 'display', 'inline' );
|
862 |
+
jQuery( "#text_custom_fields" ).css( 'display', 'none' ).attr( 'disabled', 'disabled' );
|
863 |
+
}
|
864 |
+
} );
|
865 |
+
//end of change
|
866 |
+
|
867 |
+
|
868 |
+
woe_open_filter( 'my-order', 1 );
|
869 |
+
|
870 |
+
woe_open_filter( 'my-products' );
|
871 |
+
|
872 |
+
woe_open_filter( 'my-shipping' );
|
873 |
+
|
874 |
+
woe_open_filter( 'my-users' );
|
875 |
+
|
876 |
+
woe_open_filter( 'my-coupons', 1 );
|
877 |
+
|
878 |
+
woe_open_filter( 'my-billing' );
|
879 |
+
|
880 |
+
woe_open_filter( 'my-items-meta' );
|
881 |
+
|
882 |
+
} );
|
assets/js/select2-i18n.js
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery.fn.extend( {
|
2 |
+
select2_i18n: function ( $attrs, ajax_method, is_default ) {
|
3 |
+
|
4 |
+
if ( typeof $attrs !== 'object' ) {
|
5 |
+
$attrs = {};
|
6 |
+
}
|
7 |
+
|
8 |
+
var default_params = {language: script_data.select2_locale};
|
9 |
+
|
10 |
+
if ( is_default ) {
|
11 |
+
|
12 |
+
var select2_wo_dropdown_opts = {
|
13 |
+
containerCssClass: 'without-dropdown',
|
14 |
+
dropdownCssClass: 'without-dropdown',
|
15 |
+
};
|
16 |
+
|
17 |
+
Object.assign( default_params, select2_wo_dropdown_opts );
|
18 |
+
}
|
19 |
+
|
20 |
+
if ( ajax_method ) {
|
21 |
+
|
22 |
+
var select2_ajax = {
|
23 |
+
ajax: {
|
24 |
+
url: ajaxurl,
|
25 |
+
dataType: 'json',
|
26 |
+
delay: 250,
|
27 |
+
data: function ( params ) {
|
28 |
+
return {
|
29 |
+
q: params.term, // search term
|
30 |
+
page: params.page,
|
31 |
+
method: ajax_method,
|
32 |
+
action: "order_exporter",
|
33 |
+
tab: script_data.active_tab,
|
34 |
+
};
|
35 |
+
},
|
36 |
+
processResults: function ( data, page ) {
|
37 |
+
return {
|
38 |
+
results: data
|
39 |
+
};
|
40 |
+
},
|
41 |
+
cache: true
|
42 |
+
},
|
43 |
+
escapeMarkup: function ( markup ) {
|
44 |
+
return markup;
|
45 |
+
}, // let our custom formatter work
|
46 |
+
minimumInputLength: 3,
|
47 |
+
templateResult: function ( item ) {
|
48 |
+
|
49 |
+
var markup = '<div class="clearfix">' +
|
50 |
+
'<div>';
|
51 |
+
|
52 |
+
if ( typeof item.photo_url !== "undefined" ) {
|
53 |
+
markup += '<img src="' + item.photo_url + '" style="width: 20%;float:left;" />';
|
54 |
+
}
|
55 |
+
|
56 |
+
markup += '<div style="width:75%;float:left; padding: 5px;">' + item.text + '</div>' +
|
57 |
+
'</div>' +
|
58 |
+
'</div><div style="clear:both"></div>';
|
59 |
+
|
60 |
+
return markup;
|
61 |
+
},
|
62 |
+
templateSelection: function ( item ) {
|
63 |
+
return item.text;
|
64 |
+
},
|
65 |
+
};
|
66 |
+
|
67 |
+
Object.assign( default_params, select2_ajax );
|
68 |
+
}
|
69 |
+
|
70 |
+
$attrs = Object.assign( default_params, $attrs );
|
71 |
+
|
72 |
+
jQuery( this ).select2( $attrs );
|
73 |
+
},
|
74 |
+
} );
|
75 |
+
|
76 |
+
jQuery( document ).ready( function ( $ ) {
|
77 |
+
|
78 |
+
try {
|
79 |
+
|
80 |
+
$( '.select2-i18n' ).each( function () {
|
81 |
+
|
82 |
+
var width = $( this ).attr( 'data-select2-i18n-width' );
|
83 |
+
|
84 |
+
$( this ).select2_i18n(
|
85 |
+
width ? {width: + width} : {},
|
86 |
+
$( this ).attr( 'data-select2-i18n-ajax-method' ),
|
87 |
+
$( this ).attr( 'data-select2-i18n-default' )
|
88 |
+
);
|
89 |
+
} );
|
90 |
+
}
|
91 |
+
catch ( err ) {
|
92 |
+
console.log( err.message );
|
93 |
+
jQuery( '#select2_warning' ).show();
|
94 |
+
}
|
95 |
+
|
96 |
+
} );
|
assets/js/settings-form.js
CHANGED
@@ -1,763 +1,185 @@
|
|
1 |
-
function
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
return JSON.stringify( obj.serializeJSON() ) ;
|
6 |
-
}
|
7 |
-
|
8 |
-
jQuery( document ).ready( function( $ ) {
|
9 |
-
|
10 |
-
$('#d-schedule-4 .datetimes-date').datepicker({
|
11 |
-
dateFormat: 'yy-mm-dd',
|
12 |
-
constrainInput: false,
|
13 |
-
minDate: 0,
|
14 |
-
});
|
15 |
-
|
16 |
-
$( '#d-schedule-3 .btn-add' ).click( function(e) {
|
17 |
-
var times = $( 'input[name="settings[schedule][times]"]' ).val();
|
18 |
-
var weekday = $( '#d-schedule-3 .wc_oe-select-weekday' ).val();
|
19 |
-
var time = $( '#d-schedule-3 .wc_oe-select-time' ).val();
|
20 |
-
|
21 |
-
if( times.indexOf( weekday + ' ' + time) != -1 ) {
|
22 |
-
return;
|
23 |
-
}
|
24 |
-
|
25 |
-
var data = [];
|
26 |
-
if( times != '' ) {
|
27 |
-
data = times.split( ',' ).map( function( time ) {
|
28 |
-
var arr = time.split( ' ' );
|
29 |
-
return { weekday: arr[ 0 ], time: arr[ 1 ] };
|
30 |
-
} );
|
31 |
-
}
|
32 |
-
|
33 |
-
data.push( { weekday: weekday, time: time } );
|
34 |
-
|
35 |
-
var weekdays = {
|
36 |
-
'Sun': 1,
|
37 |
-
'Mon': 2,
|
38 |
-
'Tue': 3,
|
39 |
-
'Wed': 4,
|
40 |
-
'Thu': 5,
|
41 |
-
'Fri': 6,
|
42 |
-
'Sat': 7,
|
43 |
-
};
|
44 |
-
|
45 |
-
data.sort( function( a, b ) {
|
46 |
-
if( weekdays[ a.weekday ] == weekdays[ b.weekday ] ) {
|
47 |
-
return new Date( '1970/01/01 ' + a.time ) - new Date( '1970/01/01 ' + b.time );
|
48 |
-
} else {
|
49 |
-
return weekdays[ a.weekday ] - weekdays[ b.weekday ];
|
50 |
-
}
|
51 |
-
} );
|
52 |
-
|
53 |
-
var html = data.map( function( elem ) {
|
54 |
-
var weekday = settings_form.day_names[elem.weekday] ;
|
55 |
-
return '<div class="time"><span class="btn-delete">×</span>'
|
56 |
-
+ weekday + ' ' + elem.time + '</div>';
|
57 |
-
} ).join( '' );
|
58 |
-
|
59 |
-
times = data.map( function( elem ) {
|
60 |
-
return elem.weekday + ' ' + elem.time;
|
61 |
-
} ).join();
|
62 |
-
|
63 |
-
$( '#d-schedule-3 .input-times' ).html( html );
|
64 |
-
$( '#d-schedule-3 .btn-delete' ).click( shedule3_time_delete );
|
65 |
-
|
66 |
-
$( 'input[name="settings[schedule][times]"]' ).val( times );
|
67 |
-
} );
|
68 |
-
|
69 |
-
$( '#d-schedule-4 .btn-add' ).click( function(e) {
|
70 |
-
|
71 |
-
var times = $( 'input[name="settings[schedule][date_times]"]' ).val();
|
72 |
-
var date = $( '#d-schedule-4 .datetimes-date' ).val();
|
73 |
-
var time = $( '#d-schedule-4 .wc_oe-select-time' ).val();
|
74 |
-
|
75 |
-
if( times.indexOf( date + ' ' + time) !== -1 ) {
|
76 |
-
return;
|
77 |
-
}
|
78 |
-
|
79 |
-
var data = [];
|
80 |
-
if( times !== '' ) {
|
81 |
-
data = times.split( ',' ).map( function( time ) {
|
82 |
-
var arr = time.split( ' ' );
|
83 |
-
return { date: arr[ 0 ], time: arr[ 1 ] };
|
84 |
-
} );
|
85 |
-
}
|
86 |
-
|
87 |
-
data.push( { date: date, time: time } );
|
88 |
-
|
89 |
-
data.sort( function( a, b ) {
|
90 |
-
return new Date( a.date + ' ' + a.time ) - new Date( b.date + ' ' + b.time );
|
91 |
-
} );
|
92 |
-
|
93 |
-
var html = data.map( function( elem ) {
|
94 |
-
return '<div class="time"><span class="btn-delete">×</span>'
|
95 |
-
+ elem.date + ' ' + elem.time + '</div>';
|
96 |
-
} ).join( '' );
|
97 |
-
|
98 |
-
times = data.map( function( elem ) {
|
99 |
-
return elem.date + ' ' + elem.time;
|
100 |
-
} ).join();
|
101 |
-
|
102 |
-
$( '#d-schedule-4 .input-date-times' ).html( html );
|
103 |
-
$( '#d-schedule-4 .btn-delete' ).click( shedule4_time_delete );
|
104 |
-
|
105 |
-
$( 'input[name="settings[schedule][date_times]"]' ).val( times );
|
106 |
-
} );
|
107 |
-
|
108 |
-
$( '#d-schedule-3 .input-times' ).ready( function() {
|
109 |
-
var times = $( 'input[name="settings[schedule][times]"]' ).val();
|
110 |
-
if( !times || times == '' ) {
|
111 |
-
return;
|
112 |
-
}
|
113 |
-
var data = times.split( ',' );
|
114 |
-
var html = data.map( function( elem ) {
|
115 |
-
var x = elem.split(' ');
|
116 |
-
var weekday = settings_form.day_names[x[0]] + ' ' + x[1];
|
117 |
-
return '<div class="time"><span class="btn-delete">×</span>' + weekday + '</div>';
|
118 |
-
} ).join( '' );
|
119 |
-
$( '#d-schedule-3 .input-times' ).html( html );
|
120 |
-
$( '#d-schedule-3 .btn-delete' ).click( shedule3_time_delete );
|
121 |
-
} );
|
122 |
-
|
123 |
-
$( '#d-schedule-4 .input-date-times' ).ready( function() {
|
124 |
-
|
125 |
-
var times = $( 'input[name="settings[schedule][date_times]"]' ).val();
|
126 |
-
|
127 |
-
if( !times || times == '' ) {
|
128 |
-
return;
|
129 |
-
}
|
130 |
-
|
131 |
-
var data = times.split( ',' );
|
132 |
-
|
133 |
-
var html = data.map( function( elem ) {
|
134 |
-
return '<div class="time"><span class="btn-delete">×</span>' + elem + '</div>';
|
135 |
-
} ).join( '' );
|
136 |
-
|
137 |
-
$( '#d-schedule-4 .input-date-times' ).html( html );
|
138 |
-
$( '#d-schedule-4 .btn-delete' ).click( shedule4_time_delete );
|
139 |
-
} );
|
140 |
-
|
141 |
-
function shedule3_time_delete( e ) {
|
142 |
-
var index = $( this ).parent().index();
|
143 |
-
var data = $( 'input[name="settings[schedule][times]"]' ).val().split( ',' );
|
144 |
-
data.splice( index, 1 );
|
145 |
-
$( 'input[name="settings[schedule][times]"]' ).val( data.join() );
|
146 |
-
$( this ).parent().remove();
|
147 |
}
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
|
|
155 |
}
|
|
|
|
|
156 |
|
|
|
|
|
|
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
$( '#d-schedule-2 select' ).attr( 'disabled', true )
|
162 |
-
$( '#d-schedule-1 input:not(input[type=radio])' ).attr( 'disabled', false )
|
163 |
-
$( '#d-schedule-1 select' ).attr( 'disabled', false )
|
164 |
-
$( '#d-schedule-3 .block' ).addClass( 'disabled' );
|
165 |
-
$( '#d-schedule-4 .block' ).addClass( 'disabled' );
|
166 |
-
$( '#d-schedule-5 .block' ).addClass( 'disabled' );
|
167 |
-
} else if( $( '#schedule-2' ).is( ':checked' ) && $( '#schedule-2' ).val() == 'schedule-2' ) {
|
168 |
-
$( '#d-schedule-1 input:not(input[type=radio])' ).attr( 'disabled', true )
|
169 |
-
$( '#d-schedule-1 select' ).attr( 'disabled', true )
|
170 |
-
$( '#d-schedule-2 select' ).attr( 'disabled', false )
|
171 |
-
$( '#d-schedule-2 input:not(input[type=radio]) ' ).attr( 'disabled', false )
|
172 |
-
$( '#d-schedule-3 .block' ).addClass( 'disabled' );
|
173 |
-
$( '#d-schedule-4 .block' ).addClass( 'disabled' );
|
174 |
-
$( '#d-schedule-5 .block' ).addClass( 'disabled' );
|
175 |
-
} else if( $( '#schedule-3' ).is( ':checked' ) && $( '#schedule-3' ).val() == 'schedule-3' ) {
|
176 |
-
$( '#d-schedule-1 input:not(input[type=radio])' ).attr( 'disabled', true )
|
177 |
-
$( '#d-schedule-1 select' ).attr( 'disabled', true )
|
178 |
-
$( '#d-schedule-2 input:not(input[type=radio])' ).attr( 'disabled', true )
|
179 |
-
$( '#d-schedule-2 select' ).attr( 'disabled', true )
|
180 |
-
$( '#d-schedule-3 .block' ).removeClass( 'disabled' );
|
181 |
-
$( '#d-schedule-4 .block' ).addClass( 'disabled' );
|
182 |
-
$( '#d-schedule-5 .block' ).addClass( 'disabled' );
|
183 |
-
} else if( $( '#schedule-4' ).is( ':checked' ) && $( '#schedule-4' ).val() == 'schedule-4' ) {
|
184 |
-
$( '#d-schedule-1 input:not(input[type=radio])' ).attr( 'disabled', true )
|
185 |
-
$( '#d-schedule-1 select' ).attr( 'disabled', true )
|
186 |
-
$( '#d-schedule-2 input:not(input[type=radio])' ).attr( 'disabled', true )
|
187 |
-
$( '#d-schedule-2 select' ).attr( 'disabled', true )
|
188 |
-
$( '#d-schedule-3 .block' ).addClass( 'disabled' );
|
189 |
-
$( '#d-schedule-4 .block' ).removeClass( 'disabled' );
|
190 |
-
$( '#d-schedule-5 .block' ).addClass( 'disabled' );
|
191 |
-
} else if( $( '#schedule-5' ).is( ':checked' ) && $( '#schedule-5' ).val() == 'schedule-5' ) {
|
192 |
-
$( '#d-schedule-1 input:not(input[type=radio])' ).attr( 'disabled', true )
|
193 |
-
$( '#d-schedule-1 select' ).attr( 'disabled', true )
|
194 |
-
$( '#d-schedule-2 input:not(input[type=radio])' ).attr( 'disabled', true )
|
195 |
-
$( '#d-schedule-2 select' ).attr( 'disabled', true )
|
196 |
-
$( '#d-schedule-3 .block' ).addClass( 'disabled' );
|
197 |
-
$( '#d-schedule-4 .block' ).addClass( 'disabled' );
|
198 |
-
$( '#d-schedule-5 .block' ).removeClass( 'disabled' );
|
199 |
-
}
|
200 |
-
} );
|
201 |
-
$( '#schedule-1' ).change()
|
202 |
-
$( '.wc_oe-select-interval' ).change( function() {
|
203 |
-
var interval = $( this ).val()
|
204 |
-
if ( interval == 'custom' ) {
|
205 |
-
$( '#custom_interval' ).show()
|
206 |
-
} else {
|
207 |
-
$( '#custom_interval' ).hide()
|
208 |
-
}
|
209 |
-
} );
|
210 |
-
$( '.wc_oe-select-interval' ).change()
|
211 |
|
212 |
-
|
213 |
-
|
214 |
-
var
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
jQuery( '#' + target ).hide();
|
220 |
-
}
|
221 |
-
else {
|
222 |
-
if ( jQuery( '#' + target ).is( ':hidden' ) ) {
|
223 |
-
jQuery( '#' + target ).show();
|
224 |
-
$( '#test_reply_div' ).hide();
|
225 |
-
$( input ).next().removeClass( 'ui-icon-triangle-1-s' );
|
226 |
-
$( input ).next().addClass( 'ui-icon-triangle-1-n' );
|
227 |
-
}
|
228 |
}
|
229 |
-
} );
|
230 |
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
$("#order_fields li input:checkbox:not(:checked)").closest('.mapping_row').toggle(is_unchecked_shown);
|
236 |
-
$('#hide_unchecked div').toggle();
|
237 |
-
});
|
238 |
-
|
239 |
-
function my_hide( item ) {
|
240 |
-
if ( $( item ).is( ':hidden' ) ) {
|
241 |
-
$( item ).show();
|
242 |
-
return false;
|
243 |
-
}
|
244 |
-
else {
|
245 |
-
$( item ).hide();
|
246 |
-
return true;
|
247 |
}
|
|
|
|
|
248 |
}
|
|
|
249 |
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
}
|
260 |
-
else {
|
261 |
-
$( this ).find( 'span' ).removeClass( 'ui-icon-triangle-1-s' );
|
262 |
-
$( this ).find( 'span' ).addClass( 'ui-icon-triangle-1-n' );
|
263 |
-
}
|
264 |
-
return false;
|
265 |
-
} );
|
266 |
-
|
267 |
-
|
268 |
-
$( '.wc_oe_test' ).click( function() {
|
269 |
-
var test = $( this ).attr( 'data-test' );
|
270 |
-
var data = 'json=' + makeJsonVar( $( '#export_job_settings' ) )
|
271 |
-
data = data + "&action=order_exporter&method=test_destination&mode=" + mode + "&id=" + job_id + "&destination=" + test + '&woe_nonce=' + woe_nonce;
|
272 |
-
$( '#test_reply_div' ).hide();
|
273 |
-
$.post( ajaxurl, data, function( data ) {
|
274 |
-
$( '#test_reply' ).val( data );
|
275 |
-
$( '#test_reply_div' ).show();
|
276 |
-
} )
|
277 |
-
} )
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
$( '.segment_choice' ).click( function () {
|
282 |
-
|
283 |
-
$('.segment_choice').removeClass('active');
|
284 |
-
$(this).addClass('active');
|
285 |
-
|
286 |
-
$('.settings-segment').removeClass('active');
|
287 |
-
$( '#' + $( this ).data( 'segment' ) + '_unselected_segment' ).addClass('active');
|
288 |
-
|
289 |
-
window.location.href = $(this).attr('href');
|
290 |
-
|
291 |
-
jQuery('.tab-actions-forms .segment-form').removeClass('active').find('input,select').val('');
|
292 |
-
} );
|
293 |
-
|
294 |
-
setTimeout( function () {
|
295 |
-
if (summary_mode) {
|
296 |
-
$('.segment_choice[href="products"]').click()
|
297 |
-
} else if (window.location.hash.indexOf('segment') !== -1) {
|
298 |
-
$('.segment_choice[href="'+ window.location.hash +'"]').click()
|
299 |
-
} else {
|
300 |
-
$('.segment_choice').first().click();
|
301 |
-
}
|
302 |
-
}, 1000 );
|
303 |
-
|
304 |
-
|
305 |
-
var text_area = $( '#destination-email-body' );
|
306 |
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
309 |
} );
|
310 |
-
|
311 |
-
|
312 |
-
if ( ! $( '#destination-email-body textarea' ).val() ) {
|
313 |
-
text_area.hide();
|
314 |
-
}
|
315 |
-
}, 0);
|
316 |
-
|
317 |
-
|
318 |
-
$( '#clear_selected_fields' ).click( function () {
|
319 |
-
var confirm = window.confirm(localize_settings_form.remove_all_fields_confirm);
|
320 |
-
if ( confirm ) {
|
321 |
-
if ( $( '#order_fields .mapping_row-delete_field' ).length > 0 ) {
|
322 |
-
$( '#order_fields .mapping_row-delete_field' ).click();
|
323 |
-
}
|
324 |
-
}
|
325 |
} );
|
326 |
-
|
327 |
-
} )
|
328 |
-
|
329 |
-
function remove_custom_field( item ) {
|
330 |
-
jQuery( item ).parent().parent().remove();
|
331 |
-
return false;
|
332 |
}
|
333 |
|
334 |
-
function
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
jQuery.each(localize_settings_form.repeats, function(key, currentValue) {
|
339 |
-
repeat_select.append( '<option value="' + key + '">' + currentValue + '</option>' );
|
340 |
-
repeat_options_html[key] = [];
|
341 |
-
});
|
342 |
-
|
343 |
-
var duplicate_settings = window.duplicated_fields_settings[index] || {};
|
344 |
-
var repeat_value = ( typeof( duplicate_settings.repeat ) !== 'undefined' ) ? duplicate_settings.repeat : "rows";
|
345 |
-
repeat_select.val( repeat_value );
|
346 |
-
|
347 |
-
// rows options
|
348 |
-
if ( index === 'products' ) {
|
349 |
-
var populate_check_on = duplicate_settings.populate_other_columns === '1' ? 'checked' : '';
|
350 |
-
var populate_check_off = duplicate_settings.populate_other_columns === '1' ? '' : 'checked';
|
351 |
-
var populate_check_html = '<div class="">' +
|
352 |
-
'<label>' + localize_settings_form.js_tpl_popup.fill_order_columns_label + '</label>' +
|
353 |
-
'<label>' +
|
354 |
-
'<input type=radio name="duplicated_fields_settings[' + index + '][populate_other_columns]" value=1 ' + populate_check_on + ' >' +
|
355 |
-
localize_settings_form.js_tpl_popup.for_all_rows_label + '</label>' +
|
356 |
-
'<label>' +
|
357 |
-
'<input type=radio name="duplicated_fields_settings[' + index + '][populate_other_columns]" value=0 ' + populate_check_off + ' >' +
|
358 |
-
localize_settings_form.js_tpl_popup.for_first_row_only_label + '</label>' +
|
359 |
-
'</div>';
|
360 |
-
repeat_options_html['rows'].push(populate_check_html);
|
361 |
-
}
|
362 |
-
|
363 |
-
// columns options
|
364 |
-
var max_cols = ( typeof(duplicate_settings.max_cols) !== 'undefined' ) ? duplicate_settings.max_cols : "10";
|
365 |
-
|
366 |
-
var max_cols_html = '<div class="">' +
|
367 |
-
'<label>' + localize_settings_form.js_tpl_popup.add + '</label>' +
|
368 |
-
'<input type=text size=2 name="duplicated_fields_settings['+ index +'][max_cols]" value="'+ max_cols +'"> ' +
|
369 |
-
'<label>' + localize_settings_form.repeats.columns + '</label>' +
|
370 |
-
'</div>';
|
371 |
-
|
372 |
-
var grouping_by_product_check = duplicate_settings.group_by === 'product' ? 'checked' : '';
|
373 |
-
var group_by_item_check_html = '<div class="">' +
|
374 |
-
'<input type="hidden" name="duplicated_fields_settings[' + index + '][group_by]" value="as_independent_columns" >' +
|
375 |
-
'<input type="checkbox" name="duplicated_fields_settings[' + index + '][group_by]" value="product" ' + grouping_by_product_check +'>' +
|
376 |
-
'<label>' + localize_settings_form.js_tpl_popup.grouping_by[index] +'</label>' +
|
377 |
-
'</div>';
|
378 |
-
repeat_options_html['columns'].push(max_cols_html);
|
379 |
-
repeat_options_html['columns'].push(group_by_item_check_html);
|
380 |
-
|
381 |
-
// inside one cell options
|
382 |
-
var line_delimiter = ( typeof(duplicate_settings.line_delimiter) !== 'undefined' ) ? duplicate_settings.line_delimiter : '\\n';
|
383 |
-
var line_delimiter_html = '<div class="">' +
|
384 |
-
'<label>' + localize_settings_form.js_tpl_popup.split_values_by +
|
385 |
-
'<input class="input-delimiter" type=text size=1 name="duplicated_fields_settings['+ index +'][line_delimiter]" value="'+ line_delimiter +'">' +
|
386 |
-
'</label>' +
|
387 |
-
'</div>';
|
388 |
-
repeat_options_html['inside_one_cell'].push(line_delimiter_html);
|
389 |
-
|
390 |
-
var popup_options = jQuery('<div class=""></div>');
|
391 |
-
popup_options.append(jQuery('<div class="segment-header">' + '<label>' + localize_settings_form.js_tpl_popup.add + ' ' + index + ' ' + localize_settings_form.js_tpl_popup.as + '</label>' + '</div>').append(repeat_select) );
|
392 |
-
|
393 |
-
jQuery.each(repeat_options_html, function(key, currentValue) {
|
394 |
-
popup_options.append(jQuery('<div class="display_as duplicate_' + key + '_options"></div>').append(currentValue));
|
395 |
-
});
|
396 |
-
|
397 |
-
popup_options.append("<hr>");
|
398 |
-
|
399 |
-
repeat_select.off('change').on('change', function(){
|
400 |
-
jQuery(this).parent().siblings('.display_as').removeClass('active');
|
401 |
-
jQuery(this).parent().siblings('.duplicate_' + this.value + '_options').addClass('active');
|
402 |
-
}).trigger('change');
|
403 |
-
|
404 |
-
return popup_options;
|
405 |
}
|
406 |
|
407 |
-
function
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
create_unselected_fields( old_output_format, format , format_changed, $old_format_order_fields );
|
413 |
-
}, 0);
|
414 |
-
|
415 |
-
//jQuery( '#export_job_settings' ).prepend( jQuery( "#fields_control_products" ) );
|
416 |
-
//jQuery( '#export_job_settings' ).prepend( jQuery( "#fields_control_coupons" ) );
|
417 |
-
|
418 |
-
jQuery( "#fields .fields-control-block").addClass('hidden');
|
419 |
-
jQuery( "#order_fields").addClass('non_flat_height');
|
420 |
-
|
421 |
-
/*
|
422 |
-
Clone elements for using in create_modal_fields ($old_format_order_fields) and
|
423 |
-
before insert fields in 'order_fields' element ($old_format_modal_content) for
|
424 |
-
able to migrate checkbox values from pop up to 'order_fields' element and vice versa
|
425 |
-
*/
|
426 |
-
|
427 |
-
var html = '';
|
428 |
-
var fields_control_block_elements = [];
|
429 |
-
|
430 |
-
if ( is_flat_format( format ) ) {
|
431 |
-
fields_control_block_elements.push( make_repeat_options( 'products' ) );
|
432 |
-
fields_control_block_elements.push( make_repeat_options( 'coupons' ) );
|
433 |
}
|
434 |
-
|
435 |
-
jQuery.each( window['selected_order_fields'], function( i, value ) {
|
436 |
-
|
437 |
-
var index = value.key;
|
438 |
-
var colname = value.colname;
|
439 |
-
|
440 |
-
colname = escapeStr(colname);
|
441 |
-
value.label = escapeStr(value.label);
|
442 |
-
index = escapeStr(index);
|
443 |
-
value.value = escapeStr(value.value);
|
444 |
-
|
445 |
-
if(format_changed) {
|
446 |
-
if( is_flat_format( format ) )
|
447 |
-
colname = value.label;
|
448 |
-
else if ( is_xml_format( format ) )
|
449 |
-
colname = to_xml_tags( index );
|
450 |
-
else
|
451 |
-
colname = index;
|
452 |
-
}
|
453 |
-
|
454 |
-
if ( index == 'products' || index == 'coupons' ) {
|
455 |
-
|
456 |
-
var row = '';
|
457 |
-
|
458 |
-
jQuery( "#fields_control .segment_" + index ).remove();
|
459 |
-
|
460 |
-
if( ! is_flat_format( format ) ) {
|
461 |
-
// TODO fix segment names for product and coupon fields
|
462 |
-
row = '<li class="mapping_row segment_' + value.segment + 's' + ' flat-'+ index +'-group" style="display: none">\
|
463 |
-
<div class="mapping_col_1" style="width: 10px">\
|
464 |
-
<input type=hidden name="orders[][segment]" value="' + value.segment + '">\
|
465 |
-
<input type=hidden name="orders[][key]" value="' + index + '">\
|
466 |
-
<input type=hidden name="orders[][label]" value="' + value.label + '">\
|
467 |
-
<input type=hidden name="orders[][format]" value="'+ value.format +'">\
|
468 |
-
</div>\
|
469 |
-
<div class="mapping_col_2">' + value.label + '</div>\
|
470 |
-
<div class="mapping_col_3">';
|
471 |
-
row += '<div class="segment_' + index + '">';
|
472 |
-
row += '<input class="mapping_fieldname" type=input name="orders[][colname]" value="' + colname + '">';
|
473 |
-
row += '</div>';
|
474 |
-
row += '</div>';
|
475 |
-
row += '<ul id="sortable_'+ index +'">'+ create_group_fields( format, index, format_changed, old_output_format, $old_format_order_fields) +'</ul>';
|
476 |
-
row += '</li>';
|
477 |
-
} else {
|
478 |
-
row = '<div class="hide flat-'+ index +'-group">';
|
479 |
-
row += '<input type=hidden name="orders[][segment]" value="' + value.segment + '">';
|
480 |
-
row += '<input type=hidden name="orders[][key]" value="' + index + '">';
|
481 |
-
row += '<input class="mapping_fieldname" type=hidden name="orders[][colname]" value="' + colname + '">';
|
482 |
-
row += '<input type=hidden name="orders[][label]" value="' + value.label + '">';
|
483 |
-
row += '<input type=hidden name="orders[][format]" value="'+ value.format +'"></div>';
|
484 |
-
|
485 |
-
}
|
486 |
-
|
487 |
-
}
|
488 |
-
else {
|
489 |
-
|
490 |
-
if ( ! is_flat_format( format ) && ( value.segment === "products" || value.segment === "coupons" ) ) {
|
491 |
-
return true;
|
492 |
-
}
|
493 |
-
|
494 |
-
var value_part = ''
|
495 |
-
var label_part = '';
|
496 |
-
var delete_btn = '<div class="mapping_col_3 mapping_row-delete_field_block"><a href="" class="mapping_row-delete_field"><span class="dashicons dashicons-trash"></span></a></div>';
|
497 |
-
var label_prefix = '';
|
498 |
-
var index_api = index;
|
499 |
-
|
500 |
-
if ( index.indexOf( 'static_field' ) >= 0 ) {
|
501 |
-
value_part = '<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="orders[][value]" value="' + value.value + '"></div>';
|
502 |
-
}
|
503 |
-
|
504 |
-
// label prefix for products and coupons
|
505 |
-
if ( is_flat_format(format) ) {
|
506 |
-
if ( value.segment === 'products' ) {
|
507 |
-
label_prefix = '[P] ';
|
508 |
-
index_api = index_api.replace("plain_products_", "");
|
509 |
-
}
|
510 |
-
if ( value.segment === 'coupons' ) {
|
511 |
-
label_prefix = '[C] ';
|
512 |
-
index_api = index_api.replace("plain_coupons_", "");
|
513 |
-
}
|
514 |
-
}
|
515 |
-
var row = '<li class="mapping_row segment_' + value.segment + '">\
|
516 |
-
<div class="mapping_col_1" style="width: 10px">\
|
517 |
-
<input type=hidden name="orders[][segment]" value="' + value.segment + '">\
|
518 |
-
<input type=hidden name="orders[][key]" value="' + index + '">\
|
519 |
-
<input type=hidden name="orders[][label]" value="' + value.label + '">\
|
520 |
-
<input type=hidden name="orders[][format]" value="' + value.format + '">\
|
521 |
-
</div>\
|
522 |
-
<div class="mapping_col_2" title="'+index_api+'">' + '<span class="field-prefix">' + label_prefix + '</span>' + value.label + label_part + '</div>\
|
523 |
-
<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="orders[][colname]" value="' + colname + '"></div> ' + value_part + delete_btn + '\
|
524 |
-
</li>\
|
525 |
-
';
|
526 |
-
}
|
527 |
-
|
528 |
-
html += row;
|
529 |
-
|
530 |
-
} );
|
531 |
-
|
532 |
-
jQuery( "#order_fields" ).html( html );
|
533 |
-
|
534 |
-
if ( ! jQuery( "#fields .fields-control-block").html() ) {
|
535 |
-
fields_control_block_elements.forEach(function(currentValue){
|
536 |
-
jQuery( "#fields .fields-control-block").append(currentValue);
|
537 |
-
});
|
538 |
-
}
|
539 |
-
|
540 |
-
if ( fields_control_block_elements.length > 0 ) {
|
541 |
-
jQuery( "#fields .fields-control-block").removeClass('hidden');
|
542 |
-
jQuery( "#order_fields").removeClass('non_flat_height');
|
543 |
-
}
|
544 |
-
|
545 |
-
add_bind_for_custom_fields( 'products', output_format, jQuery( "#order_fields" ) );
|
546 |
-
add_bind_for_custom_fields( 'coupons', output_format, jQuery( "#order_fields" ) );
|
547 |
-
|
548 |
-
jQuery( "#sortable_products" ).sortable();
|
549 |
-
jQuery( "#sortable_coupons" ).sortable();
|
550 |
-
|
551 |
-
check_sortable_groups();
|
552 |
-
|
553 |
-
moving_products_and_coupons_group_blocks_to_first_item(output_format);
|
554 |
}
|
555 |
|
556 |
-
function
|
557 |
-
|
558 |
-
var html = '';
|
559 |
-
|
560 |
-
jQuery.each( window['selected_order_' + index_p + '_fields'], function( i, value ) {
|
561 |
-
|
562 |
-
var index = value.key;
|
563 |
-
var colname = value.colname;
|
564 |
-
|
565 |
-
colname = escapeStr(colname);
|
566 |
-
value.label = escapeStr(value.label);
|
567 |
-
index = escapeStr(index);
|
568 |
-
value.value = escapeStr(value.value);
|
569 |
-
|
570 |
-
if(format_changed) {
|
571 |
-
if( is_flat_format( format ) ) {
|
572 |
-
colname = value.label;
|
573 |
-
} else {
|
574 |
-
colname = index.replace('plain_' + index_p + '_', '');
|
575 |
-
if ( is_xml_format( format ) )
|
576 |
-
colname = to_xml_tags( colname );
|
577 |
-
}
|
578 |
-
}
|
579 |
-
|
580 |
-
var value_part = '';
|
581 |
-
var label_part = '';
|
582 |
-
var delete_btn = '<div class="mapping_col_3 mapping_row-delete_field_block"><a href="#" class="mapping_row-delete_field"><span class="dashicons dashicons-trash"></span></a></div>';
|
583 |
-
|
584 |
-
if ( index.indexOf( 'static_field' ) >= 0 ) {
|
585 |
-
value_part = '<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="' + index_p + '[][value]" value="' + value.value + '"></div>';
|
586 |
-
}
|
587 |
-
|
588 |
-
var row = '<li class="mapping_row segment_' + index_p + '">\
|
589 |
-
<div class="mapping_col_1" style="width: 10px">\
|
590 |
-
<input type=hidden name="'+ index_p +'[][label]" value="' + value.label + '">\
|
591 |
-
<input type=hidden name="'+ index_p +'[][key]" value="' + index + '">\
|
592 |
-
<input type=hidden name="'+ index_p +'[][segment]" value="' + index_p + '">\
|
593 |
-
<input type=hidden name="'+ index_p +'[][format]" value="' + value.format + '">\
|
594 |
-
</div>\
|
595 |
-
<div class="mapping_col_2" title="'+index+'">' + value.label + label_part + '</div>\
|
596 |
-
<div class="mapping_col_3"><input class="mapping_fieldname" type=input name="'+ index_p +'[][colname]" value="' + colname + '"></div> ' + value_part + delete_btn + '\
|
597 |
-
</li>\
|
598 |
-
';
|
599 |
|
600 |
-
|
601 |
|
602 |
-
|
|
|
|
|
603 |
|
604 |
-
|
605 |
}
|
606 |
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
for ( var i = 0, l = arr.length; i < l; i++ ) {
|
611 |
-
arr[i] = arr[i].substr( 0, 1 ).toUpperCase() + ( arr[i].length > 1 ? arr[i].substr( 1 ).toLowerCase() : "" );
|
612 |
}
|
613 |
-
|
614 |
}
|
615 |
|
|
|
616 |
|
617 |
-
|
618 |
-
if ( jQuery( '#export_filename' ).length ) {
|
619 |
-
var filename = jQuery( '#export_filename input' ).val();
|
620 |
-
var ext = output_format.toLowerCase();
|
621 |
-
if( ext=='xls' && !jQuery( '#format_xls_use_xls_format' ).prop('checked') ) //fix for XLSX
|
622 |
-
ext = 'xlsx';
|
623 |
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
}
|
631 |
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
}
|
640 |
-
}
|
641 |
|
642 |
-
|
643 |
-
{
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
|
|
|
|
648 |
|
649 |
-
|
|
|
650 |
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
jQuery( '#select2_warning' ).show();
|
657 |
-
}
|
658 |
|
659 |
-
|
|
|
660 |
|
661 |
-
|
662 |
-
jQuery( '#taxonomies' ).change();
|
663 |
-
jQuery( '#attributes' ).change();
|
664 |
-
if ( jQuery( '#itemmeta option' ).length>0 )
|
665 |
-
jQuery( '#itemmeta' ).change();
|
666 |
-
jQuery( '#custom_fields' ).change();
|
667 |
-
jQuery( '#product_custom_fields' ).change();
|
668 |
-
jQuery( '#user_custom_fields' ).change();
|
669 |
-
jQuery( '#shipping_locations' ).change();
|
670 |
-
jQuery( '#billing_locations' ).change();
|
671 |
-
jQuery( '#item_names' ).change();
|
672 |
-
jQuery( '#item_metadata' ).change();
|
673 |
-
// jQuery( '#' + output_format + '_options' ).show();
|
674 |
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
// jQuery( '#' + output_format + '_options' ).hide();
|
679 |
|
680 |
-
|
681 |
-
jQuery( "#sort_coupons" ).sortable()/*.disableSelection()*/;
|
682 |
-
jQuery( "#order_fields" ).sortable({
|
683 |
-
scroll: true,
|
684 |
-
scrollSensitivity: 100,
|
685 |
-
scrollSpeed: 100,
|
686 |
-
stop: function ( event, ui ) {
|
687 |
-
moving_products_and_coupons_group_blocks_to_first_item(jQuery( '.output_format:checked' ).val());
|
688 |
-
}
|
689 |
-
});
|
690 |
|
|
|
|
|
691 |
|
692 |
-
|
|
|
|
|
693 |
|
694 |
-
|
695 |
-
dateFormat: 'yy-mm-dd',
|
696 |
-
constrainInput: false
|
697 |
-
} );
|
698 |
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
|
|
|
|
|
|
|
|
703 |
} );
|
|
|
704 |
|
705 |
-
|
706 |
-
var section = jQuery( this ).val();
|
707 |
-
var checked = jQuery( this ).is( ':checked' );
|
708 |
|
709 |
-
|
710 |
-
if ( checked ) {
|
711 |
-
jQuery( this ).show();
|
712 |
-
//jQuery(this).find('input:checkbox:first').attr('checked', true);
|
713 |
-
}
|
714 |
-
else {
|
715 |
-
jQuery( this ).hide();
|
716 |
-
jQuery( this ).find( 'input:checkbox:first' ).attr( 'checked', false );
|
717 |
-
}
|
718 |
-
} );
|
719 |
-
} );
|
720 |
|
721 |
-
|
722 |
-
var new_format = jQuery( this ).val();
|
723 |
-
jQuery( '#my-format .my-icon-triangle' ).removeClass( 'ui-icon-triangle-1-n' );
|
724 |
-
jQuery( '#my-format .my-icon-triangle' ).addClass( 'ui-icon-triangle-1-s' );
|
725 |
|
726 |
-
|
727 |
-
jQuery( this ).next().removeClass( 'ui-icon-triangle-1-s' );
|
728 |
-
jQuery( this ).next().addClass( 'ui-icon-triangle-1-n' );
|
729 |
-
jQuery( '#' + output_format + '_options' ).hide();
|
730 |
-
jQuery( '#' + new_format + '_options' ).show();
|
731 |
-
var format_type_changed = ! (is_flat_format(new_format) && is_flat_format(output_format));
|
732 |
-
old_output_format = output_format;
|
733 |
-
output_format = new_format;
|
734 |
-
synch_selected_fields( old_output_format, output_format );
|
735 |
-
create_selected_fields( old_output_format, output_format, format_type_changed );
|
736 |
-
jQuery( '.field_section' ).prop('checked', true);
|
737 |
-
jQuery( '#output_preview, #output_preview_csv' ).hide();
|
738 |
-
// jQuery( '#fields' ).hide();
|
739 |
-
// jQuery( '#fields_control' ).hide();
|
740 |
-
change_filename_ext();
|
741 |
-
}
|
742 |
-
else {
|
743 |
-
if ( !jQuery( '#' + new_format + '_options' ).is( ':hidden' ) ) {
|
744 |
-
jQuery( '#' + new_format + '_options' ).hide();
|
745 |
-
}
|
746 |
-
else {
|
747 |
-
if ( jQuery( '#' + new_format + '_options' ).is( ':hidden' ) ) {
|
748 |
-
jQuery( '#' + new_format + '_options' ).show();
|
749 |
-
jQuery( this ).next().removeClass( 'ui-icon-triangle-1-s' );
|
750 |
-
jQuery( this ).next().addClass( 'ui-icon-triangle-1-n' );
|
751 |
-
}
|
752 |
-
}
|
753 |
-
}
|
754 |
|
755 |
-
|
|
|
|
|
756 |
} );
|
757 |
|
758 |
-
$( '#date_format_block select' ).
|
759 |
var value = $( this ).val();
|
760 |
-
if( value == 'custom' ) {
|
761 |
$( '#custom_date_format_block' ).show();
|
762 |
} else {
|
763 |
$( '#custom_date_format_block' ).hide();
|
@@ -765,9 +187,9 @@ jQuery( document ).ready( function( $ ) {
|
|
765 |
}
|
766 |
} );
|
767 |
|
768 |
-
$( '#time_format_block select' ).
|
769 |
var value = $( this ).val();
|
770 |
-
if( value == 'custom' ) {
|
771 |
$( '#custom_time_format_block' ).show();
|
772 |
} else {
|
773 |
$( '#custom_time_format_block' ).hide();
|
@@ -775,955 +197,40 @@ jQuery( document ).ready( function( $ ) {
|
|
775 |
}
|
776 |
} );
|
777 |
|
778 |
-
$( 'input[type="checkbox"][name="settings[custom_php]"]' ).
|
779 |
$( 'div#custom_php_code_textarea' ).toggle( $( this ).is( ':checked' ) );
|
780 |
} );
|
781 |
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
$( '#order_fields input[type=checkbox]' ).attr( 'checked', true );
|
794 |
-
}
|
795 |
-
else {
|
796 |
-
$( '#order_fields input[type=checkbox]' ).attr( 'checked', false );
|
797 |
-
}
|
798 |
-
} );
|
799 |
|
800 |
-
if (
|
801 |
-
|
802 |
}
|
803 |
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
$( ".preview-btn" ).click( function() {
|
808 |
-
preview(jQuery(this).attr('data-limit'));
|
809 |
-
return false;
|
810 |
} );
|
811 |
|
812 |
-
|
813 |
-
$( '#progress_div .title-download' ).hide();
|
814 |
-
$( '#progress_div .title-cancel' ).show();
|
815 |
-
$( '#progressBar' ).show();
|
816 |
-
jQuery( '#progress_div' ).hide();
|
817 |
-
closeWaitingDialog();
|
818 |
-
});
|
819 |
-
|
820 |
-
function preview(size) {
|
821 |
-
jQuery( '#output_preview, #output_preview_csv' ).hide();
|
822 |
-
var data = 'json=' + makeJsonVar( $( '#export_job_settings' ) );
|
823 |
-
var estimate_data = data + "&action=order_exporter&method=estimate&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + woe_nonce;
|
824 |
-
$.post( ajaxurl, estimate_data, function( response ) {
|
825 |
-
if (!response || typeof response.total == 'undefined') {
|
826 |
-
woe_show_error_message(response);
|
827 |
-
return;
|
828 |
-
}
|
829 |
-
jQuery( '#output_preview_total' ).find( 'span' ).html( response.total );
|
830 |
-
jQuery( '#preview_actions' ).removeClass( 'hide' );
|
831 |
-
}, "json"
|
832 |
-
).fail( function( xhr, textStatus, errorThrown ) {
|
833 |
-
woe_show_error_message( xhr.responseText );
|
834 |
-
});
|
835 |
-
|
836 |
-
function showPreview( response ) {
|
837 |
-
var id = 'output_preview';
|
838 |
-
if ( is_flat_format( output_format ) )
|
839 |
-
id = 'output_preview_csv';
|
840 |
-
if ( is_object_format( output_format ) ) {
|
841 |
-
jQuery( '#' + id ).text( response );
|
842 |
-
}
|
843 |
-
else {
|
844 |
-
jQuery( '#' + id ).html( response );
|
845 |
-
}
|
846 |
-
jQuery( '#' + id ).show();
|
847 |
-
window.scrollTo( 0, document.body.scrollHeight );
|
848 |
-
}
|
849 |
-
|
850 |
-
data = data + "&action=order_exporter&method=preview&limit="+size+"&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + woe_nonce;
|
851 |
-
$.post( ajaxurl, data, showPreview, "html" ).fail( function( xhr, textStatus, errorThrown ) {
|
852 |
-
showPreview( xhr.responseText );
|
853 |
-
});
|
854 |
-
}
|
855 |
-
// EXPORT FUNCTIONS
|
856 |
-
function get_data() {
|
857 |
-
var data = new Array();
|
858 |
-
data.push( { name: 'json', value: makeJson( $( '#export_job_settings' )) } );
|
859 |
-
data.push( { name: 'action', value: 'order_exporter' } );
|
860 |
-
data.push( { name: 'mode', value: mode } );
|
861 |
-
data.push( { name: 'id', value: job_id } );
|
862 |
-
return data;
|
863 |
-
}
|
864 |
-
|
865 |
-
function progress( percent, $element ) {
|
866 |
-
|
867 |
-
if ( percent == 0 ) {
|
868 |
-
$element.find( 'div' ).html( percent + "% " ).animate( { width: 0 }, 0 );
|
869 |
-
waitingDialog();
|
870 |
-
jQuery( '#progress_div' ).show();
|
871 |
-
}
|
872 |
-
else {
|
873 |
-
var progressBarWidth = percent * $element.width() / 100;
|
874 |
-
$element.find( 'div' ).html( percent + "% " ).animate( { width: progressBarWidth }, 200 );
|
875 |
-
|
876 |
-
if ( percent >= 100 ) {
|
877 |
-
if(!is_iPad_or_iPhone()) {
|
878 |
-
jQuery( '#progress_div' ).hide();
|
879 |
-
closeWaitingDialog();
|
880 |
-
}
|
881 |
-
}
|
882 |
-
}
|
883 |
-
}
|
884 |
-
|
885 |
-
function get_all( start, percent, method ) {
|
886 |
-
if (window.cancelling) {
|
887 |
-
return;
|
888 |
-
}
|
889 |
-
|
890 |
-
progress( parseInt( percent, 10 ), jQuery( '#progressBar' ) );
|
891 |
-
|
892 |
-
if ( percent < 100 ) {
|
893 |
-
data = get_data();
|
894 |
-
data.push( { name: 'method', value: method } );
|
895 |
-
data.push( { name: 'start', value: start } );
|
896 |
-
data.push( { name: 'file_id', value: window.file_id } );
|
897 |
-
data.push( { name: 'woe_nonce', value: woe_nonce } );
|
898 |
|
899 |
-
|
900 |
-
|
901 |
-
data: data,
|
902 |
-
cache: false,
|
903 |
-
url: ajaxurl,
|
904 |
-
dataType: "json",
|
905 |
-
error: function( xhr, status, error ) {
|
906 |
-
woe_show_error_message( xhr.responseText );
|
907 |
-
progress( 100, jQuery( '#progressBar' ) );
|
908 |
-
},
|
909 |
-
success: function( response ) {
|
910 |
-
if ( !response) {
|
911 |
-
woe_show_error_message(response);
|
912 |
-
} else if ( typeof response.error !== 'undefined') {
|
913 |
-
woe_show_error_message( response.error );
|
914 |
-
} else {
|
915 |
-
get_all( response.start, ( response.start / window.count ) * 100, method )
|
916 |
-
}
|
917 |
-
}
|
918 |
-
} );
|
919 |
-
}
|
920 |
-
else {
|
921 |
-
data = get_data();
|
922 |
-
data.push( { name: 'method', value: 'export_finish' } );
|
923 |
-
data.push( { name: 'file_id', value: window.file_id } );
|
924 |
-
data.push( { name: 'woe_nonce', value: woe_nonce } );
|
925 |
-
jQuery.ajax( {
|
926 |
-
type: "post",
|
927 |
-
data: data,
|
928 |
-
cache: false,
|
929 |
-
url: ajaxurl,
|
930 |
-
dataType: "json",
|
931 |
-
error: function( xhr, status, error ) {
|
932 |
-
alert( xhr.responseText );
|
933 |
-
},
|
934 |
-
success: function( response ) {
|
935 |
-
var download_format = output_format;
|
936 |
-
if( output_format=='XLS' && !jQuery( '#format_xls_use_xls_format' ).prop('checked') )
|
937 |
-
download_format = 'XLSX';
|
938 |
-
|
939 |
-
if(is_iPad_or_iPhone()) {
|
940 |
-
$( '#progress_div .title-download a' ).attr( 'href', ajaxurl + (ajaxurl.indexOf('?') === -1? '?':'&')+'action=order_exporter&method=export_download&format=' + download_format + '&file_id=' + window.file_id );
|
941 |
-
$( '#progress_div .title-download' ).show();
|
942 |
-
$( '#progress_div .title-cancel' ).hide();
|
943 |
-
$( '#progressBar' ).hide();
|
944 |
-
} else {
|
945 |
-
$( '#export_new_window_frame' ).attr( "src", ajaxurl + (ajaxurl.indexOf('?') === -1? '?':'&')+'action=order_exporter&method=export_download&format=' + download_format + '&file_id=' + window.file_id );
|
946 |
-
}
|
947 |
-
|
948 |
-
reset_date_filter_for_cron();
|
949 |
-
}
|
950 |
-
} );
|
951 |
-
}
|
952 |
-
}
|
953 |
-
|
954 |
-
function is_iPad_or_iPhone() {
|
955 |
-
return navigator.platform.match(/i(Phone|Pad)/i)
|
956 |
}
|
957 |
|
958 |
-
|
959 |
-
jQuery( "#background" ).addClass( "loading" );
|
960 |
-
jQuery( '#wpbody-content' ).keydown(function(event) {
|
961 |
-
if ( event.keyCode == 27 ) {
|
962 |
-
if (!window.cancelling) {
|
963 |
-
event.preventDefault();
|
964 |
-
window.cancelling = true;
|
965 |
|
966 |
-
|
967 |
-
|
968 |
-
data: {
|
969 |
-
action: 'order_exporter',
|
970 |
-
method: 'cancel_export',
|
971 |
-
file_id: window.file_id,
|
972 |
-
},
|
973 |
-
cache: false,
|
974 |
-
url: ajaxurl,
|
975 |
-
dataType: "json",
|
976 |
-
error: function( xhr, status, error ) {
|
977 |
-
alert( xhr.responseText );
|
978 |
-
progress( 100, jQuery( '#progressBar' ) );
|
979 |
-
},
|
980 |
-
success: function( response ) {
|
981 |
-
progress( 100, jQuery( '#progressBar' ) );
|
982 |
-
}
|
983 |
-
} );
|
984 |
|
985 |
-
|
986 |
-
window.file_id = '';
|
987 |
-
jQuery( '#wpbody-content' ).off('keydown');
|
988 |
-
}
|
989 |
-
return false;
|
990 |
-
}
|
991 |
-
});
|
992 |
-
}
|
993 |
-
function closeWaitingDialog() {
|
994 |
-
jQuery( "#background" ).removeClass( "loading" );
|
995 |
-
}
|
996 |
-
|
997 |
-
function openFilter(object_id, verify_checkboxes) {
|
998 |
-
verify_checkboxes = verify_checkboxes || 0;
|
999 |
-
var f = false;
|
1000 |
-
$( '#'+object_id+' ul' ).each( function( index ) {
|
1001 |
-
if ( $( this ).find( 'li:not(:first)' ).length ) {
|
1002 |
-
f = true;
|
1003 |
-
}
|
1004 |
-
} );
|
1005 |
-
|
1006 |
-
// show checkboxes for order and coupon section ?
|
1007 |
-
if ( f || verify_checkboxes && $('#'+object_id+" input[type='checkbox']:checked").length ) {
|
1008 |
-
$( '#'+object_id ).prev().click();
|
1009 |
-
}
|
1010 |
-
}
|
1011 |
-
|
1012 |
-
function validateExport() {
|
1013 |
-
if ( ( mode == settings_form.EXPORT_PROFILE ) && ( !$( "[name='settings[title]']" ).val() ) ) {
|
1014 |
-
alert( export_messages.empty_title );
|
1015 |
-
$( "[name='settings[title]']" ).focus();
|
1016 |
-
return false;
|
1017 |
-
}
|
1018 |
-
|
1019 |
-
if ( ( $( "#from_date" ).val() ) && ( $( "#to_date" ).val() ) ) {
|
1020 |
-
var d1 = new Date( $( "#from_date" ).val() );
|
1021 |
-
var d2 = new Date( $( "#to_date" ).val() );
|
1022 |
-
if ( d1.getTime() > d2.getTime() ) {
|
1023 |
-
alert( export_messages.wrong_date_range );
|
1024 |
-
return false;
|
1025 |
-
}
|
1026 |
-
}
|
1027 |
-
if ( $( '#order_fields > li' ).length == 0 )
|
1028 |
-
{
|
1029 |
-
alert( export_messages.no_fields );
|
1030 |
-
return false;
|
1031 |
-
}
|
1032 |
-
|
1033 |
-
return true;
|
1034 |
-
}
|
1035 |
-
// EXPORT FUNCTIONS END
|
1036 |
-
$( "#export-wo-pb-btn" ).click( function() {
|
1037 |
-
$( '#export_wo_pb_form' ).attr( "action", ajaxurl );
|
1038 |
-
$( '#export_wo_pb_form' ).find( '[name=json]' ).val( makeJson( $( '#export_job_settings' ) ) );
|
1039 |
-
$( '#export_wo_pb_form' ).submit();
|
1040 |
-
return false;
|
1041 |
-
} );
|
1042 |
-
|
1043 |
-
$( "#export-btn, #my-quick-export-btn" ).click( function() {
|
1044 |
-
window.cancelling = false;
|
1045 |
-
|
1046 |
-
data = get_data();
|
1047 |
-
|
1048 |
-
data.push( { name: 'method', value: 'export_start' } );
|
1049 |
-
|
1050 |
-
data.push( { name: 'woe_nonce', value: woe_nonce } );
|
1051 |
-
|
1052 |
-
if ( ( $( "#from_date" ).val() ) && ( $( "#to_date" ).val() ) ) {
|
1053 |
-
var d1 = new Date( $( "#from_date" ).val() );
|
1054 |
-
var d2 = new Date( $( "#to_date" ).val() );
|
1055 |
-
if ( d1.getTime() > d2.getTime() ) {
|
1056 |
-
alert( export_messages.wrong_date_range );
|
1057 |
-
return false;
|
1058 |
-
}
|
1059 |
-
}
|
1060 |
-
|
1061 |
-
if ( $( '#order_fields > li' ).length == 0 )
|
1062 |
-
{
|
1063 |
-
alert( export_messages.no_fields );
|
1064 |
-
return false;
|
1065 |
-
}
|
1066 |
-
|
1067 |
-
jQuery.ajax( {
|
1068 |
-
type: "post",
|
1069 |
-
data: data,
|
1070 |
-
cache: false,
|
1071 |
-
url: ajaxurl,
|
1072 |
-
dataType: "json",
|
1073 |
-
error: function( xhr, status, error ) {
|
1074 |
-
woe_show_error_message( xhr.responseText.replace(/<\/?[^>]+(>|$)/g, "") );
|
1075 |
-
},
|
1076 |
-
success: function( response ) {
|
1077 |
-
if (!response || typeof response['total'] == 'undefined') {
|
1078 |
-
woe_show_error_message(response);
|
1079 |
-
return;
|
1080 |
-
}
|
1081 |
-
window.count = response['total'];
|
1082 |
-
window.file_id = response['file_id'];
|
1083 |
-
console.log( window.count );
|
1084 |
-
|
1085 |
-
if ( window.count > 0 )
|
1086 |
-
get_all( 0, 0, 'export_part' );
|
1087 |
-
else {
|
1088 |
-
alert( export_messages.no_results );
|
1089 |
-
reset_date_filter_for_cron();
|
1090 |
-
}
|
1091 |
-
}
|
1092 |
-
} );
|
1093 |
-
|
1094 |
-
return false;
|
1095 |
-
} );
|
1096 |
-
$( "#save-btn" ).click( function() {
|
1097 |
-
if (!validateExport()) {
|
1098 |
-
return false;
|
1099 |
-
}
|
1100 |
-
setFormSubmitting();
|
1101 |
-
var data = 'json=' + makeJsonVar( $( '#export_job_settings' ) )
|
1102 |
-
data = data + "&action=order_exporter&method=save_settings&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + woe_nonce;
|
1103 |
-
$.post( ajaxurl, data, function( response ) {
|
1104 |
-
document.location = settings_form.save_settings_url;
|
1105 |
-
}, "json" );
|
1106 |
-
return false;
|
1107 |
-
} );
|
1108 |
-
$( "#save-only-btn" ).click( function() {
|
1109 |
-
if (!validateExport()) {
|
1110 |
-
return false;
|
1111 |
-
}
|
1112 |
-
setFormSubmitting();
|
1113 |
-
var data = 'json=' + makeJsonVar( $( '#export_job_settings' ) )
|
1114 |
-
data = data + "&action=order_exporter&method=save_settings&mode=" + mode + "&id=" + job_id + '&woe_nonce=' + woe_nonce;
|
1115 |
-
$('#Settings_updated').hide();
|
1116 |
-
$.post( ajaxurl, data, function( response ) {
|
1117 |
-
$('#Settings_updated').show().delay(5000).fadeOut();
|
1118 |
-
}, "json" );
|
1119 |
-
return false;
|
1120 |
-
} );
|
1121 |
-
$( "#copy-to-profiles" ).click( function() {
|
1122 |
-
if (!validateExport()) {
|
1123 |
-
return false;
|
1124 |
-
}
|
1125 |
-
|
1126 |
-
var data = 'json=' + makeJsonVar( $( '#export_job_settings' ) )
|
1127 |
-
data = data + "&action=order_exporter&method=save_settings&mode=" + settings_form.EXPORT_PROFILE + "&id=" + '&woe_nonce=' + woe_nonce;
|
1128 |
-
$.post( ajaxurl, data, function( response ) {
|
1129 |
-
document.location =settings_form.copy_to_profiles_url + '&profile_id=' + response.id;
|
1130 |
-
}, "json" );
|
1131 |
-
return false;
|
1132 |
-
} );
|
1133 |
-
|
1134 |
-
$( "#reset-profile" ).click( function () {
|
1135 |
-
if ( confirm( localize_settings_form.reset_profile_confirm ) ) {
|
1136 |
-
var data = "action=order_exporter&method=reset_profile&mode=" + mode + "&id=" + '&woe_nonce=' + woe_nonce;
|
1137 |
-
$.post( ajaxurl, data, function ( response ) {
|
1138 |
-
if (response.success) {
|
1139 |
-
document.location.reload();
|
1140 |
-
}
|
1141 |
-
}, "json" );
|
1142 |
-
}
|
1143 |
-
|
1144 |
-
return false;
|
1145 |
-
} );
|
1146 |
-
|
1147 |
-
openFilter('my-order', 1);
|
1148 |
-
|
1149 |
-
openFilter('my-products');
|
1150 |
-
|
1151 |
-
openFilter('my-shipping');
|
1152 |
-
|
1153 |
-
openFilter('my-users');
|
1154 |
-
|
1155 |
-
openFilter('my-coupons', 1);
|
1156 |
-
|
1157 |
-
openFilter('my-billing');
|
1158 |
-
|
1159 |
-
openFilter('my-items-meta');
|
1160 |
-
|
1161 |
-
if ( mode == settings_form.EXPORT_SCHEDULE )
|
1162 |
-
setup_alert_date_filter();
|
1163 |
-
//for XLSX
|
1164 |
-
$('#format_xls_use_xls_format').click(function() {
|
1165 |
-
change_filename_ext();
|
1166 |
-
});
|
1167 |
-
|
1168 |
-
show_summary_report( output_format );
|
1169 |
-
if( !summary_mode )
|
1170 |
-
jQuery('#summary_setup_fields').hide();
|
1171 |
-
|
1172 |
-
//logic for setup link
|
1173 |
-
jQuery( "#summary_report_by_products_checkbox" ).change( function(e, action) {
|
1174 |
-
var summary_report_fields = [];
|
1175 |
-
summary_report_fields.push($('#products_unselected_segment input[value="plain_products_summary_report_total_qty"]').parents('li'));
|
1176 |
-
summary_report_fields.push($('#products_unselected_segment input[value="plain_products_summary_report_total_amount"]').parents('li'));
|
1177 |
-
|
1178 |
-
jQuery('#manage_fields').toggleClass('summary-products-report', !!jQuery(this).prop('checked'));
|
1179 |
-
|
1180 |
-
$('#unselected_fields .segment_choice').removeClass('active');
|
1181 |
-
$('#unselected_fields_list .settings-segment').removeClass('active');
|
1182 |
-
|
1183 |
-
if (jQuery(this).prop('checked')) {
|
1184 |
-
var segment = 'products';
|
1185 |
-
|
1186 |
-
// hide product fields starts with 'line' and 'qty'
|
1187 |
-
$( '#products_unselected_segment input, #order_fields input' ).map( function () {
|
1188 |
-
var matches = $( this ).attr( 'value' ).match( /plain_products_(line|qty).*/ );
|
1189 |
-
if ( matches ) {
|
1190 |
-
$( this ).closest( '.mapping_row' ).hide();
|
1191 |
-
}
|
1192 |
-
} );
|
1193 |
-
|
1194 |
-
if ( 'onstart' !== action ) {
|
1195 |
-
// purge summary report fields before insert
|
1196 |
-
$('#order_fields input[value="plain_products_summary_report_total_qty"]').closest('.mapping_row').remove();
|
1197 |
-
$('#order_fields input[value="plain_products_summary_report_total_amount"]').closest('.mapping_row').remove();
|
1198 |
-
|
1199 |
-
// insert summary report fields
|
1200 |
-
jQuery.each( summary_report_fields, function( i, value ) {
|
1201 |
-
$(value).show();
|
1202 |
-
var $field_to_copy = $(value).clone();
|
1203 |
-
$field_to_copy
|
1204 |
-
.attr('style', '')
|
1205 |
-
.addClass('ui-draggabled')
|
1206 |
-
.removeClass('segment_field')
|
1207 |
-
.find('input').prop('disabled', false);
|
1208 |
-
|
1209 |
-
jQuery('#manage_fields #order_fields').append($field_to_copy);
|
1210 |
-
} );
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
} else {
|
1214 |
-
var segment = window.location.hash.replace('#segment=', '');
|
1215 |
-
|
1216 |
-
// show product fields starts with 'line' and 'qty'
|
1217 |
-
$( '#products_unselected_segment input, #order_fields input' ).map( function () {
|
1218 |
-
var $value = $( this ).attr( 'value' );
|
1219 |
-
if ( typeof $value === 'undefined' ) {
|
1220 |
-
return;
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
if ( $value.match( /plain_products_(line|qty).*/ ) ) {
|
1224 |
-
$( this ).closest( '.mapping_row' ).show();
|
1225 |
-
}
|
1226 |
-
} );
|
1227 |
-
|
1228 |
-
// purge summary report fields
|
1229 |
-
$('#order_fields input[value="plain_products_summary_report_total_qty"]').closest('.mapping_row').remove();
|
1230 |
-
$('#order_fields input[value="plain_products_summary_report_total_amount"]').closest('.mapping_row').remove();
|
1231 |
-
|
1232 |
-
jQuery.each( summary_report_fields, function( i, value ) {
|
1233 |
-
$(value).hide();
|
1234 |
-
} );
|
1235 |
-
}
|
1236 |
-
|
1237 |
-
$('#unselected_fields .segment_choice[data-segment="'+ segment +'"]').addClass('active');
|
1238 |
-
$('#unselected_fields_list .settings-segment#'+ segment +'_unselected_segment').addClass('active');
|
1239 |
-
|
1240 |
-
});
|
1241 |
-
|
1242 |
-
setTimeout(function () {
|
1243 |
-
jQuery( "#summary_report_by_products_checkbox" ).trigger('change', 'onstart');
|
1244 |
-
}, 1)
|
1245 |
-
|
1246 |
-
// this line must be last , we don't have any errors
|
1247 |
-
jQuery('#JS_error_onload').hide();
|
1248 |
-
|
1249 |
-
jQuery('#order_fields').on('click', '.mapping_row-delete_field', function () {
|
1250 |
-
|
1251 |
-
$(this).closest('.mapping_row').remove();
|
1252 |
-
|
1253 |
-
check_sortable_groups();
|
1254 |
-
|
1255 |
-
return false;
|
1256 |
-
});
|
1257 |
-
|
1258 |
-
jQuery('.tab-controls .tab-actions-buttons .add-meta').on('click', function () {
|
1259 |
-
|
1260 |
-
jQuery('.tab-actions-forms .segment-form').removeClass('active');
|
1261 |
-
|
1262 |
-
if (jQuery('.tab-actions-forms .div_meta.segment-form.' +
|
1263 |
-
jQuery('#unselected_fields .segment_choice.active').attr('data-segment') + '-segment'
|
1264 |
-
).length) {
|
1265 |
-
jQuery('.tab-actions-forms .div_meta.segment-form.' +
|
1266 |
-
jQuery('#unselected_fields .segment_choice.active').attr('data-segment') + '-segment'
|
1267 |
-
).addClass('active');
|
1268 |
-
} else {
|
1269 |
-
jQuery('.tab-actions-forms .div_meta.segment-form.all-segments').addClass('active');
|
1270 |
-
}
|
1271 |
-
|
1272 |
-
return false;
|
1273 |
-
});
|
1274 |
-
|
1275 |
-
jQuery('.tab-controls .tab-actions-buttons .add-custom').on('click', function () {
|
1276 |
-
|
1277 |
-
jQuery('.tab-actions-forms .segment-form').removeClass('active');
|
1278 |
-
|
1279 |
-
if (jQuery('.tab-actions-forms .div_custom.segment-form.' +
|
1280 |
-
jQuery('#unselected_fields .segment_choice.active').attr('data-segment') + '-segment'
|
1281 |
-
).length) {
|
1282 |
-
jQuery('.tab-actions-forms .div_custom.segment-form.' +
|
1283 |
-
jQuery('#unselected_fields .segment_choice.active').attr('data-segment') + '-segment'
|
1284 |
-
).addClass('active');
|
1285 |
-
} else {
|
1286 |
-
jQuery('.tab-actions-forms .div_custom.segment-form.all-segments').addClass('active');
|
1287 |
-
}
|
1288 |
-
|
1289 |
-
return false;
|
1290 |
-
});
|
1291 |
-
|
1292 |
-
jQuery('.tab-controls .button-cancel').on('click', function () {
|
1293 |
-
|
1294 |
-
jQuery(this).closest('.segment-form')
|
1295 |
-
.removeClass('active')
|
1296 |
-
.find('input,select').val('');
|
1297 |
-
|
1298 |
-
return false;
|
1299 |
-
});
|
1300 |
-
|
1301 |
-
init_image_uploaders();
|
1302 |
-
|
1303 |
-
} );
|
1304 |
-
|
1305 |
-
function is_flat_format(format) {
|
1306 |
-
return (settings_form.flat_formats.indexOf(format) > -1);
|
1307 |
-
}
|
1308 |
-
function is_object_format(format) {
|
1309 |
-
return (settings_form.object_formats.indexOf(format) > -1);
|
1310 |
-
}
|
1311 |
-
function is_xml_format(format) {
|
1312 |
-
return (settings_form.xml_formats.indexOf(format) > -1);
|
1313 |
-
}
|
1314 |
-
function reset_date_filter_for_cron() {
|
1315 |
-
if(mode == 'cron') {
|
1316 |
-
jQuery( "#from_date" ).val("");
|
1317 |
-
jQuery( "#to_date" ).val("");
|
1318 |
-
try_color_date_filter();
|
1319 |
-
}
|
1320 |
-
}
|
1321 |
-
|
1322 |
-
function create_unselected_fields( old_output_format, format , format_changed, old_format_order_fields ) {
|
1323 |
-
|
1324 |
-
var $unselected_fields_list = jQuery('#unselected_fields_list');
|
1325 |
-
|
1326 |
-
var $unselected_segment_id = '%s_unselected_segment';
|
1327 |
-
|
1328 |
-
var active_segment_id = $unselected_fields_list.find('.section.active').attr('id');
|
1329 |
-
|
1330 |
-
$unselected_fields_list.html("");
|
1331 |
-
$unselected_fields_list.append( make_segments( $unselected_segment_id ) );
|
1332 |
-
|
1333 |
-
if (active_segment_id) {
|
1334 |
-
jQuery('#unselected_fields_list #' + active_segment_id).addClass('active');
|
1335 |
-
}
|
1336 |
-
|
1337 |
-
jQuery.each( window['all_fields'], function( segment, fields ) {
|
1338 |
-
|
1339 |
-
fields.forEach(function (value) {
|
1340 |
-
|
1341 |
-
var $unselected_field_segment = jQuery( '#' + sprintf( $unselected_segment_id, segment ) );
|
1342 |
-
var index = value.key;
|
1343 |
-
|
1344 |
-
$unselected_field_segment.append(
|
1345 |
-
make_unselected_field( index, value, format, format_changed, segment )
|
1346 |
-
);
|
1347 |
-
|
1348 |
-
activate_draggable_field(
|
1349 |
-
$unselected_field_segment.find('.segment_field'),
|
1350 |
-
segment,
|
1351 |
-
format
|
1352 |
-
);
|
1353 |
-
})
|
1354 |
-
|
1355 |
-
});
|
1356 |
-
}
|
1357 |
-
|
1358 |
-
function make_segments($segment_id) {
|
1359 |
-
|
1360 |
-
var $segments_list = jQuery('<ul></ul>');
|
1361 |
-
|
1362 |
-
jQuery.each( window['order_segments'], function( index, label ) {
|
1363 |
-
var $segment = jQuery('<div id="' + sprintf($segment_id, index) + '" class="section settings-segment"></div>')
|
1364 |
-
$segments_list.append($segment);
|
1365 |
-
});
|
1366 |
-
|
1367 |
-
return $segments_list;
|
1368 |
-
}
|
1369 |
-
|
1370 |
-
function sprintf( format ) {
|
1371 |
-
for ( var i = 1; i < arguments.length; i ++ ) {
|
1372 |
-
format = format.replace( /%s/, arguments[i] );
|
1373 |
-
}
|
1374 |
-
return format;
|
1375 |
-
}
|
1376 |
-
|
1377 |
-
function make_unselected_field($index, $field_data, $format, $format_changed, $segment ) {
|
1378 |
-
|
1379 |
-
var label_part = '';
|
1380 |
-
var label_prefix = '';
|
1381 |
-
var value_part = '';
|
1382 |
-
|
1383 |
-
var $mapping_col_1 = jQuery('<div class="mapping_col_1" style="width: 10px"></div>');
|
1384 |
-
|
1385 |
-
var $mapping_col_2 = jQuery('<div class="mapping_col_2" title="'+escapeStr($index)+'"></div>');
|
1386 |
-
var $mapping_col_3 = jQuery('<div class="mapping_col_3"></div>');
|
1387 |
-
|
1388 |
-
var colname = escapeStr($field_data.colname);
|
1389 |
-
|
1390 |
-
var _index = $index;
|
1391 |
-
|
1392 |
-
if ( is_flat_format($format) && ['products', 'coupons'].indexOf($segment) > -1 ) {
|
1393 |
-
_index = 'plain_' + $segment + '_' + $index;
|
1394 |
-
}
|
1395 |
-
|
1396 |
-
if($format_changed) {
|
1397 |
-
if( is_flat_format( $format ) )
|
1398 |
-
colname = $field_data.label;
|
1399 |
-
else {
|
1400 |
-
|
1401 |
-
colname = $index;
|
1402 |
-
|
1403 |
-
if ( is_xml_format( $format ) )
|
1404 |
-
colname = to_xml_tags( colname );
|
1405 |
-
}
|
1406 |
-
}
|
1407 |
-
|
1408 |
-
if ( ! is_flat_format($format) && ['products', 'coupons'].indexOf($segment) > -1 ) {
|
1409 |
-
|
1410 |
-
$mapping_col_1
|
1411 |
-
.append( make_input( 'hidden', null, $segment + '[][label]' , $field_data.label, false ) )
|
1412 |
-
.append( make_input( 'hidden', null, $segment + '[][format]' , $field_data.format, false ) )
|
1413 |
-
.append( make_input( 'hidden', null, $segment + '[][segment]' , $segment, false ) )
|
1414 |
-
.append( make_input( 'hidden', null, $segment + '[][key]' , $index, false ) );
|
1415 |
-
|
1416 |
-
$mapping_col_3.append( make_input( 'input', 'mapping_fieldname', $segment + '[][colname]', colname ) );
|
1417 |
-
|
1418 |
-
if ( $index.indexOf( 'static_field' ) >= 0 ) {
|
1419 |
-
value_part = '<div class="mapping_col_3 custom-field-value"><input class="mapping_fieldname" type=input name="' + $segment + '[][value]" value="' + $field_data.value + '"></div>';
|
1420 |
-
}
|
1421 |
-
|
1422 |
-
} else {
|
1423 |
-
|
1424 |
-
if ( $segment === 'products' ) {
|
1425 |
-
label_prefix = '[P] '
|
1426 |
-
}
|
1427 |
-
|
1428 |
-
if ( $segment === 'coupons' ) {
|
1429 |
-
label_prefix = '[C] '
|
1430 |
-
}
|
1431 |
-
|
1432 |
-
$mapping_col_1
|
1433 |
-
.append( make_input( 'hidden', null, 'orders[][segment]' , $segment, false ) )
|
1434 |
-
.append( make_input( 'hidden', null, 'orders[][key]' , _index, false ) )
|
1435 |
-
.append( make_input( 'hidden', null, 'orders[][label]' , $field_data.label, false ) )
|
1436 |
-
.append( make_input( 'hidden', null, 'orders[][format]' , $field_data.format, false ) );
|
1437 |
-
|
1438 |
-
$mapping_col_3.append( make_input( 'input', 'mapping_fieldname', 'orders[][colname]', colname ) );
|
1439 |
-
|
1440 |
-
if ( $index.indexOf( 'static_field' ) >= 0 ) {
|
1441 |
-
value_part = '<div class="mapping_col_3 custom-field-value"><input class="mapping_fieldname" type=input name="' + 'orders[][value]" value="' + $field_data.value + '"></div>';
|
1442 |
-
}
|
1443 |
-
|
1444 |
-
}
|
1445 |
-
var delete_btn = '<div class="mapping_col_3 mapping_row-delete_field_block"><a href="#" class="mapping_row-delete_field"><span class="dashicons dashicons-trash"></span></a></div>';
|
1446 |
-
|
1447 |
-
$mapping_col_2.append( '<span class="field-prefix">' + label_prefix + '</span>' + $field_data.label + label_part );
|
1448 |
-
|
1449 |
-
if ( $index.charAt( 0 ) === '_' || $index.substr( 0,3 ) === 'pa_' || !$field_data.default || $index.indexOf( 'static_field' ) > -1) {
|
1450 |
-
$mapping_col_2.append( '<a href="#" onclick="return remove_custom_field(this);" class="mapping_row-delete_custom_field" style="float: right;"><span class="ui-icon ui-icon-trash"></span></a>' );
|
1451 |
-
}
|
1452 |
-
|
1453 |
-
var $field = jQuery('<li class="mapping_row segment_field segment_'+ $segment +'"></li>');
|
1454 |
-
|
1455 |
-
$field
|
1456 |
-
.append( $mapping_col_1 )
|
1457 |
-
.append( $mapping_col_2 )
|
1458 |
-
.append( $mapping_col_3 )
|
1459 |
-
.append( value_part )
|
1460 |
-
.append( delete_btn );
|
1461 |
-
|
1462 |
-
$field.find('input').prop('disabled', 'disabled');
|
1463 |
-
|
1464 |
-
return $field;
|
1465 |
-
}
|
1466 |
-
|
1467 |
-
function make_input( $type, $classes, $name, $field_data, $is_checked ) {
|
1468 |
-
|
1469 |
-
var $input = jQuery('<input>');
|
1470 |
-
|
1471 |
-
$input.prop('type', $type);
|
1472 |
-
|
1473 |
-
if ( $classes && jQuery.isArray($classes) ) {
|
1474 |
-
$input.addClass($classes.join(' '));
|
1475 |
-
}
|
1476 |
-
|
1477 |
-
$input.prop('name', $name);
|
1478 |
-
$input.attr('value', $field_data);
|
1479 |
-
|
1480 |
-
if ( $is_checked ) {
|
1481 |
-
$input.prop('checked', 'checked');
|
1482 |
-
}
|
1483 |
-
|
1484 |
-
return $input;
|
1485 |
-
}
|
1486 |
-
|
1487 |
-
function check_sortable_groups () {
|
1488 |
-
jQuery('#sortable_products').closest('.mapping_row').toggle(!!jQuery('#sortable_products li').length);
|
1489 |
-
jQuery('#sortable_coupons').closest('.mapping_row').toggle(!!jQuery('#sortable_coupons li').length);
|
1490 |
-
}
|
1491 |
-
|
1492 |
-
function activate_draggable_field (el, segment, format) {
|
1493 |
-
|
1494 |
-
var no_flat_sortable_selector = '#manage_fields #order_fields #sortable_' + segment;
|
1495 |
-
var flat_sortable_selector = '#manage_fields #order_fields';
|
1496 |
-
|
1497 |
-
el.draggable({
|
1498 |
-
connectToSortable: [no_flat_sortable_selector, flat_sortable_selector].join(','),
|
1499 |
-
helper: "clone",
|
1500 |
-
revert: "invalid",
|
1501 |
-
start: function ( event, ui ) {
|
1502 |
-
jQuery(ui.helper[0]).removeClass( 'blink' );
|
1503 |
-
},
|
1504 |
-
stop: function ( event, ui ) {
|
1505 |
-
el.removeClass( 'blink' );
|
1506 |
-
|
1507 |
-
var moved_to_sortable = jQuery(ui.helper[0]).closest(flat_sortable_selector).length;
|
1508 |
-
var move_to_sortable_group = jQuery(ui.helper[0]).closest(no_flat_sortable_selector).length;
|
1509 |
-
|
1510 |
-
if (!moved_to_sortable) {
|
1511 |
-
return;
|
1512 |
-
}
|
1513 |
-
|
1514 |
-
moving_products_and_coupons_group_blocks_to_first_item(format);
|
1515 |
-
|
1516 |
-
// change static field key index to prevent fields with identical keys
|
1517 |
-
var tmp_prefix = ['products', 'coupons'].indexOf(segment) === -1 ? '' : 'plain_' + segment + '_';
|
1518 |
-
if ( jQuery(ui.helper[0]).find('input[value*="' + tmp_prefix + 'static_field"]').length > 0 ) {
|
1519 |
-
var suffix = 0;
|
1520 |
-
jQuery('#order_fields input[value*="' + tmp_prefix + 'static_field_"]').each(function () {
|
1521 |
-
|
1522 |
-
var match = jQuery(this).attr('value').match(/.*static_field_(\d+)/);
|
1523 |
-
|
1524 |
-
if (!match) {
|
1525 |
-
return true;
|
1526 |
-
}
|
1527 |
-
|
1528 |
-
var n = parseInt(match[1]);
|
1529 |
-
|
1530 |
-
if(n > suffix) {
|
1531 |
-
suffix = n;
|
1532 |
-
}
|
1533 |
-
});
|
1534 |
-
|
1535 |
-
var field_key = tmp_prefix + 'static_field_' + (suffix + 1);
|
1536 |
-
jQuery(ui.helper[0]).find('input[name="orders[][key]"]').first().val(field_key);
|
1537 |
-
}
|
1538 |
-
// end change static field key
|
1539 |
-
|
1540 |
-
var moving_copy_original_el = jQuery(ui.helper[0]);
|
1541 |
-
|
1542 |
-
moving_copy_original_el
|
1543 |
-
.attr('style', '')
|
1544 |
-
.addClass('ui-draggabled')
|
1545 |
-
.removeClass('segment_field')
|
1546 |
-
.find('input').prop('disabled', false);
|
1547 |
-
|
1548 |
-
|
1549 |
-
if (is_flat_format(format) || move_to_sortable_group || ['products', 'coupons'].indexOf(segment) === -1) {
|
1550 |
-
return;
|
1551 |
-
}
|
1552 |
-
|
1553 |
-
jQuery(no_flat_sortable_selector).append(moving_copy_original_el.clone());
|
1554 |
-
|
1555 |
-
moving_copy_original_el.remove();
|
1556 |
-
|
1557 |
-
check_sortable_groups();
|
1558 |
-
},
|
1559 |
-
});
|
1560 |
-
|
1561 |
-
}
|
1562 |
-
|
1563 |
-
function moving_products_and_coupons_group_blocks_to_first_item(format) {
|
1564 |
-
|
1565 |
-
if ( is_flat_format ( format ) ) {
|
1566 |
-
|
1567 |
-
var first_products_field = jQuery('#order_fields [value*="plain_products_"]').first().closest('li');
|
1568 |
-
var first_coupons_field = jQuery('#order_fields [value*="plain_coupons_"]').first().closest('li');
|
1569 |
-
|
1570 |
-
if (first_products_field.length) {
|
1571 |
-
var products_group_block = jQuery('#order_fields .flat-products-group').clone();
|
1572 |
-
jQuery('#order_fields .flat-products-group').remove();
|
1573 |
-
first_products_field.before(products_group_block);
|
1574 |
-
}
|
1575 |
-
|
1576 |
-
if (first_coupons_field.length) {
|
1577 |
-
var coupons_group_block = jQuery('#order_fields .flat-coupons-group').clone();
|
1578 |
-
jQuery('#order_fields .flat-coupons-group').remove();
|
1579 |
-
first_coupons_field.before(coupons_group_block);
|
1580 |
-
}
|
1581 |
-
|
1582 |
-
return;
|
1583 |
-
}
|
1584 |
-
|
1585 |
-
var first_products_field = jQuery('#order_fields [name="products[][key]"]').first().closest('li');
|
1586 |
-
|
1587 |
-
if (!jQuery('#sortable_products > li').length && first_products_field.length) {
|
1588 |
-
var products_group_block = jQuery('#order_fields .flat-products-group').clone();
|
1589 |
-
jQuery('#order_fields .flat-products-group').remove();
|
1590 |
-
first_products_field.before(products_group_block);
|
1591 |
-
}
|
1592 |
-
|
1593 |
-
var first_coupons_field = jQuery('#order_fields [name="coupons[][key]"]').first().closest('li');
|
1594 |
-
|
1595 |
-
if (!jQuery('#sortable_coupons > li').length && first_coupons_field.length) {
|
1596 |
-
var coupons_group_block = jQuery('#order_fields .flat-coupons-group').clone();
|
1597 |
-
jQuery('#order_fields .flat-coupons-group').remove();
|
1598 |
-
first_coupons_field.before(coupons_group_block);
|
1599 |
-
}
|
1600 |
-
}
|
1601 |
-
|
1602 |
-
function synch_selected_fields (old_format, new_format) {
|
1603 |
-
|
1604 |
-
var settings = jQuery('#export_job_settings').serializeJSON();
|
1605 |
-
|
1606 |
-
if (is_flat_format(old_format) && is_flat_format(new_format)) {
|
1607 |
-
window['selected_order_fields'] = settings.orders || [];
|
1608 |
-
window['selected_order_products_fields'] = [];
|
1609 |
-
window['selected_order_coupons_fields'] = [];
|
1610 |
-
return;
|
1611 |
-
}
|
1612 |
-
|
1613 |
-
if (!is_flat_format(old_format) && !is_flat_format(new_format)) {
|
1614 |
-
window['selected_order_fields'] = settings.orders || [];
|
1615 |
-
window['selected_order_products_fields'] = settings.products || [];
|
1616 |
-
window['selected_order_coupons_fields'] = settings.coupons || [];
|
1617 |
-
return;
|
1618 |
-
}
|
1619 |
-
|
1620 |
-
if (is_flat_format(old_format) && !is_flat_format(new_format)) {
|
1621 |
-
|
1622 |
-
var products = [];
|
1623 |
-
var coupons = [];
|
1624 |
-
var orders = [];
|
1625 |
-
|
1626 |
-
(settings.orders || []).forEach(function (item) {
|
1627 |
-
|
1628 |
-
if (item.key.indexOf('plain_products') > -1) {
|
1629 |
-
item.key = item.key.replace('plain_products_', '');
|
1630 |
-
products.push(item);
|
1631 |
-
return true;
|
1632 |
-
}
|
1633 |
-
|
1634 |
-
if (item.key.indexOf('plain_coupons') > -1) {
|
1635 |
-
item.key = item.key.replace('plain_coupons_', '');
|
1636 |
-
coupons.push(item);
|
1637 |
-
return true;
|
1638 |
-
}
|
1639 |
-
|
1640 |
-
orders.push(item);
|
1641 |
-
});
|
1642 |
-
|
1643 |
-
window['selected_order_fields'] = orders;
|
1644 |
-
window['selected_order_products_fields'] = products;
|
1645 |
-
window['selected_order_coupons_fields'] = coupons;
|
1646 |
-
|
1647 |
-
return;
|
1648 |
-
}
|
1649 |
-
|
1650 |
-
if (!is_flat_format(old_format) && is_flat_format(new_format)) {
|
1651 |
-
|
1652 |
-
var products = [];
|
1653 |
-
var coupons = [];
|
1654 |
-
var orders = [];
|
1655 |
-
|
1656 |
-
(settings.products || []).forEach(function (item) {
|
1657 |
-
item.key = 'plain_products_' + item.key;
|
1658 |
-
products.push(item);
|
1659 |
-
});
|
1660 |
-
|
1661 |
-
(settings.coupons || []).forEach(function (item) {
|
1662 |
-
item.key = 'plain_coupons_' + item.key;
|
1663 |
-
coupons.push(item);
|
1664 |
-
});
|
1665 |
-
|
1666 |
-
(settings.orders || []).forEach(function (item) {
|
1667 |
-
|
1668 |
-
orders.push(item);
|
1669 |
-
|
1670 |
-
if (item.key === 'products') {
|
1671 |
-
orders = orders.concat(products);
|
1672 |
-
}
|
1673 |
-
|
1674 |
-
if (item.key === 'coupons') {
|
1675 |
-
orders = orders.concat(coupons);
|
1676 |
-
}
|
1677 |
-
});
|
1678 |
-
|
1679 |
-
window['selected_order_fields'] = orders;
|
1680 |
-
window['selected_order_products_fields'] = [];
|
1681 |
-
window['selected_order_coupons_fields'] = [];
|
1682 |
-
|
1683 |
-
return;
|
1684 |
-
}
|
1685 |
-
|
1686 |
-
}
|
1687 |
-
|
1688 |
-
function woe_show_error_message(text) {
|
1689 |
-
if (!text)
|
1690 |
-
text = "Please, open section 'Misc Settings' and \n mark checkbox 'Enable debug output' \n to see exact error message";
|
1691 |
-
alert(text);
|
1692 |
-
}
|
1693 |
-
|
1694 |
-
function init_image_uploaders() {
|
1695 |
-
var custom_uploader;
|
1696 |
-
jQuery( '.image-upload-button' ).click( function ( e ) {
|
1697 |
-
e.preventDefault();
|
1698 |
-
if ( custom_uploader ) {
|
1699 |
-
custom_uploader.open();
|
1700 |
-
return;
|
1701 |
-
}
|
1702 |
-
|
1703 |
-
custom_uploader = wp.media.frames.file_frame = wp.media( {
|
1704 |
-
title: 'Choose Image',
|
1705 |
-
button: {
|
1706 |
-
text: 'Choose Image'
|
1707 |
-
},
|
1708 |
-
multiple: false
|
1709 |
-
} );
|
1710 |
-
|
1711 |
-
var self = this;
|
1712 |
-
custom_uploader.on( 'select', function () {
|
1713 |
-
attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
|
1714 |
-
jQuery( self ).siblings( 'input[type="hidden"]' ).val( attachment.url );
|
1715 |
-
jQuery( self ).siblings( 'img' ).attr( 'src', attachment.url ).removeClass('hidden');
|
1716 |
-
jQuery( self ).siblings( '.image-clear-button' ).removeClass('hidden');
|
1717 |
-
} );
|
1718 |
-
|
1719 |
-
custom_uploader.open();
|
1720 |
-
} );
|
1721 |
-
|
1722 |
-
jQuery( '.image-clear-button' ).click( function ( e ) {
|
1723 |
-
jQuery( this ).siblings( 'input[type="hidden"]' ).val( '' );
|
1724 |
-
jQuery( this ).siblings( 'img' ).attr( 'src', '' ).addClass( 'hidden' );
|
1725 |
-
jQuery( this ).addClass( 'hidden' );
|
1726 |
-
} );
|
1727 |
-
|
1728 |
-
return custom_uploader;
|
1729 |
-
}
|
1 |
+
String.prototype.hashCode = function () {
|
2 |
+
var hash = 0, i, chr;
|
3 |
+
if ( this.length === 0 ) {
|
4 |
+
return hash;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
}
|
6 |
+
for ( i = 0; i < this.length; i ++ ) {
|
7 |
+
chr = this.charCodeAt( i );
|
8 |
+
hash = (
|
9 |
+
(
|
10 |
+
hash << 5
|
11 |
+
) - hash
|
12 |
+
) + chr;
|
13 |
+
hash |= 0; // Convert to 32bit integer
|
14 |
}
|
15 |
+
return hash;
|
16 |
+
};
|
17 |
|
18 |
+
function woe_make_json_var( obj ) {
|
19 |
+
return encodeURIComponent( woe_make_json( obj ) );
|
20 |
+
}
|
21 |
|
22 |
+
function woe_make_json( obj ) {
|
23 |
+
return JSON.stringify( obj.serializeJSON() );
|
24 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
function woe_change_filename_ext() {
|
27 |
+
if ( jQuery( '#export_filename' ).length ) {
|
28 |
+
var filename = jQuery( '#export_filename input' ).val();
|
29 |
+
var ext = output_format.toLowerCase();
|
30 |
+
if ( ext == 'xls' && ! jQuery( '#format_xls_use_xls_format' ).prop( 'checked' ) ) //fix for XLSX
|
31 |
+
{
|
32 |
+
ext = 'xlsx';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
|
|
34 |
|
35 |
+
var file = filename.replace( /^(.*)\..+$/, "$1." + ext );
|
36 |
+
if ( file.indexOf( "." ) == - 1 ) //no dots??
|
37 |
+
{
|
38 |
+
file = file + "." + ext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
+
jQuery( '#export_filename input' ).val( file );
|
41 |
+
woe_show_summary_report( output_format );
|
42 |
}
|
43 |
+
}
|
44 |
|
45 |
+
function woe_show_summary_report( ext ) {
|
46 |
+
if ( woe_is_flat_format( ext ) ) {
|
47 |
+
jQuery( '#summary_report_by_products' ).show();
|
48 |
+
} else {
|
49 |
+
jQuery( '#summary_report_by_products' ).hide();
|
50 |
+
jQuery( '#summary_setup_fields' ).hide();
|
51 |
+
jQuery( '#summary_report_by_products_checkbox' ).prop( 'checked', false ).trigger( 'change' );
|
52 |
+
}
|
53 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
//for warning
|
56 |
+
function woe_setup_alert_date_filter() {
|
57 |
+
default_date_filter_color = jQuery( "#my-date-filter" ).css( 'color' );
|
58 |
+
woe_try_color_date_filter();
|
59 |
+
jQuery( '#from_date' ).change( function () {
|
60 |
+
woe_try_color_date_filter();
|
61 |
} );
|
62 |
+
jQuery( '#to_date' ).change( function () {
|
63 |
+
woe_try_color_date_filter();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
|
67 |
+
function woe_is_flat_format( format ) {
|
68 |
+
return (
|
69 |
+
settings_form.flat_formats.indexOf( format ) > - 1
|
70 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
|
73 |
+
function woe_reset_date_filter_for_cron() {
|
74 |
+
if ( mode == 'cron' ) {
|
75 |
+
jQuery( "#from_date" ).val( "" );
|
76 |
+
jQuery( "#to_date" ).val( "" );
|
77 |
+
woe_try_color_date_filter();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
+
function woe_try_color_date_filter() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
var color = default_date_filter_color;
|
84 |
|
85 |
+
if ( jQuery( "#from_date" ).val() || jQuery( "#to_date" ).val() ) {
|
86 |
+
color = 'red';
|
87 |
+
}
|
88 |
|
89 |
+
jQuery( "#my-date-filter" ).css( 'color', color );
|
90 |
}
|
91 |
|
92 |
+
function woe_show_error_message( text ) {
|
93 |
+
if ( ! text ) {
|
94 |
+
text = "Please, open section 'Misc Settings' and \n mark checkbox 'Enable debug output' \n to see exact error message";
|
|
|
|
|
95 |
}
|
96 |
+
alert( text );
|
97 |
}
|
98 |
|
99 |
+
function woe_init_image_uploaders() {
|
100 |
|
101 |
+
var custom_uploader;
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
+
jQuery( '.image-upload-button' ).click( function ( e ) {
|
104 |
+
e.preventDefault();
|
105 |
+
if ( custom_uploader ) {
|
106 |
+
custom_uploader.open();
|
107 |
+
return;
|
108 |
+
}
|
|
|
109 |
|
110 |
+
custom_uploader = wp.media.frames.file_frame = wp.media( {
|
111 |
+
title: 'Choose Image',
|
112 |
+
button: {
|
113 |
+
text: 'Choose Image'
|
114 |
+
},
|
115 |
+
multiple: false
|
116 |
+
} );
|
|
|
|
|
117 |
|
118 |
+
var self = this;
|
119 |
+
custom_uploader.on( 'select', function () {
|
120 |
+
attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
|
121 |
+
jQuery( self ).siblings( 'input[type="hidden"].source_url' ).val( attachment.url );
|
122 |
+
jQuery( self ).siblings( 'input[type="hidden"].source_id' ).val( attachment.id );
|
123 |
+
jQuery( self ).siblings( 'img' ).attr( 'src', attachment.url ).removeClass( 'hidden' );
|
124 |
+
jQuery( self ).siblings( '.image-clear-button' ).removeClass( 'hidden' );
|
125 |
+
} );
|
126 |
|
127 |
+
custom_uploader.open();
|
128 |
+
} );
|
129 |
|
130 |
+
jQuery( '.image-clear-button' ).click( function ( e ) {
|
131 |
+
jQuery( this ).siblings( 'input[type="hidden"]' ).val( '' );
|
132 |
+
jQuery( this ).siblings( 'img' ).attr( 'src', '' ).addClass( 'hidden' );
|
133 |
+
jQuery( this ).addClass( 'hidden' );
|
134 |
+
} );
|
|
|
|
|
135 |
|
136 |
+
return custom_uploader;
|
137 |
+
}
|
138 |
|
139 |
+
var woe_form_submitting = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
+
function woe_set_form_submitting() {
|
142 |
+
woe_form_submitting = true;
|
143 |
+
}
|
|
|
144 |
|
145 |
+
window.onload = function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
+
var form = jQuery( '#export_job_settings' );
|
148 |
+
var on_load_form_data = form.serialize();
|
149 |
|
150 |
+
var woe_is_dirty = function ( on_load_form_data ) {
|
151 |
+
return on_load_form_data.hashCode() !== form.serialize().hashCode()
|
152 |
+
};
|
153 |
|
154 |
+
window.addEventListener( "beforeunload", function ( e ) {
|
|
|
|
|
|
|
155 |
|
156 |
+
if ( woe_is_dirty( on_load_form_data ) && ! woe_form_submitting ) {
|
157 |
+
(
|
158 |
+
e || window.event
|
159 |
+
).returnValue = false; //Gecko + IE
|
160 |
+
return false; //Gecko + Webkit, Safari, Chrome etc.
|
161 |
+
} else {
|
162 |
+
return undefined;
|
163 |
+
}
|
164 |
} );
|
165 |
+
}
|
166 |
|
167 |
+
jQuery( document ).ready( function ( $ ) {
|
|
|
|
|
168 |
|
169 |
+
$( '.my-hide-next' ).click( function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
+
$( this ).next().toggle();
|
|
|
|
|
|
|
172 |
|
173 |
+
var is_shown = ! $( this ).next().is( ':hidden' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
+
$( this ).find( 'span' )
|
176 |
+
.toggleClass( 'ui-icon-triangle-1-n', is_shown )
|
177 |
+
.toggleClass( 'ui-icon-triangle-1-s', ! is_shown );
|
178 |
} );
|
179 |
|
180 |
+
$( '#date_format_block select' ).on( 'change', function () {
|
181 |
var value = $( this ).val();
|
182 |
+
if ( value == 'custom' ) {
|
183 |
$( '#custom_date_format_block' ).show();
|
184 |
} else {
|
185 |
$( '#custom_date_format_block' ).hide();
|
187 |
}
|
188 |
} );
|
189 |
|
190 |
+
$( '#time_format_block select' ).on( 'change', function () {
|
191 |
var value = $( this ).val();
|
192 |
+
if ( value == 'custom' ) {
|
193 |
$( '#custom_time_format_block' ).show();
|
194 |
} else {
|
195 |
$( '#custom_time_format_block' ).hide();
|
197 |
}
|
198 |
} );
|
199 |
|
200 |
+
$( 'input[type="checkbox"][name="settings[custom_php]"]' ).on( 'change', function () {
|
201 |
$( 'div#custom_php_code_textarea' ).toggle( $( this ).is( ':checked' ) );
|
202 |
} );
|
203 |
|
204 |
+
if (typeof settings_form.settings.show_date_time_picker_for_date_range !== 'undefined' && settings_form.settings.show_date_time_picker_for_date_range) {
|
205 |
+
if ( typeof woe_init_datetime_picker !== 'undefined' ) {
|
206 |
+
woe_init_datetime_picker($("#from_date"), {'hours': "00", 'minutes': "00", 'seconds': "00"});
|
207 |
+
woe_init_datetime_picker($("#to_date"), {'hours': "23", 'minutes': "59", 'seconds': "59"});
|
208 |
+
}
|
209 |
+
} else {
|
210 |
+
jQuery('.date').datepicker({
|
211 |
+
dateFormat: 'yy-mm-dd',
|
212 |
+
constrainInput: false
|
213 |
+
});
|
214 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
+
if ( mode == settings_form.EXPORT_SCHEDULE ) {
|
217 |
+
woe_setup_alert_date_filter();
|
218 |
}
|
219 |
|
220 |
+
//for XLSX
|
221 |
+
$( '#format_xls_use_xls_format' ).click( function () {
|
222 |
+
woe_change_filename_ext();
|
|
|
|
|
|
|
223 |
} );
|
224 |
|
225 |
+
woe_show_summary_report( output_format );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
+
if ( ! summary_mode ) {
|
228 |
+
jQuery( '#summary_setup_fields' ).hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
}
|
230 |
|
231 |
+
woe_init_image_uploaders();
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
|
233 |
+
// this line must be last , we don't have any errors
|
234 |
+
jQuery( '#JS_error_onload' ).hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
+
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/FPDF/{fpdf.php → class-woe-fpdf.php}
RENAMED
@@ -1,7 +1,8 @@
|
|
1 |
<?php
|
2 |
/*******************************************************************************
|
3 |
-
*
|
4 |
-
*
|
|
|
5 |
* Version: 1.81 *
|
6 |
* Date: 2015-12-20 *
|
7 |
* Author: Olivier PLATHEY *
|
@@ -9,7 +10,7 @@
|
|
9 |
|
10 |
define('FPDF_VERSION','1.81');
|
11 |
|
12 |
-
class
|
13 |
{
|
14 |
protected $page; // current page number
|
15 |
protected $n; // current object number
|
@@ -621,6 +622,10 @@ function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link
|
|
621 |
}
|
622 |
if($txt!=='')
|
623 |
{
|
|
|
|
|
|
|
|
|
624 |
if(!isset($this->CurrentFont))
|
625 |
$this->Error('No font has been set');
|
626 |
if($align=='R')
|
1 |
<?php
|
2 |
/*******************************************************************************
|
3 |
+
* WOE_FPDF *
|
4 |
+
* Renamed to avoid accidental replacement *
|
5 |
+
*
|
6 |
* Version: 1.81 *
|
7 |
* Date: 2015-12-20 *
|
8 |
* Author: Olivier PLATHEY *
|
10 |
|
11 |
define('FPDF_VERSION','1.81');
|
12 |
|
13 |
+
class WOE_FPDF
|
14 |
{
|
15 |
protected $page; // current page number
|
16 |
protected $n; // current object number
|
622 |
}
|
623 |
if($txt!=='')
|
624 |
{
|
625 |
+
if ( function_exists('iconv') ) {
|
626 |
+
$txt = iconv('UTF-8', 'windows-1252', $txt);
|
627 |
+
}
|
628 |
+
|
629 |
if(!isset($this->CurrentFont))
|
630 |
$this->Error('No font has been set');
|
631 |
if($align=='R')
|
classes/FPDF/class-woe-pdf-mc-table.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
-
if ( ! class_exists( '
|
3 |
-
require( 'fpdf.php' );
|
4 |
}
|
5 |
|
6 |
-
class WOE_PDF_MC_Table extends
|
7 |
protected $widths;
|
8 |
protected $aligns;
|
9 |
|
@@ -34,6 +34,7 @@ class WOE_PDF_MC_Table extends FPDF {
|
|
34 |
'table' => array(
|
35 |
'stretch' => false,
|
36 |
'column_width' => array(),
|
|
|
37 |
),
|
38 |
'table_header' => array(
|
39 |
'style' => '',
|
@@ -198,8 +199,16 @@ class WOE_PDF_MC_Table extends FPDF {
|
|
198 |
$y = $this->GetY();
|
199 |
//Draw the border
|
200 |
$this->Rect( $x, $y, $w, $h, 'DF' );
|
201 |
-
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
//Put the position to the right of the cell
|
204 |
$this->SetXY( $x + $w, $y );
|
205 |
}
|
@@ -242,10 +251,17 @@ class WOE_PDF_MC_Table extends FPDF {
|
|
242 |
$widths[ $i ] = $this->validateWidth( $width );
|
243 |
}
|
244 |
|
245 |
-
return $widths;
|
246 |
} else {
|
247 |
-
|
248 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
}
|
250 |
|
251 |
protected function validateWidth( $width, $min_width = 5 ) {
|
@@ -281,7 +297,9 @@ class WOE_PDF_MC_Table extends FPDF {
|
|
281 |
protected function getRowHeight( $widths, $row ) {
|
282 |
$nb = 0;
|
283 |
for ( $i = 0; $i < count( $row ); $i ++ ) {
|
284 |
-
|
|
|
|
|
285 |
}
|
286 |
|
287 |
return 5 * $nb;
|
1 |
<?php
|
2 |
+
if ( ! class_exists( 'WOE_FPDF' ) ) {
|
3 |
+
require( 'class-woe-fpdf.php' );
|
4 |
}
|
5 |
|
6 |
+
class WOE_PDF_MC_Table extends WOE_FPDF {
|
7 |
protected $widths;
|
8 |
protected $aligns;
|
9 |
|
34 |
'table' => array(
|
35 |
'stretch' => false,
|
36 |
'column_width' => array(),
|
37 |
+
'solid_width' => array(),
|
38 |
),
|
39 |
'table_header' => array(
|
40 |
'style' => '',
|
199 |
$y = $this->GetY();
|
200 |
//Draw the border
|
201 |
$this->Rect( $x, $y, $w, $h, 'DF' );
|
202 |
+
|
203 |
+
if ( isset( $data[ $i ]['type'], $data[ $i ]['value'] ) && 'image' === $data[ $i ]['type'] && file_exists( $data[ $i ]['value'] ) ) {
|
204 |
+
$source = $data[ $i ]['value'];
|
205 |
+
$type = strtoupper( pathinfo( $source, PATHINFO_EXTENSION ) );
|
206 |
+
$this->Image( $source, $x + 1 / 2, $y + 1 / 2, $w - 1, $h - 1, $type );
|
207 |
+
} elseif ( ! is_array( $data[ $i ] ) ) {
|
208 |
+
//Print the text
|
209 |
+
$this->MultiCell( $w, 5, $data[ $i ], 0, $a );
|
210 |
+
}
|
211 |
+
|
212 |
//Put the position to the right of the cell
|
213 |
$this->SetXY( $x + $w, $y );
|
214 |
}
|
251 |
$widths[ $i ] = $this->validateWidth( $width );
|
252 |
}
|
253 |
|
|
|
254 |
} else {
|
255 |
+
$widths = array_fill( 0, count( $row ), ( $this->GetPageWidth() - $this->lMargin - $this->rMargin ) / count( $row ) );
|
256 |
}
|
257 |
+
|
258 |
+
if ( $this->table_props['solid_width'] ) {
|
259 |
+
foreach ( $this->table_props['solid_width'] as $position => $width ) {
|
260 |
+
$widths[ $position ] = $this->validateWidth( $width );
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
return $widths;
|
265 |
}
|
266 |
|
267 |
protected function validateWidth( $width, $min_width = 5 ) {
|
297 |
protected function getRowHeight( $widths, $row ) {
|
298 |
$nb = 0;
|
299 |
for ( $i = 0; $i < count( $row ); $i ++ ) {
|
300 |
+
// do not calculate height for non string values
|
301 |
+
$value = is_string( $row[ $i ] ) ? $row[ $i ] : 0;
|
302 |
+
$nb = max( $nb, $this->NbLines( $widths[ $i ], $value ) );
|
303 |
}
|
304 |
|
305 |
return 5 * $nb;
|
classes/PHPExcel/Shared/OLE.php
CHANGED
@@ -285,7 +285,7 @@ class PHPExcel_Shared_OLE
|
|
285 |
$pps = new PHPExcel_Shared_OLE_PPS_File($name);
|
286 |
break;
|
287 |
default:
|
288 |
-
continue;
|
289 |
}
|
290 |
fseek($fh, 1, SEEK_CUR);
|
291 |
$pps->Type = $type;
|
285 |
$pps = new PHPExcel_Shared_OLE_PPS_File($name);
|
286 |
break;
|
287 |
default:
|
288 |
+
continue 2;
|
289 |
}
|
290 |
fseek($fh, 1, SEEK_CUR);
|
291 |
$pps->Type = $type;
|
classes/admin/class-wc-order-export-ajax.php
DELETED
@@ -1,422 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
-
exit; // Exit if accessed directly
|
4 |
-
}
|
5 |
-
|
6 |
-
class WC_Order_Export_Ajax {
|
7 |
-
var $tempfile_prefix = 'woocommerce-order-file-';
|
8 |
-
|
9 |
-
var $_wp_using_ext_object_cache_previous;
|
10 |
-
|
11 |
-
public function save_settings() {
|
12 |
-
|
13 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
14 |
-
/*
|
15 |
-
array_walk_recursive($settings, function(&$_value, $_key) {
|
16 |
-
if ($_key !== 'custom_php_code' AND $_key !== 'email_body') {
|
17 |
-
$_value = esc_attr($_value);
|
18 |
-
}
|
19 |
-
});
|
20 |
-
*/
|
21 |
-
$id = WC_Order_Export_Manage::save_export_settings( $_POST['mode'], (int)$_POST['id'], $settings );
|
22 |
-
echo json_encode( array( 'id' => $id ) );
|
23 |
-
}
|
24 |
-
|
25 |
-
public function reset_profile() {
|
26 |
-
$id = WC_Order_Export_Manage::save_export_settings( $_POST['mode'], $_POST['id'], array() );
|
27 |
-
wp_send_json_success();
|
28 |
-
}
|
29 |
-
|
30 |
-
public function validate_url_key() {
|
31 |
-
$main_settings = WC_Order_Export_Admin::load_main_settings();
|
32 |
-
if ( ! isset( $_REQUEST['key'] ) OR $_REQUEST['key'] != $main_settings['cron_key'] ) {
|
33 |
-
_e( 'Wrong key for cron url!', 'woo-order-export-lite' );
|
34 |
-
die();
|
35 |
-
}
|
36 |
-
}
|
37 |
-
|
38 |
-
//called from UI
|
39 |
-
public function run_one_job() {
|
40 |
-
if ( ! empty( $_REQUEST['schedule'] ) ) {
|
41 |
-
$settings = WC_Order_Export_Manage::get( WC_Order_Export_Manage::EXPORT_SCHEDULE, $_REQUEST['schedule'] );
|
42 |
-
} elseif ( $_REQUEST['profile'] == 'now' ) {
|
43 |
-
$settings = WC_Order_Export_Manage::get( WC_Order_Export_Manage::EXPORT_NOW );
|
44 |
-
} else {
|
45 |
-
$settings = WC_Order_Export_Manage::get( WC_Order_Export_Manage::EXPORT_PROFILE, $_REQUEST['profile'] );
|
46 |
-
}
|
47 |
-
$filename = WC_Order_Export_Engine::build_file_full( $settings );
|
48 |
-
WC_Order_Export_Manage::set_correct_file_ext( $settings );
|
49 |
-
$this->send_headers( $settings['format'],
|
50 |
-
WC_Order_Export_Engine::make_filename( $settings['export_filename'] ) );
|
51 |
-
$this->send_contents_delete_file( $filename );
|
52 |
-
}
|
53 |
-
|
54 |
-
public function run_one_scheduled_job() {
|
55 |
-
WC_Order_Export_Cron::run_one_scheduled_job();
|
56 |
-
}
|
57 |
-
|
58 |
-
public function run_cron_jobs() {
|
59 |
-
WC_Order_Export_Cron::wc_export_cron_global_f();
|
60 |
-
}
|
61 |
-
|
62 |
-
public function save_tools() {
|
63 |
-
$data = json_decode( $_POST['tools-import'], true );
|
64 |
-
if ( $data ) {
|
65 |
-
WC_Order_Export_Manage::import_settings( $data );
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
public function save_settings_tab() {
|
70 |
-
WC_Order_Export_Admin::save_main_settings();
|
71 |
-
}
|
72 |
-
|
73 |
-
public function get_products() {
|
74 |
-
$main_settings = WC_Order_Export_Admin::load_main_settings();
|
75 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_products_like( $_REQUEST['q'],
|
76 |
-
$main_settings['autocomplete_products_max'] ) );
|
77 |
-
}
|
78 |
-
|
79 |
-
public function get_users() {
|
80 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_users_like( $_REQUEST['q'] ) );
|
81 |
-
}
|
82 |
-
|
83 |
-
public function get_coupons() {
|
84 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_coupons_like( $_REQUEST['q'] ) );
|
85 |
-
}
|
86 |
-
|
87 |
-
public function get_used_custom_order_meta() {
|
88 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
89 |
-
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
90 |
-
$ret = WC_Order_Export_Data_Extractor_UI::get_all_order_custom_meta_fields( $sql );
|
91 |
-
echo json_encode( $ret );
|
92 |
-
}
|
93 |
-
|
94 |
-
public function get_used_custom_products_meta() {
|
95 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
96 |
-
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
97 |
-
$ret = WC_Order_Export_Data_Extractor_UI::get_product_custom_meta_fields_for_orders( $sql );
|
98 |
-
sort( $ret );
|
99 |
-
echo json_encode( $ret );
|
100 |
-
}
|
101 |
-
|
102 |
-
public function get_used_custom_order_items_meta() {
|
103 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
104 |
-
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
105 |
-
$ret = WC_Order_Export_Data_Extractor_UI::get_order_item_custom_meta_fields_for_orders( $sql );
|
106 |
-
sort( $ret );
|
107 |
-
echo json_encode( $ret );
|
108 |
-
}
|
109 |
-
|
110 |
-
public function get_used_custom_coupons_meta() {
|
111 |
-
$ret = array();
|
112 |
-
echo json_encode( $ret );
|
113 |
-
}
|
114 |
-
|
115 |
-
public function get_categories() {
|
116 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_categories_like( $_REQUEST['q'] ) );
|
117 |
-
}
|
118 |
-
|
119 |
-
public function get_vendors() {
|
120 |
-
$this->get_users();
|
121 |
-
}
|
122 |
-
|
123 |
-
public function test_destination() {
|
124 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
125 |
-
|
126 |
-
unset( $settings['destination']['type'] );
|
127 |
-
$settings['destination']['type'][] = $_POST['destination'];
|
128 |
-
|
129 |
-
// use unsaved settings
|
130 |
-
|
131 |
-
do_action( 'woe_start_test_job', $_POST['id'], $settings );
|
132 |
-
|
133 |
-
$main_settings = WC_Order_Export_Admin::load_main_settings();
|
134 |
-
|
135 |
-
$result = WC_Order_Export_Engine::build_files_and_export( $settings, '', $main_settings['limit_button_test'] );
|
136 |
-
echo str_replace( "<br>", "\r\n", $result );
|
137 |
-
}
|
138 |
-
|
139 |
-
public function preview() {
|
140 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
141 |
-
// use unsaved settings
|
142 |
-
|
143 |
-
do_action( 'woe_start_preview_job', $_POST['id'], $settings );
|
144 |
-
|
145 |
-
WC_Order_Export_Engine::build_file( $settings, 'preview', 'browser', 0, $_POST['limit'] );
|
146 |
-
}
|
147 |
-
|
148 |
-
public function estimate() {
|
149 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
150 |
-
// use unsaved settings
|
151 |
-
|
152 |
-
$total = WC_Order_Export_Engine::build_file( $settings, 'estimate', 'file', 0, 0, 'test' );
|
153 |
-
|
154 |
-
echo json_encode( array( 'total' => $total ) );
|
155 |
-
}
|
156 |
-
|
157 |
-
public function get_order_custom_fields_values() {
|
158 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_custom_fields_values( $_POST['cf_name'] ) );
|
159 |
-
}
|
160 |
-
|
161 |
-
public function get_user_custom_fields_values() {
|
162 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_user_custom_fields_values( $_POST['cf_name'] ) );
|
163 |
-
}
|
164 |
-
|
165 |
-
public function get_product_custom_fields_values() {
|
166 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_product_custom_fields_values( $_POST['cf_name'] ) );
|
167 |
-
}
|
168 |
-
|
169 |
-
public function get_products_taxonomies_values() {
|
170 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_products_taxonomies_values( $_POST['tax'] ) );
|
171 |
-
}
|
172 |
-
|
173 |
-
public function get_products_attributes_values() {
|
174 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_products_attributes_values( $_POST['attr'] ) );
|
175 |
-
}
|
176 |
-
|
177 |
-
public function get_products_itemmeta_values() {
|
178 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_products_itemmeta_values( $_POST['item'] ) );
|
179 |
-
}
|
180 |
-
|
181 |
-
public function get_order_shipping_values() {
|
182 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_meta_values( '_shipping_', $_POST['item'] ) );
|
183 |
-
}
|
184 |
-
|
185 |
-
public function get_order_billing_values() {
|
186 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_meta_values( '_billing_', $_POST['item'] ) );
|
187 |
-
}
|
188 |
-
|
189 |
-
public function get_order_item_names() {
|
190 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_item_names( $_POST['item_type'] ) );
|
191 |
-
}
|
192 |
-
|
193 |
-
public function get_order_item_meta_key_values() {
|
194 |
-
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_item_meta_key_values( $_POST['meta_key'] ) );
|
195 |
-
}
|
196 |
-
|
197 |
-
|
198 |
-
public function send_headers( $format, $download_name = '' ) {
|
199 |
-
WC_Order_Export_Engine::kill_buffers();
|
200 |
-
switch ( $format ) {
|
201 |
-
case 'XLSX':
|
202 |
-
if ( empty( $download_name ) ) {
|
203 |
-
$download_name = "orders.xlsx";
|
204 |
-
}
|
205 |
-
header( 'Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
|
206 |
-
break;
|
207 |
-
case 'XLS':
|
208 |
-
if ( empty( $download_name ) ) {
|
209 |
-
$download_name = "orders.xls";
|
210 |
-
}
|
211 |
-
header( 'Content-type: application/vnd.ms-excel; charset=utf-8' );
|
212 |
-
break;
|
213 |
-
case 'CSV':
|
214 |
-
if ( empty( $download_name ) ) {
|
215 |
-
$download_name = "orders.csv";
|
216 |
-
}
|
217 |
-
header( 'Content-type: text/csv' );
|
218 |
-
break;
|
219 |
-
case 'TSV':
|
220 |
-
if ( empty( $download_name ) ) {
|
221 |
-
$download_name = "orders.tsv";
|
222 |
-
}
|
223 |
-
header( 'Content-type: text/csv' );
|
224 |
-
break;
|
225 |
-
case 'JSON':
|
226 |
-
if ( empty( $download_name ) ) {
|
227 |
-
$download_name = "orders.json";
|
228 |
-
}
|
229 |
-
header( 'Content-type: application/json' );
|
230 |
-
break;
|
231 |
-
case 'XML':
|
232 |
-
if ( empty( $download_name ) ) {
|
233 |
-
$download_name = "orders.xml";
|
234 |
-
}
|
235 |
-
header( 'Content-type: text/xml' );
|
236 |
-
break;
|
237 |
-
}
|
238 |
-
header( 'Content-Disposition: attachment; filename="' . $download_name . '"' );
|
239 |
-
}
|
240 |
-
|
241 |
-
public function start_prevent_object_cache() {
|
242 |
-
global $_wp_using_ext_object_cache;
|
243 |
-
|
244 |
-
$this->_wp_using_ext_object_cache_previous = $_wp_using_ext_object_cache;
|
245 |
-
$_wp_using_ext_object_cache = false;
|
246 |
-
}
|
247 |
-
|
248 |
-
public function stop_prevent_object_cache() {
|
249 |
-
global $_wp_using_ext_object_cache;
|
250 |
-
|
251 |
-
$_wp_using_ext_object_cache = $this->_wp_using_ext_object_cache_previous;
|
252 |
-
}
|
253 |
-
|
254 |
-
public function export_start() {
|
255 |
-
$this->start_prevent_object_cache();
|
256 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
257 |
-
|
258 |
-
$filename = WC_Order_Export_Engine::tempnam( sys_get_temp_dir(), "orders" );
|
259 |
-
if ( ! $filename ) {
|
260 |
-
die( __( 'Can\'t create temporary file', 'woo-order-export-lite' ) );
|
261 |
-
}
|
262 |
-
|
263 |
-
//no free space or other file system errors?
|
264 |
-
try {
|
265 |
-
file_put_contents( $filename, '' );
|
266 |
-
do_action( 'woe_start_export_job', $_POST['id'], $settings );
|
267 |
-
$total = WC_Order_Export_Engine::build_file( $settings, 'start_estimate', 'file', 0, 0, $filename );
|
268 |
-
} catch ( Exception $e ) {
|
269 |
-
die( $e->getMessage() );
|
270 |
-
}
|
271 |
-
// file created
|
272 |
-
$file_id = current_time( 'timestamp' );
|
273 |
-
set_transient( $this->tempfile_prefix . $file_id, $filename, 60 );
|
274 |
-
$this->stop_prevent_object_cache();
|
275 |
-
echo json_encode( array( 'total' => $total, 'file_id' => $file_id ) );
|
276 |
-
}
|
277 |
-
|
278 |
-
private function get_temp_file_name() {
|
279 |
-
$this->start_prevent_object_cache();
|
280 |
-
$filename = get_transient( $this->tempfile_prefix . $_REQUEST['file_id'] );
|
281 |
-
if ( $filename === false ) {
|
282 |
-
echo json_encode( array( 'error' => __( 'Can\'t find exported file', 'woo-order-export-lite' ) ) );
|
283 |
-
die();
|
284 |
-
}
|
285 |
-
set_transient( $this->tempfile_prefix . $_REQUEST['file_id'], $filename, 60 );
|
286 |
-
$this->stop_prevent_object_cache();
|
287 |
-
|
288 |
-
return $filename;
|
289 |
-
}
|
290 |
-
|
291 |
-
private function delete_temp_file() {
|
292 |
-
$this->start_prevent_object_cache();
|
293 |
-
$filename = get_transient( $this->tempfile_prefix . $_REQUEST['file_id'] );
|
294 |
-
if ( $filename !== false ) {
|
295 |
-
delete_transient( $this->tempfile_prefix . $_REQUEST['file_id'] );
|
296 |
-
unlink( $filename );
|
297 |
-
}
|
298 |
-
$this->stop_prevent_object_cache();
|
299 |
-
}
|
300 |
-
|
301 |
-
public function cancel_export() {
|
302 |
-
$this->delete_temp_file();
|
303 |
-
|
304 |
-
echo json_encode( array() );
|
305 |
-
}
|
306 |
-
|
307 |
-
public function export_part() {
|
308 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
309 |
-
$main_settings = WC_Order_Export_Admin::load_main_settings();
|
310 |
-
|
311 |
-
WC_Order_Export_Engine::build_file( $settings, 'partial', 'file', intval( $_POST['start'] ),
|
312 |
-
$main_settings['ajax_orders_per_step'],
|
313 |
-
$this->get_temp_file_name() );
|
314 |
-
echo json_encode( array( 'start' => $_POST['start'] + $main_settings['ajax_orders_per_step'] ) );
|
315 |
-
}
|
316 |
-
|
317 |
-
public function export_finish() {
|
318 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
319 |
-
WC_Order_Export_Engine::build_file( $settings, 'finish', 'file', 0, 0, $this->get_temp_file_name() );
|
320 |
-
|
321 |
-
$filename = WC_Order_Export_Engine::make_filename( $settings['export_filename'] );
|
322 |
-
$this->start_prevent_object_cache();
|
323 |
-
set_transient( $this->tempfile_prefix . 'download_filename', $filename, 60 );
|
324 |
-
$this->stop_prevent_object_cache();
|
325 |
-
echo json_encode( array( 'done' => true ) );
|
326 |
-
}
|
327 |
-
|
328 |
-
public function export_download() {
|
329 |
-
$this->start_prevent_object_cache();
|
330 |
-
$format = basename( $_GET['format'] );
|
331 |
-
$filename = $this->get_temp_file_name();
|
332 |
-
delete_transient( $this->tempfile_prefix . $_GET['file_id'] );
|
333 |
-
|
334 |
-
$download_name = get_transient( $this->tempfile_prefix . 'download_filename' );
|
335 |
-
$this->send_headers( $format, $download_name );
|
336 |
-
$this->send_contents_delete_file( $filename );
|
337 |
-
$this->stop_prevent_object_cache();
|
338 |
-
}
|
339 |
-
|
340 |
-
public function plain_export() {
|
341 |
-
// use unsaved settings
|
342 |
-
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
343 |
-
do_action( 'woe_start_export_job', $_POST['id'], $settings );
|
344 |
-
|
345 |
-
// custom export worked for plain
|
346 |
-
if ( apply_filters( 'woe_plain_export_custom_func', false, $_POST['id'], $settings ) ) {
|
347 |
-
return;
|
348 |
-
}
|
349 |
-
|
350 |
-
$file = WC_Order_Export_Engine::build_file_full( $settings );
|
351 |
-
|
352 |
-
if ( $file !== false ) {
|
353 |
-
$file_id = current_time( 'timestamp' );
|
354 |
-
$this->start_prevent_object_cache();
|
355 |
-
set_transient( $this->tempfile_prefix . $file_id, $file, 600 );
|
356 |
-
$this->stop_prevent_object_cache();
|
357 |
-
|
358 |
-
WC_Order_Export_Manage::set_correct_file_ext( $settings );
|
359 |
-
|
360 |
-
$_GET['format'] = $settings['format'];
|
361 |
-
$_GET['file_id'] = $_REQUEST['file_id'] = $file_id;
|
362 |
-
|
363 |
-
$filename = WC_Order_Export_Engine::make_filename( $settings['export_filename'] );
|
364 |
-
$this->start_prevent_object_cache();
|
365 |
-
set_transient( $this->tempfile_prefix . 'download_filename', $filename, 60 );
|
366 |
-
$this->stop_prevent_object_cache();
|
367 |
-
|
368 |
-
$this->export_download();
|
369 |
-
} else {
|
370 |
-
_e( 'Nothing to export. Please, adjust your filters', 'woo-order-export-lite' );
|
371 |
-
}
|
372 |
-
}
|
373 |
-
|
374 |
-
function export_download_bulk_file() {
|
375 |
-
if ( $_REQUEST['export_bulk_profile'] == 'now' ) {
|
376 |
-
$settings = WC_Order_Export_Manage::get( WC_Order_Export_Manage::EXPORT_NOW );
|
377 |
-
} else {
|
378 |
-
$settings = WC_Order_Export_Manage::get( WC_Order_Export_Manage::EXPORT_PROFILE,
|
379 |
-
$_REQUEST['export_bulk_profile'] );
|
380 |
-
}
|
381 |
-
$filename = WC_Order_Export_Engine::build_file_full( $settings, '', 0, explode( ",", $_REQUEST['ids'] ) );
|
382 |
-
WC_Order_Export_Manage::set_correct_file_ext( $settings );
|
383 |
-
$this->send_headers( $settings['format'],
|
384 |
-
WC_Order_Export_Engine::make_filename( $settings['export_filename'] ) );
|
385 |
-
$this->send_contents_delete_file( $filename );
|
386 |
-
}
|
387 |
-
|
388 |
-
private function send_contents_delete_file( $filename ) {
|
389 |
-
if ( ! empty( $filename ) ) {
|
390 |
-
readfile( $filename );
|
391 |
-
unlink( $filename );
|
392 |
-
}
|
393 |
-
}
|
394 |
-
|
395 |
-
public function reorder_jobs() {
|
396 |
-
if ( ! empty( $_REQUEST['new_jobs_order'] ) AND ! empty( $_REQUEST['tab_name'] ) ) {
|
397 |
-
|
398 |
-
if ( $_REQUEST['tab_name'] == 'schedule' ) {
|
399 |
-
$mode = WC_Order_Export_Manage::EXPORT_SCHEDULE;
|
400 |
-
} elseif ( $_REQUEST['tab_name'] == 'profile' ) {
|
401 |
-
$mode = WC_Order_Export_Manage::EXPORT_PROFILE;
|
402 |
-
} elseif ( $_REQUEST['tab_name'] == 'order_action' ) {
|
403 |
-
$mode = WC_Order_Export_Manage::EXPORT_ORDER_ACTION;
|
404 |
-
} else {
|
405 |
-
echo json_encode( array( 'result' => false ) );
|
406 |
-
die();
|
407 |
-
}
|
408 |
-
|
409 |
-
//skip zero ids
|
410 |
-
foreach ( array_filter( $_REQUEST['new_jobs_order'] ) as $index => $job_id ) {
|
411 |
-
$job = WC_Order_Export_Manage::get( $mode, $job_id );
|
412 |
-
$job['priority'] = $index + 1;
|
413 |
-
WC_Order_Export_Manage::save_export_settings( $mode, $job_id, $job );
|
414 |
-
}
|
415 |
-
echo json_encode( array( 'result' => true ) );
|
416 |
-
} else {
|
417 |
-
echo json_encode( array( 'result' => false ) );
|
418 |
-
}
|
419 |
-
}
|
420 |
-
}
|
421 |
-
|
422 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/admin/class-wc-order-export-manage.php
CHANGED
@@ -43,19 +43,6 @@ class WC_Order_Export_Manage {
|
|
43 |
return $name;
|
44 |
}
|
45 |
|
46 |
-
static function remove_settings() {
|
47 |
-
$options = array(
|
48 |
-
self::settings_name_now,
|
49 |
-
self::settings_name_cron,
|
50 |
-
self::settings_name_profiles,
|
51 |
-
self::settings_name_actions,
|
52 |
-
);
|
53 |
-
|
54 |
-
foreach ( $options as $option ) {
|
55 |
-
delete_option( $option );
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
// arrays
|
60 |
static function get_export_settings_collection( $mode ) {
|
61 |
$name = self::get_settings_name_for_mode( $mode );
|
@@ -64,9 +51,9 @@ class WC_Order_Export_Manage {
|
|
64 |
}
|
65 |
|
66 |
static function save_export_settings_collection( $mode, $jobs ) {
|
67 |
-
$name
|
68 |
$result = update_option( $name, $jobs, false );
|
69 |
-
|
70 |
if ( $mode == self::EXPORT_SCHEDULE ) {
|
71 |
WC_Order_Export_Cron::try_install_job( true ); // must delete existing job!
|
72 |
}
|
@@ -122,7 +109,7 @@ class WC_Order_Export_Manage {
|
|
122 |
}
|
123 |
|
124 |
$settings = self::get( $in['mode'], $in['id'] );
|
125 |
-
$settings['id'] = (int)$in['id'];
|
126 |
$settings['duplicated_fields_settings'] = isset( $in['duplicated_fields_settings'] ) ? $in['duplicated_fields_settings'] : array();
|
127 |
|
128 |
// setup new values for same keys
|
@@ -191,7 +178,7 @@ class WC_Order_Export_Manage {
|
|
191 |
'from_status' => array(),
|
192 |
'to_status' => array(),
|
193 |
'change_order_status_to' => '',
|
194 |
-
'statuses' => array(),
|
195 |
'from_date' => '',
|
196 |
'to_date' => '',
|
197 |
'shipping_locations' => array(),
|
@@ -220,6 +207,8 @@ class WC_Order_Export_Manage {
|
|
220 |
'format_xls_auto_width' => 1,
|
221 |
'format_xls_direction_rtl' => 0,
|
222 |
'format_xls_force_general_format' => 0,
|
|
|
|
|
223 |
'format_csv_enclosure' => '"',
|
224 |
'format_csv_delimiter' => ',',
|
225 |
'format_csv_linebreak' => '\r\n',
|
@@ -257,31 +246,48 @@ class WC_Order_Export_Manage {
|
|
257 |
'format_pdf_table_header_background_color' => '#FFFFFF',
|
258 |
'format_pdf_table_row_text_color' => '#000000',
|
259 |
'format_pdf_table_row_background_color' => '#FFFFFF',
|
|
|
260 |
'format_pdf_logo_source' => '',
|
261 |
'format_pdf_logo_width' => 0,
|
262 |
'format_pdf_logo_height' => 15,
|
263 |
'format_pdf_logo_align' => 'R',
|
264 |
-
|
265 |
-
'
|
266 |
-
|
267 |
-
'
|
268 |
-
'
|
269 |
-
'
|
270 |
-
'
|
271 |
-
'
|
272 |
-
'
|
273 |
-
'
|
274 |
-
'
|
275 |
-
'
|
276 |
-
'
|
277 |
-
'
|
278 |
-
'
|
279 |
-
'
|
280 |
-
|
281 |
-
'
|
282 |
-
'
|
283 |
-
'
|
284 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
|
286 |
'summary_report_by_products' => 0,
|
287 |
'duplicated_fields_settings' => array(
|
@@ -408,41 +414,6 @@ class WC_Order_Export_Manage {
|
|
408 |
}, array_keys( $fields ), $fields );
|
409 |
}
|
410 |
|
411 |
-
static function merge_settings_and_default_new( &$opt, $defaults ) {
|
412 |
-
|
413 |
-
$opt = self::move_fields_key( $opt );
|
414 |
-
$defaults = self::move_fields_key( $defaults );
|
415 |
-
|
416 |
-
|
417 |
-
foreach ( $defaults as $v ) {
|
418 |
-
$exists = false;
|
419 |
-
foreach ( $opt as $num_index => $option ) {
|
420 |
-
if ( $v['key'] == $option['key'] ) {
|
421 |
-
//set default attribute OR add to option
|
422 |
-
if ( isset( $v['default'] ) ) {
|
423 |
-
$option['default'] = $v['default'];
|
424 |
-
}
|
425 |
-
//set default format OR add to option
|
426 |
-
if ( isset( $v['format'] ) ) {
|
427 |
-
$option['format'] = $v['format'];
|
428 |
-
}
|
429 |
-
// overwrite labels for localization
|
430 |
-
$option['label'] = $v['label'];
|
431 |
-
|
432 |
-
$exists = true;
|
433 |
-
break;
|
434 |
-
}
|
435 |
-
};
|
436 |
-
|
437 |
-
if ( ! $exists ) {
|
438 |
-
if ( self::$edit_existing_job AND $v['checked'] == "1" ) {
|
439 |
-
$v['checked'] = "0";
|
440 |
-
}
|
441 |
-
$opt[] = $v;
|
442 |
-
}
|
443 |
-
};
|
444 |
-
}
|
445 |
-
|
446 |
public static function make_all_fields( $format ) {
|
447 |
$order_fields = array();
|
448 |
foreach ( array_keys( WC_Order_Export_Data_Extractor_UI::get_order_segments() ) as $segment ) {
|
@@ -483,54 +454,21 @@ class WC_Order_Export_Manage {
|
|
483 |
return $order_fields;
|
484 |
}
|
485 |
|
486 |
-
private static function process_fields( $fields ) {
|
487 |
-
|
488 |
-
return array_map( function ( $key, $value ) {
|
489 |
-
if ( ! key_exists( 'key', $value ) ) {
|
490 |
-
$value['key'] = $key;
|
491 |
-
}
|
492 |
-
|
493 |
-
return $value;
|
494 |
-
}, array_keys( $fields ), $fields );
|
495 |
-
}
|
496 |
-
|
497 |
-
static function merge_settings_and_default( &$opt, $defaults ) {
|
498 |
-
foreach ( $defaults as $k => $v ) {
|
499 |
-
if ( isset( $opt[ $k ] ) ) {
|
500 |
-
//set default attribute OR add to option
|
501 |
-
if ( isset( $v['default'] ) ) {
|
502 |
-
$opt[ $k ]['default'] = $v['default'];
|
503 |
-
}
|
504 |
-
//set default format OR add to option
|
505 |
-
if ( isset( $v['format'] ) ) {
|
506 |
-
$opt[ $k ]['format'] = $v['format'];
|
507 |
-
}
|
508 |
-
// overwrite labels for localization
|
509 |
-
$opt[ $k ]['label'] = $v['label'];
|
510 |
-
} else {
|
511 |
-
if ( self::$edit_existing_job AND $v['checked'] == "1" ) {
|
512 |
-
$v['checked'] = "0";
|
513 |
-
}
|
514 |
-
$opt[ $k ] = $v;
|
515 |
-
}
|
516 |
-
}
|
517 |
-
}
|
518 |
-
|
519 |
static function save_export_settings( $mode, $id, $options ) {
|
520 |
$all_jobs = self::get_export_settings_collection( $mode );
|
521 |
if ( $mode == self::EXPORT_NOW ) {
|
522 |
$all_jobs = $options;// just replace
|
523 |
} elseif ( $mode == self::EXPORT_SCHEDULE ) {
|
524 |
if ( $id ) {
|
525 |
-
$options['schedule']['last_run']
|
526 |
$options['schedule']['last_report_sent'] = isset( $all_jobs[ $id ] ) ? $all_jobs[ $id ]['schedule']['last_report_sent'] : current_time( "timestamp", 0 );
|
527 |
-
$options['schedule']['next_run']
|
528 |
-
$all_jobs[ $id ]
|
529 |
} else {
|
530 |
-
$options['schedule']['last_run']
|
531 |
$options['schedule']['last_report_sent'] = current_time( "timestamp", 0 );
|
532 |
-
$options['schedule']['next_run']
|
533 |
-
$all_jobs[]
|
534 |
end( $all_jobs );
|
535 |
$id = key( $all_jobs );
|
536 |
}
|
@@ -549,64 +487,6 @@ class WC_Order_Export_Manage {
|
|
549 |
return $id;
|
550 |
}
|
551 |
|
552 |
-
static function clone_export_settings( $mode, $id ) {
|
553 |
-
return self::advanced_clone_export_settings( $id, $mode, $mode );
|
554 |
-
}
|
555 |
-
|
556 |
-
static function advanced_clone_export_settings(
|
557 |
-
$id,
|
558 |
-
$mode_in = self::EXPORT_SCHEDULE,
|
559 |
-
$mode_out = self::EXPORT_SCHEDULE
|
560 |
-
) {
|
561 |
-
$all_jobs_in = self::get_export_settings_collection( $mode_in );
|
562 |
-
//new settings
|
563 |
-
$settings = $all_jobs_in[ $id ];
|
564 |
-
$settings['mode'] = $mode_out;
|
565 |
-
|
566 |
-
if ( $mode_in !== $mode_out ) {
|
567 |
-
$all_jobs_out = self::get_export_settings_collection( $mode_out );
|
568 |
-
} else {
|
569 |
-
$mode_out = $mode_in;
|
570 |
-
$all_jobs_out = $all_jobs_in;
|
571 |
-
$settings['title'] .= " [cloned]"; //add note
|
572 |
-
}
|
573 |
-
|
574 |
-
if ( $mode_in === self::EXPORT_PROFILE && $mode_out === self::EXPORT_SCHEDULE ) {
|
575 |
-
if ( ! isset( $settings['destination'] ) ) {
|
576 |
-
$settings['destination'] = array(
|
577 |
-
'type' => 'folder',
|
578 |
-
'path' => get_home_path(),
|
579 |
-
);
|
580 |
-
}
|
581 |
-
|
582 |
-
if ( ! isset( $settings['export_rule'] ) ) {
|
583 |
-
$settings['export_rule'] = 'last_run';
|
584 |
-
}
|
585 |
-
|
586 |
-
if ( ! isset( $settings['export_rule_field'] ) ) {
|
587 |
-
$settings['export_rule_field'] = 'modified';
|
588 |
-
}
|
589 |
-
|
590 |
-
if ( ! isset( $settings['schedule'] ) ) {
|
591 |
-
$settings['schedule'] = array(
|
592 |
-
'type' => 'schedule-1',
|
593 |
-
'run_at' => '00:00',
|
594 |
-
);
|
595 |
-
}
|
596 |
-
|
597 |
-
unset( $settings['use_as_bulk'] );
|
598 |
-
}
|
599 |
-
|
600 |
-
end( $all_jobs_out );
|
601 |
-
$next_id = key( $all_jobs_out ) + 1;
|
602 |
-
$all_jobs_out[ $next_id ] = $settings;
|
603 |
-
|
604 |
-
self::save_export_settings_collection( $mode_out, $all_jobs_out );
|
605 |
-
|
606 |
-
return $next_id;
|
607 |
-
}
|
608 |
-
|
609 |
-
|
610 |
static function set_correct_file_ext( &$settings ) {
|
611 |
if ( $settings['format'] == 'XLS' AND ! $settings['format_xls_use_xls_format'] ) {
|
612 |
$settings['format'] = 'XLSX';
|
@@ -862,6 +742,7 @@ class WC_Order_Export_Manage {
|
|
862 |
$settings['order_coupon_fields'] = $is_flat_format ? array() : $order_coupon_fields;
|
863 |
|
864 |
unset( $duplicated_fields_settings, $order_coupon_fields, $order_product_fields, $order_fields );
|
|
|
865 |
return $settings;
|
866 |
}
|
867 |
|
43 |
return $name;
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
// arrays
|
47 |
static function get_export_settings_collection( $mode ) {
|
48 |
$name = self::get_settings_name_for_mode( $mode );
|
51 |
}
|
52 |
|
53 |
static function save_export_settings_collection( $mode, $jobs ) {
|
54 |
+
$name = self::get_settings_name_for_mode( $mode );
|
55 |
$result = update_option( $name, $jobs, false );
|
56 |
+
|
57 |
if ( $mode == self::EXPORT_SCHEDULE ) {
|
58 |
WC_Order_Export_Cron::try_install_job( true ); // must delete existing job!
|
59 |
}
|
109 |
}
|
110 |
|
111 |
$settings = self::get( $in['mode'], $in['id'] );
|
112 |
+
$settings['id'] = (int) $in['id'];
|
113 |
$settings['duplicated_fields_settings'] = isset( $in['duplicated_fields_settings'] ) ? $in['duplicated_fields_settings'] : array();
|
114 |
|
115 |
// setup new values for same keys
|
178 |
'from_status' => array(),
|
179 |
'to_status' => array(),
|
180 |
'change_order_status_to' => '',
|
181 |
+
'statuses' => ($mode == "now" OR $mode == "profiles") ? array("wc-pending","wc-processing","wc-on-hold","wc-completed") : array(),
|
182 |
'from_date' => '',
|
183 |
'to_date' => '',
|
184 |
'shipping_locations' => array(),
|
207 |
'format_xls_auto_width' => 1,
|
208 |
'format_xls_direction_rtl' => 0,
|
209 |
'format_xls_force_general_format' => 0,
|
210 |
+
'format_xls_row_images_width' => 50,
|
211 |
+
'format_xls_row_images_height' => 50,
|
212 |
'format_csv_enclosure' => '"',
|
213 |
'format_csv_delimiter' => ',',
|
214 |
'format_csv_linebreak' => '\r\n',
|
246 |
'format_pdf_table_header_background_color' => '#FFFFFF',
|
247 |
'format_pdf_table_row_text_color' => '#000000',
|
248 |
'format_pdf_table_row_background_color' => '#FFFFFF',
|
249 |
+
'format_pdf_logo_source_id' => 0,
|
250 |
'format_pdf_logo_source' => '',
|
251 |
'format_pdf_logo_width' => 0,
|
252 |
'format_pdf_logo_height' => 15,
|
253 |
'format_pdf_logo_align' => 'R',
|
254 |
+
'format_pdf_row_images_width' => 15,
|
255 |
+
'format_pdf_row_images_height' => 15,
|
256 |
+
|
257 |
+
'format_html_display_column_names' => 1,
|
258 |
+
'format_html_repeat_header_last_line' => 0,
|
259 |
+
'format_html_font_size' => 13,
|
260 |
+
'format_html_header_text' => '',
|
261 |
+
'format_html_footer_text' => '',
|
262 |
+
'format_html_cols_align' => 'L',
|
263 |
+
'format_html_header_text_color' => '#000000',
|
264 |
+
'format_html_footer_text_color' => '#000000',
|
265 |
+
'format_html_table_header_text_color' => '#000000',
|
266 |
+
'format_html_table_header_background_color' => '#FFFFFF',
|
267 |
+
'format_html_table_row_text_color' => '#000000',
|
268 |
+
'format_html_table_row_background_color' => '#FFFFFF',
|
269 |
+
'format_html_custom_css' => "",
|
270 |
+
|
271 |
+
'all_products_from_order' => 1,
|
272 |
+
'skip_refunded_items' => 1,
|
273 |
+
'skip_suborders' => 0,
|
274 |
+
'export_refunds' => 0,
|
275 |
+
'date_format' => 'Y-m-d',
|
276 |
+
'time_format' => 'H:i',
|
277 |
+
'sort_direction' => 'DESC',
|
278 |
+
'sort' => 'order_id',
|
279 |
+
'format_number_fields' => 0,
|
280 |
+
'export_all_comments' => 0,
|
281 |
+
'export_refund_notes' => 0,
|
282 |
+
'strip_tags_product_fields' => 0,
|
283 |
+
'cleanup_phone' => 0,
|
284 |
+
'enable_debug' => 0,
|
285 |
+
'format_json_start_tag' => '[',
|
286 |
+
'format_json_end_tag' => ']',
|
287 |
+
'custom_php' => 0,
|
288 |
+
'custom_php_code' => '',
|
289 |
+
'mark_exported_orders' => 0,
|
290 |
+
'export_unmarked_orders' => 0,
|
291 |
|
292 |
'summary_report_by_products' => 0,
|
293 |
'duplicated_fields_settings' => array(
|
414 |
}, array_keys( $fields ), $fields );
|
415 |
}
|
416 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
public static function make_all_fields( $format ) {
|
418 |
$order_fields = array();
|
419 |
foreach ( array_keys( WC_Order_Export_Data_Extractor_UI::get_order_segments() ) as $segment ) {
|
454 |
return $order_fields;
|
455 |
}
|
456 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
static function save_export_settings( $mode, $id, $options ) {
|
458 |
$all_jobs = self::get_export_settings_collection( $mode );
|
459 |
if ( $mode == self::EXPORT_NOW ) {
|
460 |
$all_jobs = $options;// just replace
|
461 |
} elseif ( $mode == self::EXPORT_SCHEDULE ) {
|
462 |
if ( $id ) {
|
463 |
+
$options['schedule']['last_run'] = isset( $all_jobs[ $id ] ) ? $all_jobs[ $id ]['schedule']['last_run'] : current_time( "timestamp", 0 );
|
464 |
$options['schedule']['last_report_sent'] = isset( $all_jobs[ $id ] ) ? $all_jobs[ $id ]['schedule']['last_report_sent'] : current_time( "timestamp", 0 );
|
465 |
+
$options['schedule']['next_run'] = WC_Order_Export_Cron::next_event_timestamp_for_schedule( $options['schedule'], $id );
|
466 |
+
$all_jobs[ $id ] = $options;
|
467 |
} else {
|
468 |
+
$options['schedule']['last_run'] = current_time( "timestamp", 0 );
|
469 |
$options['schedule']['last_report_sent'] = current_time( "timestamp", 0 );
|
470 |
+
$options['schedule']['next_run'] = WC_Order_Export_Cron::next_event_timestamp_for_schedule( $options['schedule'] );
|
471 |
+
$all_jobs[] = $options; // new job
|
472 |
end( $all_jobs );
|
473 |
$id = key( $all_jobs );
|
474 |
}
|
487 |
return $id;
|
488 |
}
|
489 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
static function set_correct_file_ext( &$settings ) {
|
491 |
if ( $settings['format'] == 'XLS' AND ! $settings['format_xls_use_xls_format'] ) {
|
492 |
$settings['format'] = 'XLSX';
|
742 |
$settings['order_coupon_fields'] = $is_flat_format ? array() : $order_coupon_fields;
|
743 |
|
744 |
unset( $duplicated_fields_settings, $order_coupon_fields, $order_product_fields, $order_fields );
|
745 |
+
|
746 |
return $settings;
|
747 |
}
|
748 |
|
classes/admin/class-wc-order-export-settings.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
class WC_Order_Export_Main_Settings {
|
7 |
+
|
8 |
+
public static function get_settings() {
|
9 |
+
|
10 |
+
$settings = array(
|
11 |
+
'default_tab' => 'export',
|
12 |
+
'cron_tasks_active' => '1',
|
13 |
+
'show_export_status_column' => '1',
|
14 |
+
'show_export_actions_in_bulk' => '1',
|
15 |
+
'show_export_in_status_change_job' => '0',
|
16 |
+
'autocomplete_products_max' => '10',
|
17 |
+
'ajax_orders_per_step' => '30',
|
18 |
+
'limit_button_test' => '1',
|
19 |
+
'cron_key' => null,
|
20 |
+
'ipn_url' => '',
|
21 |
+
'zapier_api_key' => '12345678',
|
22 |
+
'zapier_file_timeout' => 60,
|
23 |
+
'show_date_time_picker_for_date_range' => false,
|
24 |
+
'display_html_report_in_browser' => false,
|
25 |
+
);
|
26 |
+
|
27 |
+
return apply_filters( 'woe_get_main_settings', $settings );
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
classes/admin/tabs/ajax/class-wc-order-export-ajax.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Class WC_Order_Export_Ajax
|
8 |
+
*
|
9 |
+
* Class for handle ajax requests which not require tab name to execute
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
class WC_Order_Export_Ajax {
|
13 |
+
use WC_Order_Export_Ajax_Helpers;
|
14 |
+
|
15 |
+
public function ajax_run_one_job() {
|
16 |
+
|
17 |
+
if ( ! empty( $_REQUEST['profile'] ) AND $_REQUEST['profile'] == 'now' ) {
|
18 |
+
$settings = WC_Order_Export_Manage::get( WC_Order_Export_Manage::EXPORT_NOW );
|
19 |
+
} else {
|
20 |
+
_e( 'Profile required!', 'woo-order-export-lite' );
|
21 |
+
}
|
22 |
+
|
23 |
+
$filename = WC_Order_Export_Engine::build_file_full( $settings );
|
24 |
+
WC_Order_Export_Manage::set_correct_file_ext( $settings );
|
25 |
+
|
26 |
+
$this->send_headers( $settings['format'], WC_Order_Export_Engine::make_filename( $settings['export_filename'] ) );
|
27 |
+
$this->send_contents_delete_file( $filename );
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
public function ajax_export_download_bulk_file() {
|
32 |
+
$this->build_and_send_file( $this->get_settings_from_bulk_request() );
|
33 |
+
}
|
34 |
+
|
35 |
+
protected function get_settings_from_bulk_request() {
|
36 |
+
$settings = false;
|
37 |
+
if ( ! empty( $_REQUEST['export_bulk_profile'] ) && $_REQUEST['export_bulk_profile'] == 'now' ) {
|
38 |
+
$settings = WC_Order_Export_Manage::get( WC_Order_Export_Manage::EXPORT_NOW );
|
39 |
+
}
|
40 |
+
|
41 |
+
return $settings;
|
42 |
+
}
|
43 |
+
}
|
classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
trait WC_Order_Export_Admin_Tab_Abstract_Ajax_Export {
|
7 |
+
use WC_Order_Export_Ajax_Helpers;
|
8 |
+
|
9 |
+
public function ajax_preview() {
|
10 |
+
|
11 |
+
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
12 |
+
// use unsaved settings
|
13 |
+
|
14 |
+
do_action( 'woe_start_preview_job', $_POST['id'], $settings );
|
15 |
+
|
16 |
+
WC_Order_Export_Engine::build_file( $settings, 'preview', 'browser', 0, $_POST['limit'] );
|
17 |
+
}
|
18 |
+
|
19 |
+
public function ajax_estimate() {
|
20 |
+
|
21 |
+
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
22 |
+
// use unsaved settings
|
23 |
+
|
24 |
+
$total = WC_Order_Export_Engine::build_file( $settings, 'estimate', 'file', 0, 0, 'test' );
|
25 |
+
|
26 |
+
echo json_encode( array( 'total' => $total ) );
|
27 |
+
}
|
28 |
+
|
29 |
+
public function ajax_export_start() {
|
30 |
+
|
31 |
+
$this->start_prevent_object_cache();
|
32 |
+
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
33 |
+
|
34 |
+
$filename = WC_Order_Export_Engine::tempnam( sys_get_temp_dir(), "orders" );
|
35 |
+
if ( ! $filename ) {
|
36 |
+
die( __( 'Can\'t create temporary file', 'woo-order-export-lite' ) );
|
37 |
+
}
|
38 |
+
|
39 |
+
//no free space or other file system errors?
|
40 |
+
try {
|
41 |
+
file_put_contents( $filename, '' );
|
42 |
+
do_action( 'woe_start_export_job', $_POST['id'], $settings );
|
43 |
+
$total = WC_Order_Export_Engine::build_file( $settings, 'start_estimate', 'file', 0, 0, $filename );
|
44 |
+
} catch ( Exception $e ) {
|
45 |
+
die( $e->getMessage() );
|
46 |
+
}
|
47 |
+
// file created
|
48 |
+
$file_id = current_time( 'timestamp' );
|
49 |
+
set_transient( $this->tempfile_prefix . $file_id, $filename, 60 );
|
50 |
+
$this->stop_prevent_object_cache();
|
51 |
+
echo json_encode( array( 'total' => $total, 'file_id' => $file_id ) );
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
public function ajax_export_part() {
|
56 |
+
|
57 |
+
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
58 |
+
$main_settings = WC_Order_Export_Main_Settings::get_settings();
|
59 |
+
|
60 |
+
WC_Order_Export_Engine::build_file( $settings, 'partial', 'file', intval( $_POST['start'] ),
|
61 |
+
$main_settings['ajax_orders_per_step'],
|
62 |
+
$this->get_temp_file_name() );
|
63 |
+
|
64 |
+
echo json_encode( array( 'start' => $_POST['start'] + $main_settings['ajax_orders_per_step'] ) );
|
65 |
+
}
|
66 |
+
|
67 |
+
public function ajax_plain_export() {
|
68 |
+
|
69 |
+
// use unsaved settings
|
70 |
+
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
71 |
+
do_action( 'woe_start_export_job', $_POST['id'], $settings );
|
72 |
+
|
73 |
+
// custom export worked for plain
|
74 |
+
if ( apply_filters( 'woe_plain_export_custom_func', false, $_POST['id'], $settings ) ) {
|
75 |
+
return;
|
76 |
+
}
|
77 |
+
|
78 |
+
$file = WC_Order_Export_Engine::build_file_full( $settings );
|
79 |
+
|
80 |
+
if ( $file !== false ) {
|
81 |
+
$file_id = current_time( 'timestamp' );
|
82 |
+
$this->start_prevent_object_cache();
|
83 |
+
set_transient( $this->tempfile_prefix . $file_id, $file, 600 );
|
84 |
+
$this->stop_prevent_object_cache();
|
85 |
+
|
86 |
+
WC_Order_Export_Manage::set_correct_file_ext( $settings );
|
87 |
+
|
88 |
+
$_GET['format'] = $settings['format'];
|
89 |
+
$_GET['file_id'] = $_REQUEST['file_id'] = $file_id;
|
90 |
+
|
91 |
+
$filename = WC_Order_Export_Engine::make_filename( $settings['export_filename'] );
|
92 |
+
$this->start_prevent_object_cache();
|
93 |
+
set_transient( $this->tempfile_prefix . 'download_filename', $filename, 60 );
|
94 |
+
$this->stop_prevent_object_cache();
|
95 |
+
|
96 |
+
$this->ajax_export_download();
|
97 |
+
} else {
|
98 |
+
_e( 'Nothing to export. Please, adjust your filters', 'woo-order-export-lite' );
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
public function ajax_export_download() {
|
104 |
+
|
105 |
+
$this->start_prevent_object_cache();
|
106 |
+
$format = basename( $_GET['format'] );
|
107 |
+
$filename = $this->get_temp_file_name();
|
108 |
+
delete_transient( $this->tempfile_prefix . $_GET['file_id'] );
|
109 |
+
|
110 |
+
$download_name = get_transient( $this->tempfile_prefix . 'download_filename' );
|
111 |
+
$this->send_headers( $format, $download_name );
|
112 |
+
$this->send_contents_delete_file( $filename );
|
113 |
+
$this->stop_prevent_object_cache();
|
114 |
+
}
|
115 |
+
|
116 |
+
public function ajax_export_finish() {
|
117 |
+
|
118 |
+
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
119 |
+
WC_Order_Export_Engine::build_file( $settings, 'finish', 'file', 0, 0, $this->get_temp_file_name() );
|
120 |
+
|
121 |
+
$filename = WC_Order_Export_Engine::make_filename( $settings['export_filename'] );
|
122 |
+
$this->start_prevent_object_cache();
|
123 |
+
set_transient( $this->tempfile_prefix . 'download_filename', $filename, 60 );
|
124 |
+
$this->stop_prevent_object_cache();
|
125 |
+
echo json_encode( array( 'done' => true ) );
|
126 |
+
}
|
127 |
+
|
128 |
+
public function ajax_cancel_export() {
|
129 |
+
|
130 |
+
$this->delete_temp_file();
|
131 |
+
echo json_encode( array() );
|
132 |
+
}
|
133 |
+
|
134 |
+
}
|
classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-filters.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
trait WC_Order_Export_Admin_Tab_Abstract_Ajax_Filters {
|
7 |
+
/**
|
8 |
+
* Select2 method
|
9 |
+
*/
|
10 |
+
public function ajax_get_products() {
|
11 |
+
|
12 |
+
$main_settings = WC_Order_Export_Main_Settings::get_settings();
|
13 |
+
|
14 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_products_like( $_REQUEST['q'],
|
15 |
+
$main_settings['autocomplete_products_max'] ) );
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Select2 method
|
20 |
+
*/
|
21 |
+
public function ajax_get_users() {
|
22 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_users_like( $_REQUEST['q'] ) );
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Select2 method
|
27 |
+
*/
|
28 |
+
public function ajax_get_coupons() {
|
29 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_coupons_like( $_REQUEST['q'] ) );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Select2 method
|
34 |
+
*/
|
35 |
+
public function ajax_get_categories() {
|
36 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_categories_like( $_REQUEST['q'] ) );
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Select2 method
|
41 |
+
*/
|
42 |
+
public function ajax_get_vendors() {
|
43 |
+
$this->ajax_get_users();
|
44 |
+
}
|
45 |
+
|
46 |
+
public function ajax_get_used_custom_order_meta() {
|
47 |
+
|
48 |
+
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
49 |
+
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
50 |
+
$ret = WC_Order_Export_Data_Extractor_UI::get_all_order_custom_meta_fields( $sql );
|
51 |
+
echo json_encode( $ret );
|
52 |
+
}
|
53 |
+
|
54 |
+
public function ajax_get_used_custom_products_meta() {
|
55 |
+
|
56 |
+
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
57 |
+
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
58 |
+
$ret = WC_Order_Export_Data_Extractor_UI::get_product_custom_meta_fields_for_orders( $sql );
|
59 |
+
echo json_encode( $ret );
|
60 |
+
}
|
61 |
+
|
62 |
+
public function ajax_get_used_custom_order_items_meta() {
|
63 |
+
|
64 |
+
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
65 |
+
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
66 |
+
$ret = WC_Order_Export_Data_Extractor_UI::get_order_item_custom_meta_fields_for_orders( $sql );
|
67 |
+
echo json_encode( $ret );
|
68 |
+
}
|
69 |
+
|
70 |
+
public function ajax_get_used_custom_coupons_meta() {
|
71 |
+
|
72 |
+
$ret = array();
|
73 |
+
echo json_encode( $ret );
|
74 |
+
}
|
75 |
+
|
76 |
+
public function ajax_get_order_custom_fields_values() {
|
77 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_custom_fields_values( $_POST['cf_name'] ) );
|
78 |
+
}
|
79 |
+
|
80 |
+
public function ajax_get_user_custom_fields_values() {
|
81 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_user_custom_fields_values( $_POST['cf_name'] ) );
|
82 |
+
}
|
83 |
+
|
84 |
+
public function ajax_get_product_custom_fields_values() {
|
85 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_product_custom_fields_values( $_POST['cf_name'] ) );
|
86 |
+
}
|
87 |
+
|
88 |
+
public function ajax_get_products_taxonomies_values() {
|
89 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_products_taxonomies_values( $_POST['tax'] ) );
|
90 |
+
}
|
91 |
+
|
92 |
+
public function ajax_get_products_attributes_values() {
|
93 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_products_attributes_values( $_POST['attr'] ) );
|
94 |
+
}
|
95 |
+
|
96 |
+
public function ajax_get_products_itemmeta_values() {
|
97 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_products_itemmeta_values( $_POST['item'] ) );
|
98 |
+
}
|
99 |
+
|
100 |
+
public function ajax_get_order_shipping_values() {
|
101 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_meta_values( '_shipping_', $_POST['item'] ) );
|
102 |
+
}
|
103 |
+
|
104 |
+
public function ajax_get_order_billing_values() {
|
105 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_meta_values( '_billing_', $_POST['item'] ) );
|
106 |
+
}
|
107 |
+
|
108 |
+
public function ajax_get_order_item_names() {
|
109 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_item_names( $_POST['item_type'] ) );
|
110 |
+
}
|
111 |
+
|
112 |
+
public function ajax_get_order_item_meta_key_values() {
|
113 |
+
echo json_encode( WC_Order_Export_Data_Extractor_UI::get_order_item_meta_key_values( $_POST['meta_key'] ) );
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
trait WC_Order_Export_Admin_Tab_Abstract_Ajax {
|
7 |
+
use WC_Order_Export_Admin_Tab_Abstract_Ajax_Filters;
|
8 |
+
use WC_Order_Export_Admin_Tab_Abstract_Ajax_Export;
|
9 |
+
|
10 |
+
public function ajax_save_settings() {
|
11 |
+
|
12 |
+
$settings = WC_Order_Export_Manage::make_new_settings( $_POST );
|
13 |
+
|
14 |
+
/*
|
15 |
+
array_walk_recursive($settings, function(&$_value, $_key) {
|
16 |
+
if ($_key !== 'custom_php_code' AND $_key !== 'email_body') {
|
17 |
+
$_value = esc_attr($_value);
|
18 |
+
}
|
19 |
+
});
|
20 |
+
*/
|
21 |
+
|
22 |
+
$id = WC_Order_Export_Manage::save_export_settings( $_POST['mode'], (int) $_POST['id'], $settings );
|
23 |
+
|
24 |
+
echo json_encode( array( 'id' => $id ) );
|
25 |
+
}
|
26 |
+
|
27 |
+
public function ajax_reset_profile() {
|
28 |
+
$id = WC_Order_Export_Manage::save_export_settings( $_POST['mode'], $_POST['id'], array() );
|
29 |
+
wp_send_json_success();
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
classes/admin/tabs/ajax/trait-wc-order-export-ajax-helpers.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
trait WC_Order_Export_Ajax_Helpers {
|
7 |
+
protected $tempfile_prefix = 'woocommerce-order-file-';
|
8 |
+
|
9 |
+
protected $_wp_using_ext_object_cache_previous;
|
10 |
+
|
11 |
+
protected function send_headers( $format, $download_name = '' ) {
|
12 |
+
|
13 |
+
WC_Order_Export_Engine::kill_buffers();
|
14 |
+
|
15 |
+
switch ( $format ) {
|
16 |
+
case 'XLSX':
|
17 |
+
if ( empty( $download_name ) ) {
|
18 |
+
$download_name = "orders.xlsx";
|
19 |
+
}
|
20 |
+
header( 'Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
|
21 |
+
break;
|
22 |
+
case 'XLS':
|
23 |
+
if ( empty( $download_name ) ) {
|
24 |
+
$download_name = "orders.xls";
|
25 |
+
}
|
26 |
+
header( 'Content-type: application/vnd.ms-excel; charset=utf-8' );
|
27 |
+
break;
|
28 |
+
case 'CSV':
|
29 |
+
if ( empty( $download_name ) ) {
|
30 |
+
$download_name = "orders.csv";
|
31 |
+
}
|
32 |
+
header( 'Content-type: text/csv' );
|
33 |
+
break;
|
34 |
+
case 'TSV':
|
35 |
+
if ( empty( $download_name ) ) {
|
36 |
+
$download_name = "orders.tsv";
|
37 |
+
}
|
38 |
+
header( 'Content-type: text/csv' );
|
39 |
+
break;
|
40 |
+
case 'JSON':
|
41 |
+
if ( empty( $download_name ) ) {
|
42 |
+
$download_name = "orders.json";
|
43 |
+
}
|
44 |
+
header( 'Content-type: application/json' );
|
45 |
+
break;
|
46 |
+
case 'XML':
|
47 |
+
if ( empty( $download_name ) ) {
|
48 |
+
$download_name = "orders.xml";
|
49 |
+
}
|
50 |
+
header( 'Content-type: text/xml' );
|
51 |
+
break;
|
52 |
+
case 'PDF':
|
53 |
+
if ( empty( $download_name ) ) {
|
54 |
+
$download_name = "orders.pdf";
|
55 |
+
}
|
56 |
+
header("Content-type: application/pdf");
|
57 |
+
break;
|
58 |
+
case 'HTML':
|
59 |
+
if ( empty( $download_name ) ) {
|
60 |
+
$download_name = "orders.html";
|
61 |
+
}
|
62 |
+
|
63 |
+
$settings = WC_Order_Export_Main_Settings::get_settings();
|
64 |
+
|
65 |
+
if ( ! empty( $settings['display_html_report_in_browser'] ) ) {
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
|
69 |
+
break;
|
70 |
+
}
|
71 |
+
header( 'Content-Disposition: attachment; filename="' . $download_name . '"' );
|
72 |
+
}
|
73 |
+
|
74 |
+
protected function start_prevent_object_cache() {
|
75 |
+
|
76 |
+
global $_wp_using_ext_object_cache;
|
77 |
+
|
78 |
+
$this->_wp_using_ext_object_cache_previous = $_wp_using_ext_object_cache;
|
79 |
+
$_wp_using_ext_object_cache = false;
|
80 |
+
}
|
81 |
+
|
82 |
+
protected function stop_prevent_object_cache() {
|
83 |
+
|
84 |
+
global $_wp_using_ext_object_cache;
|
85 |
+
|
86 |
+
$_wp_using_ext_object_cache = $this->_wp_using_ext_object_cache_previous;
|
87 |
+
}
|
88 |
+
|
89 |
+
protected function send_contents_delete_file( $filename ) {
|
90 |
+
if ( ! empty( $filename ) ) {
|
91 |
+
if( !$this->function_disabled('readfile') ) {
|
92 |
+
readfile( $filename );
|
93 |
+
} else {
|
94 |
+
// fallback, emulate readfile
|
95 |
+
$file = fopen($filename, 'rb');
|
96 |
+
if ( $file !== false ) {
|
97 |
+
while ( !feof($file) ) {
|
98 |
+
echo fread($file, 4096);
|
99 |
+
}
|
100 |
+
fclose($file);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
unlink( $filename );
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
function function_disabled($function) {
|
108 |
+
$disabled_functions = explode(',', ini_get('disable_functions'));
|
109 |
+
return in_array($function, $disabled_functions);
|
110 |
+
}
|
111 |
+
|
112 |
+
protected function get_temp_file_name() {
|
113 |
+
|
114 |
+
$this->start_prevent_object_cache();
|
115 |
+
|
116 |
+
$filename = get_transient( $this->tempfile_prefix . $_REQUEST['file_id'] );
|
117 |
+
if ( $filename === false ) {
|
118 |
+
echo json_encode( array( 'error' => __( 'Can\'t find exported file', 'woo-order-export-lite' ) ) );
|
119 |
+
die();
|
120 |
+
}
|
121 |
+
set_transient( $this->tempfile_prefix . $_REQUEST['file_id'], $filename, 60 );
|
122 |
+
$this->stop_prevent_object_cache();
|
123 |
+
|
124 |
+
return $filename;
|
125 |
+
}
|
126 |
+
|
127 |
+
protected function delete_temp_file() {
|
128 |
+
|
129 |
+
$this->start_prevent_object_cache();
|
130 |
+
$filename = get_transient( $this->tempfile_prefix . $_REQUEST['file_id'] );
|
131 |
+
if ( $filename !== false ) {
|
132 |
+
delete_transient( $this->tempfile_prefix . $_REQUEST['file_id'] );
|
133 |
+
unlink( $filename );
|
134 |
+
}
|
135 |
+
$this->stop_prevent_object_cache();
|
136 |
+
}
|
137 |
+
|
138 |
+
protected function build_and_send_file( $settings ) {
|
139 |
+
$filename = WC_Order_Export_Engine::build_file_full( $settings, '', 0, explode( ",", $_REQUEST['ids'] ) );
|
140 |
+
WC_Order_Export_Manage::set_correct_file_ext( $settings );
|
141 |
+
|
142 |
+
$this->send_headers( $settings['format'], WC_Order_Export_Engine::make_filename( $settings['export_filename'] ) );
|
143 |
+
$this->send_contents_delete_file( $filename );
|
144 |
+
}
|
145 |
+
|
146 |
+
}
|
classes/admin/tabs/class-wc-order-export-admin-tab-abstract.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
class WC_Order_Export_Admin_Tab_Abstract {
|
7 |
+
use WC_Order_Export_Admin_Tab_Abstract_Ajax;
|
8 |
+
|
9 |
+
const KEY = null;
|
10 |
+
|
11 |
+
protected $title;
|
12 |
+
|
13 |
+
public static function get_key() {
|
14 |
+
return static::KEY;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function get_title() {
|
18 |
+
return $this->title;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function process() {
|
22 |
+
}
|
23 |
+
|
24 |
+
public function render() {
|
25 |
+
}
|
26 |
+
|
27 |
+
public function render_template( $view, $params = array(), $path_views = null ) {
|
28 |
+
|
29 |
+
$params = apply_filters( 'woe_render_params', $params );
|
30 |
+
$params = apply_filters( 'woe_render_params_' . $view, $params );
|
31 |
+
|
32 |
+
$active_tab = static::get_key();
|
33 |
+
|
34 |
+
extract( $params );
|
35 |
+
|
36 |
+
if ( $path_views ) {
|
37 |
+
include $path_views . "$view.php";
|
38 |
+
} else {
|
39 |
+
include WOE_PLUGIN_BASEPATH . "/view/" . "$view.php";
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
classes/admin/tabs/class-wc-order-export-admin-tab-export-now.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
class WC_Order_Export_Admin_Tab_Export_Now extends WC_Order_Export_Admin_Tab_Abstract {
|
7 |
+
const KEY = 'export';
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
$this->title = __( 'Export now', 'woo-order-export-lite' );
|
11 |
+
}
|
12 |
+
|
13 |
+
public function render() {
|
14 |
+
$this->render_template( 'tab/export', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'tab' => $this ) );
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
classes/admin/tabs/class-wc-order-export-admin-tab-help.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
class WC_Order_Export_Admin_Tab_Help extends WC_Order_Export_Admin_Tab_Abstract {
|
7 |
+
const KEY = 'help';
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
$this->title = __( 'Help', 'woo-order-export-lite' );
|
11 |
+
}
|
12 |
+
|
13 |
+
public function render() {
|
14 |
+
$this->render_template( 'tab/help' );
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
classes/admin/tabs/class-wc-order-export-admin-tab-profiles.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
class WC_Order_Export_Admin_Tab_Profiles extends WC_Order_Export_Admin_Tab_Abstract {
|
7 |
+
const KEY = 'profiles';
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
$this->title = __( 'Profiles', 'woo-order-export-lite' );
|
11 |
+
}
|
12 |
+
|
13 |
+
public function render() {
|
14 |
+
$this->render_template( 'tab/profiles' );
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
classes/admin/tabs/class-wc-order-export-admin-tab-schedule-jobs.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
class WC_Order_Export_Admin_Tab_Schedule_Jobs extends WC_Order_Export_Admin_Tab_Abstract {
|
7 |
+
const KEY = 'schedules';
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
$this->title = __( 'Scheduled jobs', 'woo-order-export-lite' );
|
11 |
+
}
|
12 |
+
|
13 |
+
public function render() {
|
14 |
+
$this->render_template( 'tab/schedules' );
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
classes/admin/tabs/class-wc-order-export-admin-tab-status-change-jobs.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
class WC_Order_Export_Admin_Tab_Status_Change_Jobs extends WC_Order_Export_Admin_Tab_Abstract {
|
7 |
+
const KEY = 'order_actions';
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
$this->title = __( 'Status change jobs', 'woo-order-export-lite' );
|
11 |
+
}
|
12 |
+
|
13 |
+
public function render() {
|
14 |
+
$this->render_template( 'tab/order-actions' );
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
classes/admin/tabs/class-wc-order-export-admin-tab-tools.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
class WC_Order_Export_Admin_Tab_Tools extends WC_Order_Export_Admin_Tab_Abstract {
|
7 |
+
const KEY = 'tools';
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
$this->title = __( 'Tools', 'woo-order-export-lite' );
|
11 |
+
}
|
12 |
+
|
13 |
+
public function render() {
|
14 |
+
$this->render_template( 'tab/tools' );
|
15 |
+
}
|
16 |
+
|
17 |
+
public function ajax_save_tools() {
|
18 |
+
|
19 |
+
$data = json_decode( $_POST['tools-import'], true );
|
20 |
+
|
21 |
+
if ( $data ) {
|
22 |
+
WC_Order_Export_Manage::import_settings( $data );
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
classes/class-wc-order-export-admin.php
CHANGED
@@ -4,14 +4,15 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
4 |
}
|
5 |
|
6 |
class WC_Order_Export_Admin {
|
7 |
-
|
8 |
var $activation_notice_option = 'woocommerce-order-export-activation-notice-shown';
|
9 |
var $step = 30;
|
10 |
-
public static $formats = array( 'XLS', 'CSV', 'XML', 'JSON', 'TSV', 'PDF' );
|
11 |
public static $export_types = array( 'EMAIL', 'FTP', 'HTTP', 'FOLDER', 'SFTP', 'ZAPIER' );
|
12 |
public $url_plugin;
|
13 |
public $path_plugin;
|
14 |
-
|
|
|
15 |
|
16 |
public function __construct() {
|
17 |
$this->url_plugin = dirname( plugin_dir_url( __FILE__ ) ) . '/';
|
@@ -20,19 +21,27 @@ class WC_Order_Export_Admin {
|
|
20 |
|
21 |
if ( is_admin() ) { // admin actions
|
22 |
add_action( 'admin_menu', array( $this, 'add_menu' ) );
|
23 |
-
|
24 |
// load scripts on our pages only
|
25 |
if ( isset( $_GET['page'] ) && $_GET['page'] == 'wc-order-export' ) {
|
26 |
add_action( 'admin_enqueue_scripts', array( $this, 'thematic_enqueue_scripts' ) );
|
27 |
add_filter( 'script_loader_src', array( $this, 'script_loader_src' ), 999, 2 );
|
28 |
}
|
|
|
|
|
|
|
|
|
|
|
29 |
add_action( 'wp_ajax_order_exporter', array( $this, 'ajax_gate' ) );
|
30 |
|
31 |
//Add custom bulk export action in Woocomerce orders Table, modified for WP 4.7
|
32 |
add_filter( 'bulk_actions-edit-shop_order', array( $this, 'export_orders_bulk_action' ) );
|
33 |
-
add_filter( 'handle_bulk_actions-edit-shop_order', array(
|
34 |
-
|
|
|
|
|
35 |
add_action( 'admin_notices', array( $this, 'export_orders_bulk_action_notices' ) );
|
|
|
36 |
//do once
|
37 |
if ( ! get_option( $this->activation_notice_option ) ) {
|
38 |
add_action( 'admin_notices', array( $this, 'display_plugin_activated_message' ) );
|
@@ -47,33 +56,29 @@ class WC_Order_Export_Admin {
|
|
47 |
// Add 'Export Status' orders page column content
|
48 |
add_action( 'manage_shop_order_posts_custom_column', array( $this, 'add_order_status_column_content' ) );
|
49 |
|
|
|
50 |
if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == 'shop_order' ) {
|
51 |
add_action( 'admin_print_styles', array( $this, 'add_order_status_column_style' ) );
|
52 |
}
|
53 |
}
|
54 |
|
55 |
-
$this->settings =
|
56 |
-
|
57 |
-
//Pro active ?
|
58 |
-
if ( self::is_full_version() ) {
|
59 |
-
new WC_Order_Export_Zapier_Engine( $this->settings );
|
60 |
-
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
61 |
-
add_filter( 'cron_schedules', array( 'WC_Order_Export_Cron', 'create_custom_schedules' ), 999, 1 );
|
62 |
-
add_action( 'wc_export_cron_global', array( 'WC_Order_Export_Cron', 'wc_export_cron_global_f' ) );
|
63 |
-
|
64 |
-
//for direct calls
|
65 |
-
add_action( 'wp_ajax_order_exporter_run', array( $this, 'ajax_gate_guest' ) );
|
66 |
-
add_action( 'wp_ajax_nopriv_order_exporter_run', array( $this, 'ajax_gate_guest' ) );
|
67 |
-
$this->methods_allowed_for_guests = array( 'run_cron_jobs', 'run_one_job', 'run_one_scheduled_job' );
|
68 |
-
|
69 |
-
// order actions
|
70 |
-
add_action( 'woocommerce_order_status_changed', array( $this, 'wc_order_status_changed' ), 10, 3 );
|
71 |
-
// activate CRON hook if it was removed
|
72 |
-
add_action( 'wp_loaded', function () {
|
73 |
-
WC_Order_Export_Cron::try_install_job();
|
74 |
-
} );
|
75 |
-
}
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
|
79 |
public function add_order_status_column_header( $columns ) {
|
@@ -117,12 +122,6 @@ class WC_Order_Export_Admin {
|
|
117 |
wp_add_inline_style( 'woocommerce_admin_styles', $css );
|
118 |
}
|
119 |
|
120 |
-
public function install() {
|
121 |
-
if ( self::is_full_version() ) {
|
122 |
-
WC_Order_Export_Cron::try_install_job();
|
123 |
-
}
|
124 |
-
}
|
125 |
-
|
126 |
public function display_plugin_activated_message() {
|
127 |
?>
|
128 |
<div class="notice notice-success is-dismissible">
|
@@ -148,69 +147,6 @@ class WC_Order_Export_Admin {
|
|
148 |
public function deactivate() {
|
149 |
wp_clear_scheduled_hook( "wc_export_cron_global" );
|
150 |
delete_option( $this->activation_notice_option );
|
151 |
-
|
152 |
-
if ( self::is_full_version() ) {
|
153 |
-
//don't do it! updater call this function!
|
154 |
-
// WC_Order_Export_EDD::getInstance()->edd_woe_force_deactivate_license();
|
155 |
-
}
|
156 |
-
}
|
157 |
-
|
158 |
-
public static function uninstall() {
|
159 |
-
//delete_option( self::settings_name_common );
|
160 |
-
//WC_Order_Export_Manage::remove_settings();
|
161 |
-
}
|
162 |
-
|
163 |
-
static function load_main_settings() {
|
164 |
-
return array_merge(
|
165 |
-
array(
|
166 |
-
'default_tab' => 'export',
|
167 |
-
'cron_tasks_active' => '1',
|
168 |
-
'show_export_status_column' => '1',
|
169 |
-
'show_export_actions_in_bulk' => '1',
|
170 |
-
'show_export_in_status_change_job' => '0',
|
171 |
-
'autocomplete_products_max' => '10',
|
172 |
-
'ajax_orders_per_step' => '30',
|
173 |
-
'limit_button_test' => '1',
|
174 |
-
'cron_key' => '1234',
|
175 |
-
'ipn_url' => '',
|
176 |
-
'zapier_api_key' => '12345678',
|
177 |
-
'zapier_file_timeout' => 60,
|
178 |
-
),
|
179 |
-
get_option( self::settings_name_common, array() )
|
180 |
-
);
|
181 |
-
}
|
182 |
-
|
183 |
-
static function save_main_settings() {
|
184 |
-
// update main settings here!
|
185 |
-
$settings = filter_input_array( INPUT_POST, array(
|
186 |
-
'default_tab' => FILTER_SANITIZE_STRING,
|
187 |
-
'cron_tasks_active' => FILTER_VALIDATE_BOOLEAN,
|
188 |
-
'show_export_status_column' => FILTER_VALIDATE_BOOLEAN,
|
189 |
-
'show_export_actions_in_bulk' => FILTER_VALIDATE_BOOLEAN,
|
190 |
-
'show_export_in_status_change_job' => FILTER_VALIDATE_BOOLEAN,
|
191 |
-
'autocomplete_products_max' => FILTER_VALIDATE_INT,
|
192 |
-
'ajax_orders_per_step' => FILTER_VALIDATE_INT,
|
193 |
-
'limit_button_test' => FILTER_SANITIZE_STRING,
|
194 |
-
'cron_key' => FILTER_SANITIZE_STRING,
|
195 |
-
'ipn_url' => FILTER_SANITIZE_STRING,
|
196 |
-
'zapier_api_key' => FILTER_SANITIZE_STRING,
|
197 |
-
'zapier_file_timeout' => FILTER_SANITIZE_NUMBER_INT,
|
198 |
-
) );
|
199 |
-
update_option( self::settings_name_common, $settings, false );
|
200 |
-
|
201 |
-
if ( isset( $settings['ipn_url'] ) ) {
|
202 |
-
update_option( WOE_IPN_URL_OPTION_KEY, $settings['ipn_url'], false );
|
203 |
-
}
|
204 |
-
}
|
205 |
-
|
206 |
-
|
207 |
-
function load_textdomain() {
|
208 |
-
$locale = apply_filters( 'plugin_locale', get_locale(), 'woo-order-export-lite' );
|
209 |
-
load_textdomain( 'woo-order-export-lite',
|
210 |
-
WP_LANG_DIR . '/woocommerce-order-export/woocommerce-order-export-' . $locale . '.mo' );
|
211 |
-
|
212 |
-
load_plugin_textdomain( 'woo-order-export-lite', false,
|
213 |
-
plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/i18n/languages' );
|
214 |
}
|
215 |
|
216 |
public function add_menu() {
|
@@ -229,406 +165,23 @@ class WC_Order_Export_Admin {
|
|
229 |
}
|
230 |
|
231 |
public function render_menu() {
|
232 |
-
$this->render( 'main', array( 'WC_Order_Export' => $this, 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
|
233 |
-
$active_tab = isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : $this->settings['default_tab'];
|
234 |
-
if ( method_exists( $this, 'render_tab_' . $active_tab ) ) {
|
235 |
-
$this->{'render_tab_' . $active_tab}();
|
236 |
-
}
|
237 |
-
}
|
238 |
-
|
239 |
-
public function render_tab_export() {
|
240 |
-
$this->render( 'tab/export', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'WC_Order_Export' => $this ) );
|
241 |
-
}
|
242 |
-
|
243 |
-
public function render_tab_tools() {
|
244 |
-
$this->render( 'tab/tools', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'WC_Order_Export' => $this ) );
|
245 |
-
}
|
246 |
-
|
247 |
-
public function render_tab_settings() {
|
248 |
-
$this->render( 'tab/settings',
|
249 |
-
array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'settings' => $this->settings ) );
|
250 |
-
}
|
251 |
-
|
252 |
-
public function render_tab_license() {
|
253 |
-
$this->render( 'tab/license', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'WC_Order_Export' => $this ) );
|
254 |
-
}
|
255 |
-
|
256 |
-
public function render_tab_help() {
|
257 |
-
$this->render( 'tab/help', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'WC_Order_Export' => $this ) );
|
258 |
-
}
|
259 |
-
|
260 |
-
public function render_tab_order_actions() {
|
261 |
-
$wc_oe = isset( $_REQUEST['wc_oe'] ) ? $_REQUEST['wc_oe'] : '';
|
262 |
-
|
263 |
-
if (in_array($wc_oe, array(
|
264 |
-
'copy_action',
|
265 |
-
'delete',
|
266 |
-
'change_status',
|
267 |
-
'change_statuses',
|
268 |
-
)) && !check_admin_referer( 'woe_nonce', 'woe_nonce' )) {
|
269 |
-
return;
|
270 |
-
}
|
271 |
-
|
272 |
-
$ajaxurl = admin_url( 'admin-ajax.php' );
|
273 |
-
$mode = WC_Order_Export_Manage::EXPORT_ORDER_ACTION;
|
274 |
-
$all_items = WC_Order_Export_Manage::get_export_settings_collection( $mode );
|
275 |
-
$show = array(
|
276 |
-
'date_filter' => $this->settings['show_export_in_status_change_job'],
|
277 |
-
'export_button' => $this->settings['show_export_in_status_change_job'],
|
278 |
-
'export_button_plain' => $this->settings['show_export_in_status_change_job'],
|
279 |
-
'preview_actions' => false,
|
280 |
-
'destinations' => true,
|
281 |
-
'schedule' => false,
|
282 |
-
'sort_orders' => false,
|
283 |
-
'order_filters' => true,
|
284 |
-
'product_filters' => true,
|
285 |
-
'customer_filters' => true,
|
286 |
-
'billing_filters' => true,
|
287 |
-
'shipping_filters' => true,
|
288 |
-
);
|
289 |
-
switch ( $wc_oe ) {
|
290 |
-
case 'add_action':
|
291 |
-
end( $all_items );
|
292 |
-
$next_id = key( $all_items ) + 1;
|
293 |
-
$this->render( 'settings-form', array(
|
294 |
-
'mode' => $mode,
|
295 |
-
'id' => $next_id,
|
296 |
-
'WC_Order_Export' => $this,
|
297 |
-
'ajaxurl' => $ajaxurl,
|
298 |
-
'show' => $show,
|
299 |
-
) );
|
300 |
-
|
301 |
-
return;
|
302 |
-
case 'edit_action':
|
303 |
-
if ( ! isset( $_REQUEST['action_id'] ) ) {
|
304 |
-
break;
|
305 |
-
}
|
306 |
-
$item_id = $_REQUEST['action_id'];
|
307 |
-
WC_Order_Export_Manage::$edit_existing_job = true;
|
308 |
-
$this->render( 'settings-form', array(
|
309 |
-
'mode' => $mode,
|
310 |
-
'id' => $item_id,
|
311 |
-
'WC_Order_Export' => $this,
|
312 |
-
'ajaxurl' => $ajaxurl,
|
313 |
-
'show' => $show,
|
314 |
-
) );
|
315 |
-
|
316 |
-
return;
|
317 |
-
case 'copy_action':
|
318 |
-
if ( ! isset( $_REQUEST['action_id'] ) ) {
|
319 |
-
break;
|
320 |
-
}
|
321 |
-
$item_id = $_REQUEST['action_id'];
|
322 |
-
$item_id = WC_Order_Export_Manage::clone_export_settings( $mode, $item_id );
|
323 |
-
|
324 |
-
$url = add_query_arg( array(
|
325 |
-
'action_id' => $item_id,
|
326 |
-
'wc_oe' => 'edit_action',
|
327 |
-
));
|
328 |
-
|
329 |
-
$url = remove_query_arg(array('woe_nonce'), $url);
|
330 |
-
|
331 |
-
wp_redirect( $url );
|
332 |
-
|
333 |
-
return;
|
334 |
-
case 'delete':
|
335 |
-
if ( ! isset( $_REQUEST['action_id'] ) ) {
|
336 |
-
break;
|
337 |
-
}
|
338 |
-
$item_id = $_REQUEST['action_id'];
|
339 |
-
unset( $all_items[ $item_id ] );
|
340 |
-
WC_Order_Export_Manage::save_export_settings_collection( $mode, $all_items );
|
341 |
-
|
342 |
-
$url = remove_query_arg( array( 'wc_oe', 'action_id', 'woe_nonce' ) );
|
343 |
-
wp_redirect( $url );
|
344 |
-
|
345 |
-
break;
|
346 |
-
case 'change_status':
|
347 |
-
if ( ! isset( $_REQUEST['action_id'] ) ) {
|
348 |
-
break;
|
349 |
-
}
|
350 |
-
$item_id = $_REQUEST['action_id'];
|
351 |
-
$all_items[ $item_id ]['active'] = $_REQUEST['status'];
|
352 |
-
WC_Order_Export_Manage::save_export_settings_collection( $mode, $all_items );
|
353 |
-
$url = remove_query_arg( array( 'wc_oe', 'action_id', 'status', 'woe_nonce' ) );
|
354 |
-
wp_redirect( $url );
|
355 |
-
break;
|
356 |
-
case 'change_statuses':
|
357 |
-
if ( ! isset( $_REQUEST['chosen_order_actions'] ) AND ! isset( $_REQUEST['doaction'] ) AND - 1 == $_REQUEST['doaction'] ) {
|
358 |
-
break;
|
359 |
-
}
|
360 |
-
$chosen_order_actions = explode( ',', $_REQUEST['chosen_order_actions'] );
|
361 |
-
$doaction = $_REQUEST['doaction'];
|
362 |
-
|
363 |
-
foreach ( $chosen_order_actions as $order_action_id ) {
|
364 |
-
if ( 'activate' == $doaction ) {
|
365 |
-
$all_items[ $order_action_id ]['active'] = 1;
|
366 |
-
} elseif ( 'deactivate' == $doaction ) {
|
367 |
-
$all_items[ $order_action_id ]['active'] = 0;
|
368 |
-
} elseif ( 'delete' == $doaction ) {
|
369 |
-
unset( $all_items[ $order_action_id ] );
|
370 |
-
}
|
371 |
-
}
|
372 |
-
WC_Order_Export_Manage::save_export_settings_collection( $mode, $all_items );
|
373 |
-
$url = remove_query_arg( array( 'wc_oe', 'chosen_order_actions', 'doaction', 'woe_nonce' ) );
|
374 |
-
wp_redirect( $url );
|
375 |
-
break;
|
376 |
-
}
|
377 |
-
$this->render( 'tab/order-actions',
|
378 |
-
array( 'ajaxurl' => $ajaxurl, 'WC_Order_Export' => $this, 'tab' => 'order_actions' ) );
|
379 |
-
}
|
380 |
-
|
381 |
-
public function render_tab_schedules() {
|
382 |
-
$wc_oe = isset( $_REQUEST['wc_oe'] ) ? $_REQUEST['wc_oe'] : '';
|
383 |
-
|
384 |
-
if (in_array($wc_oe, array(
|
385 |
-
'copy_schedule',
|
386 |
-
'delete_schedule',
|
387 |
-
'change_status_schedule',
|
388 |
-
'change_status_schedules',
|
389 |
-
)) && !check_admin_referer( 'woe_nonce', 'woe_nonce' )) {
|
390 |
-
return;
|
391 |
-
}
|
392 |
-
|
393 |
-
$ajaxurl = admin_url( 'admin-ajax.php' );
|
394 |
-
$mode = WC_Order_Export_Manage::EXPORT_SCHEDULE;
|
395 |
-
$all_jobs = WC_Order_Export_Manage::get_export_settings_collection( $mode );
|
396 |
-
$show = array(
|
397 |
-
'date_filter' => true,
|
398 |
-
'export_button' => true,
|
399 |
-
'export_button_plain' => true,
|
400 |
-
'destinations' => true,
|
401 |
-
'schedule' => true,
|
402 |
-
);
|
403 |
-
switch ( $wc_oe ) {
|
404 |
-
case 'add_schedule':
|
405 |
-
end( $all_jobs );
|
406 |
-
$next_id = key( $all_jobs ) + 1;
|
407 |
-
$this->render( 'settings-form', array(
|
408 |
-
'mode' => $mode,
|
409 |
-
'id' => $next_id,
|
410 |
-
'WC_Order_Export' => $this,
|
411 |
-
'ajaxurl' => $ajaxurl,
|
412 |
-
'show' => $show,
|
413 |
-
) );
|
414 |
-
|
415 |
-
return;
|
416 |
-
case 'edit_schedule':
|
417 |
-
if ( ! isset( $_REQUEST['schedule_id'] ) ) {
|
418 |
-
break;
|
419 |
-
}
|
420 |
-
$schedule_id = $_REQUEST['schedule_id'];
|
421 |
-
WC_Order_Export_Manage::$edit_existing_job = true;
|
422 |
-
$this->render( 'settings-form', array(
|
423 |
-
'mode' => $mode,
|
424 |
-
'id' => $schedule_id,
|
425 |
-
'WC_Order_Export' => $this,
|
426 |
-
'ajaxurl' => $ajaxurl,
|
427 |
-
'show' => $show,
|
428 |
-
) );
|
429 |
-
|
430 |
-
return;
|
431 |
-
case 'copy_schedule':
|
432 |
-
if ( ! isset( $_REQUEST['schedule_id'] ) ) {
|
433 |
-
break;
|
434 |
-
}
|
435 |
-
$schedule_id = $_REQUEST['schedule_id'];
|
436 |
-
$schedule_id = WC_Order_Export_Manage::clone_export_settings( $mode, $schedule_id );
|
437 |
-
|
438 |
-
$url = add_query_arg( array(
|
439 |
-
'schedule_id' => $schedule_id,
|
440 |
-
'wc_oe' => 'edit_schedule',
|
441 |
-
));
|
442 |
-
|
443 |
-
$url = remove_query_arg(array('woe_nonce'), $url);
|
444 |
-
|
445 |
-
wp_redirect( $url );
|
446 |
-
|
447 |
-
return;
|
448 |
-
case 'delete_schedule':
|
449 |
-
if ( ! isset( $_REQUEST['schedule_id'] ) ) {
|
450 |
-
break;
|
451 |
-
}
|
452 |
-
$schedule_id = $_REQUEST['schedule_id'];
|
453 |
-
unset( $all_jobs[ $schedule_id ] );
|
454 |
-
WC_Order_Export_Manage::save_export_settings_collection( $mode, $all_jobs );
|
455 |
-
|
456 |
-
$url = remove_query_arg( array( 'wc_oe', 'schedule_id', 'woe_nonce' ) );
|
457 |
-
wp_redirect( $url );
|
458 |
-
|
459 |
-
break;
|
460 |
-
case 'change_status_schedule':
|
461 |
-
if ( ! isset( $_REQUEST['schedule_id'] ) ) {
|
462 |
-
break;
|
463 |
-
}
|
464 |
-
$schedule_id = $_REQUEST['schedule_id'];
|
465 |
-
$all_jobs[ $schedule_id ]['active'] = $_REQUEST['status'];
|
466 |
-
WC_Order_Export_Manage::save_export_settings_collection( $mode, $all_jobs );
|
467 |
-
$url = remove_query_arg( array( 'wc_oe', 'schedule_id', 'status', 'woe_nonce' ) );
|
468 |
-
wp_redirect( $url );
|
469 |
-
break;
|
470 |
-
case 'change_status_schedules':
|
471 |
-
if ( ! isset( $_REQUEST['chosen_schedules'] ) AND ! isset( $_REQUEST['doaction'] ) AND - 1 == $_REQUEST['doaction'] ) {
|
472 |
-
break;
|
473 |
-
}
|
474 |
-
$chosen_schedules = explode( ',', $_REQUEST['chosen_schedules'] );
|
475 |
-
$doaction = $_REQUEST['doaction'];
|
476 |
-
|
477 |
-
foreach ( $chosen_schedules as $schedule_id ) {
|
478 |
-
if ( 'activate' == $doaction ) {
|
479 |
-
$all_jobs[ $schedule_id ]['active'] = 1;
|
480 |
-
} elseif ( 'deactivate' == $doaction ) {
|
481 |
-
$all_jobs[ $schedule_id ]['active'] = 0;
|
482 |
-
} elseif ( 'delete' == $doaction ) {
|
483 |
-
unset( $all_jobs[ $schedule_id ] );
|
484 |
-
}
|
485 |
-
}
|
486 |
-
WC_Order_Export_Manage::save_export_settings_collection( $mode, $all_jobs );
|
487 |
-
$url = remove_query_arg( array( 'wc_oe', 'chosen_schedules', 'doaction', 'woe_nonce' ) );
|
488 |
-
wp_redirect( $url );
|
489 |
-
break;
|
490 |
-
}
|
491 |
-
$this->render( 'tab/schedules', array( 'ajaxurl' => $ajaxurl, 'WC_Order_Export' => $this ) );
|
492 |
-
}
|
493 |
-
|
494 |
-
public function render_tab_profiles() {
|
495 |
-
$wc_oe = isset( $_REQUEST['wc_oe'] ) ? $_REQUEST['wc_oe'] : '';
|
496 |
-
|
497 |
-
if (in_array($wc_oe, array(
|
498 |
-
'copy_profile',
|
499 |
-
'copy_profile_to_scheduled',
|
500 |
-
'copy_profile_to_actions',
|
501 |
-
'delete_profile',
|
502 |
-
'change_profile_statuses',
|
503 |
-
)) && !check_admin_referer( 'woe_nonce', 'woe_nonce' )) {
|
504 |
-
return;
|
505 |
-
}
|
506 |
-
|
507 |
-
$ajaxurl = admin_url( 'admin-ajax.php' );
|
508 |
-
$mode = WC_Order_Export_Manage::EXPORT_PROFILE;
|
509 |
-
$all_items = WC_Order_Export_Manage::get_export_settings_collection( $mode );
|
510 |
-
$show = array(
|
511 |
-
'date_filter' => true,
|
512 |
-
'export_button' => true,
|
513 |
-
'export_button_plain' => true,
|
514 |
-
'destinations' => true,
|
515 |
-
'schedule' => false,
|
516 |
-
);
|
517 |
-
switch ( $wc_oe ) {
|
518 |
-
case 'add_profile':
|
519 |
-
end( $all_items );
|
520 |
-
$next_id = key( $all_items ) + 1;
|
521 |
-
$this->render( 'settings-form', array(
|
522 |
-
'mode' => $mode,
|
523 |
-
'id' => $next_id,
|
524 |
-
'WC_Order_Export' => $this,
|
525 |
-
'ajaxurl' => $ajaxurl,
|
526 |
-
'show' => $show,
|
527 |
-
) );
|
528 |
-
|
529 |
-
return;
|
530 |
-
case 'edit_profile':
|
531 |
-
if ( ! isset( $_REQUEST['profile_id'] ) ) {
|
532 |
-
break;
|
533 |
-
}
|
534 |
-
$profile_id = $_REQUEST['profile_id'];
|
535 |
-
WC_Order_Export_Manage::$edit_existing_job = true;
|
536 |
-
$this->render( 'settings-form', array(
|
537 |
-
'mode' => $mode,
|
538 |
-
'id' => $profile_id,
|
539 |
-
'WC_Order_Export' => $this,
|
540 |
-
'ajaxurl' => $ajaxurl,
|
541 |
-
'show' => $show,
|
542 |
-
) );
|
543 |
-
|
544 |
-
return;
|
545 |
-
case 'copy_profile':
|
546 |
-
if ( ! isset( $_REQUEST['profile_id'] ) ) {
|
547 |
-
break;
|
548 |
-
}
|
549 |
-
|
550 |
-
$profile_id = $_REQUEST['profile_id'];
|
551 |
-
$profile_id = WC_Order_Export_Manage::clone_export_settings( $mode, $profile_id );
|
552 |
-
|
553 |
-
$url = add_query_arg( array(
|
554 |
-
'profile_id' => $profile_id,
|
555 |
-
'wc_oe' => 'edit_profile',
|
556 |
-
));
|
557 |
|
558 |
-
|
559 |
-
|
560 |
-
wp_redirect( $url );
|
561 |
-
|
562 |
-
return;
|
563 |
-
case 'copy_profile_to_scheduled':
|
564 |
-
$profile_id = isset( $_REQUEST['profile_id'] ) ? $_REQUEST['profile_id'] : '';
|
565 |
-
$schedule_id = WC_Order_Export_Manage::advanced_clone_export_settings( $profile_id, $mode,
|
566 |
-
WC_Order_Export_Manage::EXPORT_SCHEDULE );
|
567 |
-
$url = remove_query_arg( array('profile_id', 'woe_nonce') );
|
568 |
-
$url = add_query_arg( 'tab', 'schedules', $url );
|
569 |
-
$url = add_query_arg( 'wc_oe', 'edit_schedule', $url );
|
570 |
-
$url = add_query_arg( 'schedule_id', $schedule_id, $url );
|
571 |
-
wp_redirect( $url );
|
572 |
-
break;
|
573 |
-
case 'copy_profile_to_actions':
|
574 |
-
$profile_id = isset( $_REQUEST['profile_id'] ) ? $_REQUEST['profile_id'] : '';
|
575 |
-
$schedule_id = WC_Order_Export_Manage::advanced_clone_export_settings( $profile_id, $mode,
|
576 |
-
WC_Order_Export_Manage::EXPORT_ORDER_ACTION );
|
577 |
-
$url = remove_query_arg( array('profile_id', 'woe_nonce') );
|
578 |
-
$url = add_query_arg( 'tab', 'order_actions', $url );
|
579 |
-
$url = add_query_arg( 'wc_oe', 'edit_action', $url );
|
580 |
-
$url = add_query_arg( 'action_id', $schedule_id, $url );
|
581 |
-
wp_redirect( $url );
|
582 |
-
break;
|
583 |
-
case 'delete_profile':
|
584 |
-
if ( ! isset( $_REQUEST['profile_id'] ) ) {
|
585 |
-
break;
|
586 |
-
}
|
587 |
-
$profile_id = $_REQUEST['profile_id'];
|
588 |
-
unset( $all_items[ $profile_id ] );
|
589 |
-
WC_Order_Export_Manage::save_export_settings_collection( $mode, $all_items );
|
590 |
-
|
591 |
-
$url = remove_query_arg( array( 'wc_oe', 'profile_id', 'woe_nonce' ) );
|
592 |
-
wp_redirect( $url );
|
593 |
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
$doaction = $_REQUEST['doaction'];
|
601 |
-
|
602 |
-
foreach ( $chosen_profiles as $profile_id ) {
|
603 |
-
if ( 'activate' == $doaction ) {
|
604 |
-
$all_items[ $profile_id ]['use_as_bulk'] = 'on';
|
605 |
-
} elseif ( 'deactivate' == $doaction ) {
|
606 |
-
unset( $all_items[ $profile_id ]['use_as_bulk'] );
|
607 |
-
} elseif ( 'delete' == $doaction ) {
|
608 |
-
unset( $all_items[ $profile_id ] );
|
609 |
-
}
|
610 |
-
}
|
611 |
-
WC_Order_Export_Manage::save_export_settings_collection( $mode, $all_items );
|
612 |
-
$url = remove_query_arg( array( 'wc_oe', 'chosen_profiles', 'doaction', 'woe_nonce' ) );
|
613 |
-
wp_redirect( $url );
|
614 |
-
break;
|
615 |
-
}
|
616 |
|
617 |
-
|
618 |
-
|
619 |
-
$free_job = WC_Order_Export_Manage::get_export_settings_collection( WC_Order_Export_Manage::EXPORT_NOW );
|
620 |
-
if ( empty( $profiles ) AND ! empty( $free_job ) ) {
|
621 |
-
$free_job['title'] = __( 'Copied from "Export now"', 'woo-order-export-lite' );
|
622 |
-
$free_job['mode'] = $mode;
|
623 |
-
$profiles[1] = $free_job;
|
624 |
-
update_option( WC_Order_Export_Manage::settings_name_profiles, $profiles, false );
|
625 |
}
|
626 |
-
|
627 |
-
$this->render( 'tab/profiles', array( 'ajaxurl' => $ajaxurl, 'WC_Order_Export' => $this ) );
|
628 |
}
|
629 |
|
630 |
-
|
631 |
public function thematic_enqueue_scripts() {
|
|
|
632 |
wp_enqueue_media();
|
633 |
|
634 |
wp_enqueue_script( 'jquery-ui-datepicker' );
|
@@ -637,21 +190,22 @@ class WC_Order_Export_Admin {
|
|
637 |
wp_enqueue_script( 'jquery-touch-punch' );
|
638 |
wp_enqueue_style( 'jquery-style',
|
639 |
'//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css' );
|
640 |
-
$this->enqueue_select2_scripts();
|
641 |
|
642 |
-
|
|
|
|
|
|
|
643 |
wp_enqueue_script( 'serializejson', $this->url_plugin . 'assets/js/jquery.serializejson.js', array( 'jquery' ),
|
644 |
WOE_VERSION );
|
|
|
645 |
wp_enqueue_style( 'export', $this->url_plugin . 'assets/css/export.css', array(), WOE_VERSION );
|
|
|
646 |
wp_enqueue_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array() );
|
647 |
|
648 |
$_REQUEST['tab'] = isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : $this->settings['default_tab'];
|
|
|
649 |
if ( isset( $_REQUEST['wc_oe'] ) AND ( strpos( $_REQUEST['wc_oe'], 'add_' ) === 0 OR strpos( $_REQUEST['wc_oe'],
|
650 |
'edit_' ) === 0 ) OR $_REQUEST['tab'] == 'export' ) {
|
651 |
-
wp_enqueue_script( 'wp-color-picker' );
|
652 |
-
wp_enqueue_style( 'wp-color-picker' );
|
653 |
-
wp_enqueue_script( 'settings-form', $this->url_plugin . 'assets/js/settings-form.js', array(),
|
654 |
-
WOE_VERSION );
|
655 |
|
656 |
$localize_settings_form = array(
|
657 |
'add_fields_to_export' => __( 'Add %s fields', 'woo-order-export-lite' ),
|
@@ -679,11 +233,10 @@ class WC_Order_Export_Admin {
|
|
679 |
'coupons' => __( 'coupons', 'woo-order-export-lite' ),
|
680 |
),
|
681 |
'remove_all_fields_confirm' => __( 'Remove all fields?', 'woo-order-export-lite' ),
|
682 |
-
'reset_profile_confirm'
|
683 |
|
684 |
);
|
685 |
-
|
686 |
-
|
687 |
|
688 |
$settings_form = array(
|
689 |
'save_settings_url' => esc_url( add_query_arg(
|
@@ -695,9 +248,11 @@ class WC_Order_Export_Admin {
|
|
695 |
admin_url( 'admin.php' ) ) ),
|
696 |
|
697 |
'EXPORT_NOW' => WC_Order_Export_Manage::EXPORT_NOW,
|
|
|
698 |
'EXPORT_PROFILE' => WC_Order_Export_Manage::EXPORT_PROFILE,
|
699 |
'EXPORT_SCHEDULE' => WC_Order_Export_Manage::EXPORT_SCHEDULE,
|
700 |
'EXPORT_ORDER_ACTION' => WC_Order_Export_Manage::EXPORT_ORDER_ACTION,
|
|
|
701 |
|
702 |
'copy_to_profiles_url' => esc_url( add_query_arg(
|
703 |
array(
|
@@ -707,40 +262,54 @@ class WC_Order_Export_Admin {
|
|
707 |
),
|
708 |
admin_url( 'admin.php' ) ) ),
|
709 |
|
710 |
-
'flat_formats' => array_map('strtoupper', WC_Order_Export_Engine::get_plain_formats()),
|
711 |
'object_formats' => array( 'XML', 'JSON' ),
|
712 |
'xml_formats' => array( 'XML' ),
|
713 |
|
714 |
'day_names' => WC_Order_Export_Manage::get_days(),
|
715 |
|
|
|
|
|
|
|
716 |
);
|
717 |
|
|
|
|
|
718 |
wp_localize_script( 'settings-form', 'settings_form', $settings_form );
|
719 |
|
720 |
-
|
721 |
-
|
722 |
-
// Localize the script with new data
|
723 |
-
$translation_array = array(
|
724 |
-
'empty_column_name' => __( 'empty column name', 'woo-order-export-lite' ),
|
725 |
-
'empty_meta_key' => __( 'empty meta key', 'woo-order-export-lite' ),
|
726 |
-
'empty_meta_key_and_taxonomy' => __( 'select product field or item field or taxonomy',
|
727 |
-
'woo-order-export-lite' ),
|
728 |
-
'empty_value' => __( 'empty value', 'woo-order-export-lite' ),
|
729 |
-
'empty_title' => __( 'title is empty', 'woo-order-export-lite' ),
|
730 |
-
'wrong_date_range' => __( 'Date From is greater than Date To', 'woo-order-export-lite' ),
|
731 |
-
'no_fields' => __( 'Please, set up fields to export', 'woo-order-export-lite' ),
|
732 |
-
'no_results' => __( 'Nothing to export. Please, adjust your filters',
|
733 |
-
'woo-order-export-lite' ),
|
734 |
-
'empty' => __( 'empty', 'woo-order-export-lite' ),
|
735 |
-
);
|
736 |
-
wp_localize_script( 'export', 'export_messages', $translation_array );
|
737 |
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
742 |
|
743 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
744 |
}
|
745 |
|
746 |
private function get_select2_locale() {
|
@@ -759,11 +328,11 @@ class WC_Order_Export_Admin {
|
|
759 |
return isset( $select2_locales[ $locale ] ) ? $select2_locales[ $locale ] : 'en';
|
760 |
}
|
761 |
|
762 |
-
private function enqueue_select2_scripts() {
|
|
|
763 |
wp_enqueue_script( 'select22', $this->url_plugin . 'assets/js/select2/select2.full.js',
|
764 |
array( 'jquery' ), '4.0.3' );
|
765 |
|
766 |
-
|
767 |
if ( $select2_locale = $this->get_select2_locale() ) {
|
768 |
// enable by default
|
769 |
if ( $select2_locale !== 'en' ) {
|
@@ -772,6 +341,19 @@ class WC_Order_Export_Admin {
|
|
772 |
}
|
773 |
}
|
774 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
775 |
wp_enqueue_style( 'select2-css', $this->url_plugin . 'assets/css/select2/select2.min.css',
|
776 |
array(), WC_VERSION );
|
777 |
}
|
@@ -800,113 +382,53 @@ class WC_Order_Export_Admin {
|
|
800 |
}
|
801 |
}
|
802 |
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
return trim( $name );
|
811 |
-
}, $arr_name );
|
812 |
-
$arr_name = array_filter( $arr_name );
|
813 |
-
|
814 |
-
foreach ( $arr_name as $value ) {
|
815 |
-
$arr = isset( $arr[ $value ] ) ? $arr[ $value ] : "";
|
816 |
}
|
817 |
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
//on status change
|
822 |
-
public function wc_order_status_changed( $order_id, $old_status, $new_status ) {
|
823 |
-
global $wp_filter;
|
824 |
-
|
825 |
-
$all_items = get_option( WC_Order_Export_Manage::settings_name_actions, array() );
|
826 |
-
if ( empty( $all_items ) ) {
|
827 |
-
return;
|
828 |
}
|
829 |
-
$old_status = is_string( $old_status ) && strpos( $old_status, 'wc-' ) !== 0 ? "wc-{$old_status}" : $old_status;
|
830 |
-
$new_status = is_string( $new_status ) && strpos( $new_status, 'wc-' ) !== 0 ? "wc-{$new_status}" : $new_status;
|
831 |
|
832 |
-
$
|
833 |
-
|
834 |
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
$item = WC_Order_Export_Manage::get( WC_Order_Export_Manage::EXPORT_ORDER_ACTION, $key );
|
840 |
-
if ( isset( $item['active'] ) && ! $item['active'] ) {
|
841 |
-
continue;
|
842 |
}
|
843 |
-
// use empty for ANY status
|
844 |
-
if ( ( empty( $item['from_status'] ) OR in_array( $old_status, $item['from_status'] ) )
|
845 |
-
AND
|
846 |
-
( empty( $item['to_status'] ) OR in_array( $new_status, $item['to_status'] ) )
|
847 |
-
) {
|
848 |
-
$filters = $wp_filter;//remember hooks/filters
|
849 |
-
do_action( 'woe_order_action_started', $order_id, $item );
|
850 |
-
$result = WC_Order_Export_Engine::build_files_and_export( $item );
|
851 |
-
$output = sprintf( __( 'Status change job #%s for order #%s. Result: %s', 'woo-order-export-lite' ),
|
852 |
-
$key, $order_id, $result );
|
853 |
-
// log if required
|
854 |
-
if ( $logger AND ! empty( $item['log_results'] ) ) {
|
855 |
-
$logger->info( $output, $logger_context );
|
856 |
-
}
|
857 |
|
858 |
-
|
859 |
-
|
860 |
-
}
|
861 |
}
|
862 |
-
remove_filter( 'woe_sql_get_order_ids_where', array( $this, "filter_by_changed_order" ), 10 );
|
863 |
-
}
|
864 |
-
|
865 |
-
public function filter_by_changed_order( $where, $settings ) {
|
866 |
-
$where[] = "orders.ID = " . $this->changed_order_id;
|
867 |
|
868 |
-
|
869 |
-
|
|
|
870 |
|
871 |
-
|
872 |
-
|
873 |
-
public function ajax_gate() {
|
874 |
-
if ( isset( $_REQUEST['method'] ) ) {
|
875 |
-
$method = $_REQUEST['method'];
|
876 |
-
if ( method_exists( 'WC_Order_Export_Ajax', $method ) ) {
|
877 |
-
|
878 |
-
if ($_POST && !check_admin_referer( 'woe_nonce', 'woe_nonce' )) {
|
879 |
-
return;
|
880 |
-
}
|
881 |
-
|
882 |
-
$_POST = stripslashes_deep( $_POST );
|
883 |
-
// parse json to arrays?
|
884 |
-
if ( ! empty( $_POST['json'] ) ) {
|
885 |
-
$json = json_decode( $_POST['json'], true );
|
886 |
-
if ( is_array( $json ) ) {
|
887 |
-
// add $_POST['settings'],$_POST['orders'],$_POST['products'],$_POST['coupons']
|
888 |
-
$_POST = $_POST + $json;
|
889 |
-
unset( $_POST['json'] );
|
890 |
-
}
|
891 |
-
}
|
892 |
-
$ajax = new WC_Order_Export_Ajax();
|
893 |
-
$ajax->$method();
|
894 |
-
}
|
895 |
}
|
896 |
-
die();
|
897 |
-
}
|
898 |
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
$
|
907 |
-
$
|
908 |
}
|
909 |
}
|
|
|
|
|
|
|
910 |
die();
|
911 |
}
|
912 |
|
@@ -927,28 +449,20 @@ class WC_Order_Export_Admin {
|
|
927 |
$actions['woe_unmark_exported'] = __( 'Unmark exported', 'woo-order-export-lite' );
|
928 |
}
|
929 |
|
930 |
-
$all_items = WC_Order_Export_Manage::get_export_settings_collection( WC_Order_Export_Manage::EXPORT_PROFILE );
|
931 |
-
foreach ( $all_items as $job_id => $job ) {
|
932 |
-
if ( isset( $job['use_as_bulk'] ) ) {
|
933 |
-
$actions[ 'woe_export_selected_orders_profile_' . $job_id ] = sprintf( __( "Export as profile '%s'",
|
934 |
-
'woo-order-export-lite' ), $job['title'] );
|
935 |
-
}
|
936 |
-
}
|
937 |
-
|
938 |
return $actions;
|
939 |
}
|
940 |
|
941 |
function export_orders_bulk_action_process( $redirect_to, $action, $ids ) {
|
|
|
942 |
switch ( $action ) {
|
943 |
case 'woe_export_selected_orders':
|
944 |
-
$
|
945 |
-
$redirect_to );
|
946 |
break;
|
947 |
case 'woe_mark_exported':
|
948 |
foreach ( $ids as $post_id ) {
|
949 |
update_post_meta( $post_id, 'woe_order_exported', 1 );
|
950 |
}
|
951 |
-
$
|
952 |
'woe_bulk_mark_exported' => count( $ids ),
|
953 |
'woe_bulk_unmark_exported' => false,
|
954 |
), $redirect_to );
|
@@ -957,47 +471,26 @@ class WC_Order_Export_Admin {
|
|
957 |
foreach ( $ids as $post_id ) {
|
958 |
delete_post_meta( $post_id, 'woe_order_exported' );
|
959 |
}
|
960 |
-
$
|
961 |
'woe_bulk_mark_exported' => false,
|
962 |
'woe_bulk_unmark_exported' => count( $ids ),
|
963 |
), $redirect_to );
|
964 |
break;
|
965 |
-
default:
|
966 |
-
if ( preg_match( '/woe_export_selected_orders_profile_(\d+)/', $action, $matches ) ) {
|
967 |
-
if ( isset( $matches[1] ) ) {
|
968 |
-
$id = $matches[1];
|
969 |
-
$redirect_to = add_query_arg( array( 'export_bulk_profile' => $id, 'ids' => join( ',', $ids ) ),
|
970 |
-
$redirect_to );
|
971 |
-
break;
|
972 |
-
}
|
973 |
-
}
|
974 |
-
|
975 |
-
//do nothing
|
976 |
-
return $redirect_to;
|
977 |
}
|
978 |
|
979 |
-
|
980 |
-
|
|
|
|
|
|
|
|
|
981 |
}
|
982 |
|
983 |
function export_orders_bulk_action_notices() {
|
984 |
|
985 |
global $post_type, $pagenow;
|
986 |
|
987 |
-
if ( $pagenow == 'edit.php' && $post_type == 'shop_order' && isset( $_REQUEST['
|
988 |
-
$url = admin_url( 'admin-ajax.php' ) . "?action=order_exporter&method=export_download_bulk_file&export_bulk_profile=" . $_REQUEST['export_bulk_profile'] . "&ids=" . $_REQUEST['ids'];
|
989 |
-
wp_redirect( $url );
|
990 |
-
exit();
|
991 |
-
/* unused code
|
992 |
-
//$message = sprintf( __( 'Orders exported. <a href="%s">Download report.</a>' ,'woo-order-export-lite'), $url );
|
993 |
-
$message = __( 'Orders exported.','woo-order-export-lite');
|
994 |
-
|
995 |
-
echo "<div class='updated'><p>{$message}</p></div><iframe width=0 height=0 style='display:none' src='$url'></iframe>";
|
996 |
-
|
997 |
-
// must remove this arg from pagination url
|
998 |
-
add_filter('removable_query_args', array($this, 'fix_table_links') );
|
999 |
-
*/
|
1000 |
-
} else if ( $pagenow == 'edit.php' && $post_type == 'shop_order' && isset( $_REQUEST['woe_bulk_mark_exported'] ) ) {
|
1001 |
$count = intval( $_REQUEST['woe_bulk_mark_exported'] );
|
1002 |
printf(
|
1003 |
'<div id="message" class="updated fade">' .
|
@@ -1017,13 +510,6 @@ class WC_Order_Export_Admin {
|
|
1017 |
}
|
1018 |
}
|
1019 |
|
1020 |
-
function fix_table_links( $args ) {
|
1021 |
-
$args[] = 'export_bulk_profile';
|
1022 |
-
$args[] = 'ids';
|
1023 |
-
|
1024 |
-
return $args;
|
1025 |
-
}
|
1026 |
-
|
1027 |
function must_run_ajax_methods() {
|
1028 |
// wait admin ajax!
|
1029 |
$script_name = ! empty( $_SERVER['SCRIPT_NAME'] ) ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF'];
|
@@ -1035,10 +521,6 @@ class WC_Order_Export_Admin {
|
|
1035 |
return isset( $_REQUEST['action'] ) AND ( $_REQUEST['action'] == "order_exporter" OR $_REQUEST['action'] == "order_exporter_run" );
|
1036 |
}
|
1037 |
|
1038 |
-
public static function is_full_version() {
|
1039 |
-
return defined( 'WOE_STORE_URL' );
|
1040 |
-
}
|
1041 |
-
|
1042 |
public static function user_can_add_custom_php() {
|
1043 |
return apply_filters( 'woe_user_can_add_custom_php', current_user_can( 'edit_themes' ) );
|
1044 |
}
|
4 |
}
|
5 |
|
6 |
class WC_Order_Export_Admin {
|
7 |
+
|
8 |
var $activation_notice_option = 'woocommerce-order-export-activation-notice-shown';
|
9 |
var $step = 30;
|
10 |
+
public static $formats = array( 'XLS', 'CSV', 'XML', 'JSON', 'TSV', 'PDF', 'HTML' );
|
11 |
public static $export_types = array( 'EMAIL', 'FTP', 'HTTP', 'FOLDER', 'SFTP', 'ZAPIER' );
|
12 |
public $url_plugin;
|
13 |
public $path_plugin;
|
14 |
+
|
15 |
+
protected $tabs;
|
16 |
|
17 |
public function __construct() {
|
18 |
$this->url_plugin = dirname( plugin_dir_url( __FILE__ ) ) . '/';
|
21 |
|
22 |
if ( is_admin() ) { // admin actions
|
23 |
add_action( 'admin_menu', array( $this, 'add_menu' ) );
|
24 |
+
|
25 |
// load scripts on our pages only
|
26 |
if ( isset( $_GET['page'] ) && $_GET['page'] == 'wc-order-export' ) {
|
27 |
add_action( 'admin_enqueue_scripts', array( $this, 'thematic_enqueue_scripts' ) );
|
28 |
add_filter( 'script_loader_src', array( $this, 'script_loader_src' ), 999, 2 );
|
29 |
}
|
30 |
+
|
31 |
+
add_action( 'wp_loaded' , function() { //init tabs after loading text domains!
|
32 |
+
$this->tabs = $this->get_tabs();
|
33 |
+
});
|
34 |
+
|
35 |
add_action( 'wp_ajax_order_exporter', array( $this, 'ajax_gate' ) );
|
36 |
|
37 |
//Add custom bulk export action in Woocomerce orders Table, modified for WP 4.7
|
38 |
add_filter( 'bulk_actions-edit-shop_order', array( $this, 'export_orders_bulk_action' ) );
|
39 |
+
add_filter( 'handle_bulk_actions-edit-shop_order', array(
|
40 |
+
$this,
|
41 |
+
'export_orders_bulk_action_process',
|
42 |
+
), 10, 3 );
|
43 |
add_action( 'admin_notices', array( $this, 'export_orders_bulk_action_notices' ) );
|
44 |
+
|
45 |
//do once
|
46 |
if ( ! get_option( $this->activation_notice_option ) ) {
|
47 |
add_action( 'admin_notices', array( $this, 'display_plugin_activated_message' ) );
|
56 |
// Add 'Export Status' orders page column content
|
57 |
add_action( 'manage_shop_order_posts_custom_column', array( $this, 'add_order_status_column_content' ) );
|
58 |
|
59 |
+
// Style for 'Export Status' column
|
60 |
if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == 'shop_order' ) {
|
61 |
add_action( 'admin_print_styles', array( $this, 'add_order_status_column_style' ) );
|
62 |
}
|
63 |
}
|
64 |
|
65 |
+
$this->settings = WC_Order_Export_Main_Settings::get_settings();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
+
do_action( 'woe_order_export_admin_init', $this );
|
68 |
+
}
|
69 |
+
|
70 |
+
public function get_tabs() {
|
71 |
+
|
72 |
+
$tabs = array(
|
73 |
+
WC_Order_Export_Admin_Tab_Export_Now::get_key() => new WC_Order_Export_Admin_Tab_Export_Now(),
|
74 |
+
WC_Order_Export_Admin_Tab_Profiles::get_key() => new WC_Order_Export_Admin_Tab_Profiles(),
|
75 |
+
WC_Order_Export_Admin_Tab_Status_Change_Jobs::get_key() => new WC_Order_Export_Admin_Tab_Status_Change_Jobs(),
|
76 |
+
WC_Order_Export_Admin_Tab_Schedule_Jobs::get_key() => new WC_Order_Export_Admin_Tab_Schedule_Jobs(),
|
77 |
+
WC_Order_Export_Admin_Tab_Tools::get_key() => new WC_Order_Export_Admin_Tab_Tools(),
|
78 |
+
WC_Order_Export_Admin_Tab_Help::get_key() => new WC_Order_Export_Admin_Tab_Help(),
|
79 |
+
);
|
80 |
+
|
81 |
+
return apply_filters( 'woe_order_export_admin_tabs', $tabs );
|
82 |
}
|
83 |
|
84 |
public function add_order_status_column_header( $columns ) {
|
122 |
wp_add_inline_style( 'woocommerce_admin_styles', $css );
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
public function display_plugin_activated_message() {
|
126 |
?>
|
127 |
<div class="notice notice-success is-dismissible">
|
147 |
public function deactivate() {
|
148 |
wp_clear_scheduled_hook( "wc_export_cron_global" );
|
149 |
delete_option( $this->activation_notice_option );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
|
152 |
public function add_menu() {
|
165 |
}
|
166 |
|
167 |
public function render_menu() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
+
$active_tab = isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : $this->settings['default_tab'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
+
$this->render( 'main', array(
|
172 |
+
'WC_Order_Export' => $this,
|
173 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
174 |
+
'tabs' => $this->tabs,
|
175 |
+
'active_tab' => $active_tab,
|
176 |
+
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
+
if ( isset( $this->tabs[ $active_tab ] ) ) {
|
179 |
+
$this->tabs[ $active_tab ]->render();
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
}
|
|
|
|
|
181 |
}
|
182 |
|
|
|
183 |
public function thematic_enqueue_scripts() {
|
184 |
+
|
185 |
wp_enqueue_media();
|
186 |
|
187 |
wp_enqueue_script( 'jquery-ui-datepicker' );
|
190 |
wp_enqueue_script( 'jquery-touch-punch' );
|
191 |
wp_enqueue_style( 'jquery-style',
|
192 |
'//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css' );
|
|
|
193 |
|
194 |
+
$active_tab = isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : $this->settings['default_tab'];
|
195 |
+
|
196 |
+
$this->enqueue_select2_scripts( $active_tab );
|
197 |
+
|
198 |
wp_enqueue_script( 'serializejson', $this->url_plugin . 'assets/js/jquery.serializejson.js', array( 'jquery' ),
|
199 |
WOE_VERSION );
|
200 |
+
|
201 |
wp_enqueue_style( 'export', $this->url_plugin . 'assets/css/export.css', array(), WOE_VERSION );
|
202 |
+
|
203 |
wp_enqueue_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array() );
|
204 |
|
205 |
$_REQUEST['tab'] = isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : $this->settings['default_tab'];
|
206 |
+
|
207 |
if ( isset( $_REQUEST['wc_oe'] ) AND ( strpos( $_REQUEST['wc_oe'], 'add_' ) === 0 OR strpos( $_REQUEST['wc_oe'],
|
208 |
'edit_' ) === 0 ) OR $_REQUEST['tab'] == 'export' ) {
|
|
|
|
|
|
|
|
|
209 |
|
210 |
$localize_settings_form = array(
|
211 |
'add_fields_to_export' => __( 'Add %s fields', 'woo-order-export-lite' ),
|
233 |
'coupons' => __( 'coupons', 'woo-order-export-lite' ),
|
234 |
),
|
235 |
'remove_all_fields_confirm' => __( 'Remove all fields?', 'woo-order-export-lite' ),
|
236 |
+
'reset_profile_confirm' => __( 'This action will reset filters, settings and fields to default state. Are you sure?', 'woo-order-export-lite' ),
|
237 |
|
238 |
);
|
239 |
+
$settings = WC_Order_Export_Main_Settings::get_settings();
|
|
|
240 |
|
241 |
$settings_form = array(
|
242 |
'save_settings_url' => esc_url( add_query_arg(
|
248 |
admin_url( 'admin.php' ) ) ),
|
249 |
|
250 |
'EXPORT_NOW' => WC_Order_Export_Manage::EXPORT_NOW,
|
251 |
+
// TODO start - replace later
|
252 |
'EXPORT_PROFILE' => WC_Order_Export_Manage::EXPORT_PROFILE,
|
253 |
'EXPORT_SCHEDULE' => WC_Order_Export_Manage::EXPORT_SCHEDULE,
|
254 |
'EXPORT_ORDER_ACTION' => WC_Order_Export_Manage::EXPORT_ORDER_ACTION,
|
255 |
+
// end - replace later
|
256 |
|
257 |
'copy_to_profiles_url' => esc_url( add_query_arg(
|
258 |
array(
|
262 |
),
|
263 |
admin_url( 'admin.php' ) ) ),
|
264 |
|
265 |
+
'flat_formats' => array_map( 'strtoupper', WC_Order_Export_Engine::get_plain_formats() ),
|
266 |
'object_formats' => array( 'XML', 'JSON' ),
|
267 |
'xml_formats' => array( 'XML' ),
|
268 |
|
269 |
'day_names' => WC_Order_Export_Manage::get_days(),
|
270 |
|
271 |
+
'woe_nonce' => wp_create_nonce( 'woe_nonce' ),
|
272 |
+
'woe_active_tab' => $active_tab,
|
273 |
+
'settings' => $settings,
|
274 |
);
|
275 |
|
276 |
+
wp_enqueue_script( 'settings-form', $this->url_plugin . 'assets/js/settings-form.js', array(), WOE_VERSION );
|
277 |
+
|
278 |
wp_localize_script( 'settings-form', 'settings_form', $settings_form );
|
279 |
|
280 |
+
wp_localize_script( 'settings-form', 'localize_settings_form', $localize_settings_form );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
282 |
+
// Localize the script with new data
|
283 |
+
$translation_array = array(
|
284 |
+
'empty_column_name' => __( 'empty column name', 'woo-order-export-lite' ),
|
285 |
+
'empty_meta_key' => __( 'empty meta key', 'woo-order-export-lite' ),
|
286 |
+
'empty_meta_key_and_taxonomy' => __( 'select product field or item field or taxonomy',
|
287 |
+
'woo-order-export-lite' ),
|
288 |
+
'empty_value' => __( 'empty value', 'woo-order-export-lite' ),
|
289 |
+
'empty_title' => __( 'title is empty', 'woo-order-export-lite' ),
|
290 |
+
'wrong_date_range' => __( 'Date From is greater than Date To', 'woo-order-export-lite' ),
|
291 |
+
'no_fields' => __( 'Please, set up fields to export', 'woo-order-export-lite' ),
|
292 |
+
'no_results' => __( 'Nothing to export. Please, adjust your filters',
|
293 |
+
'woo-order-export-lite' ),
|
294 |
+
'empty' => __( 'empty', 'woo-order-export-lite' ),
|
295 |
+
);
|
296 |
+
|
297 |
+
wp_localize_script( 'settings-form', 'export_messages', $translation_array );
|
298 |
+
|
299 |
+
wp_enqueue_script( 'woe_filters', $this->url_plugin . 'assets/js/filters.js', array(), WOE_VERSION );
|
300 |
|
301 |
+
wp_enqueue_script( 'woe_buttons', $this->url_plugin . 'assets/js/buttons.js', array(), WOE_VERSION );
|
302 |
+
|
303 |
+
wp_enqueue_script( 'woe_export_fields', $this->url_plugin . 'assets/js/export-fields.js', array(), WOE_VERSION );
|
304 |
+
|
305 |
+
wp_enqueue_script( 'wp-color-picker' );
|
306 |
+
|
307 |
+
wp_enqueue_style( 'wp-color-picker' );
|
308 |
+
|
309 |
+
do_action( 'woe_thematic_enqueue_scripts_settings_form' );
|
310 |
+
}
|
311 |
+
|
312 |
+
do_action( 'woe_thematic_enqueue_scripts' );
|
313 |
}
|
314 |
|
315 |
private function get_select2_locale() {
|
328 |
return isset( $select2_locales[ $locale ] ) ? $select2_locales[ $locale ] : 'en';
|
329 |
}
|
330 |
|
331 |
+
private function enqueue_select2_scripts( $active_tab ) {
|
332 |
+
|
333 |
wp_enqueue_script( 'select22', $this->url_plugin . 'assets/js/select2/select2.full.js',
|
334 |
array( 'jquery' ), '4.0.3' );
|
335 |
|
|
|
336 |
if ( $select2_locale = $this->get_select2_locale() ) {
|
337 |
// enable by default
|
338 |
if ( $select2_locale !== 'en' ) {
|
341 |
}
|
342 |
}
|
343 |
|
344 |
+
wp_enqueue_script( 'select2-i18n', $this->url_plugin . 'assets/js/select2-i18n.js', array(
|
345 |
+
'jquery',
|
346 |
+
'select22',
|
347 |
+
), WOE_VERSION );
|
348 |
+
|
349 |
+
$script_data = array(
|
350 |
+
'locale' => get_locale(),
|
351 |
+
'select2_locale' => $this->get_select2_locale(),
|
352 |
+
'active_tab' => $active_tab,
|
353 |
+
);
|
354 |
+
|
355 |
+
wp_localize_script( 'select2-i18n', 'script_data', $script_data );
|
356 |
+
|
357 |
wp_enqueue_style( 'select2-css', $this->url_plugin . 'assets/css/select2/select2.min.css',
|
358 |
array(), WC_VERSION );
|
359 |
}
|
382 |
}
|
383 |
}
|
384 |
|
385 |
+
// AJAX part
|
386 |
+
// calls ajax_action_XXXX
|
387 |
+
public function ajax_gate() {
|
388 |
+
|
389 |
+
if( !current_user_can('view_woocommerce_reports') ){
|
390 |
+
die( __( 'You can not do it', 'woo-order-export-lite' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
}
|
392 |
|
393 |
+
if ( ! isset( $_REQUEST['method'] ) ) {
|
394 |
+
die( __( 'Empty method', 'woo-order-export-lite' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
}
|
|
|
|
|
396 |
|
397 |
+
$method = 'ajax_' . $_REQUEST['method'];
|
398 |
+
$tab = isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : false;
|
399 |
|
400 |
+
if ( ! isset( $this->tabs[ $tab ] ) ) {
|
401 |
+
$ajax_handler = apply_filters( 'woe_global_ajax_handler', new WC_Order_Export_Ajax() );
|
402 |
+
if ( ! method_exists( $ajax_handler, $method ) ) {
|
403 |
+
die( sprintf( __( 'Unknown AJAX method %s', 'woo-order-export-lite' ), $method) );
|
|
|
|
|
|
|
404 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
|
406 |
+
$ajax_handler->$method();
|
407 |
+
die();
|
|
|
408 |
}
|
|
|
|
|
|
|
|
|
|
|
409 |
|
410 |
+
if ( ! method_exists( $this->tabs[ $tab ], $method ) ) {
|
411 |
+
die( sprintf( __( 'Unknown tab method %s', 'woo-order-export-lite' ), $method) );
|
412 |
+
}
|
413 |
|
414 |
+
if ( $_POST && ! check_admin_referer( 'woe_nonce', 'woe_nonce' ) ) {
|
415 |
+
die( __( 'Wrong nonce', 'woo-order-export-lite' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
416 |
}
|
|
|
|
|
417 |
|
418 |
+
$_POST = stripslashes_deep( $_POST );
|
419 |
+
|
420 |
+
// parse json to arrays?
|
421 |
+
if ( ! empty( $_POST['json'] ) ) {
|
422 |
+
$json = json_decode( $_POST['json'], true );
|
423 |
+
if ( is_array( $json ) ) {
|
424 |
+
// add $_POST['settings'],$_POST['orders'],$_POST['products'],$_POST['coupons']
|
425 |
+
$_POST = $_POST + $json;
|
426 |
+
unset( $_POST['json'] );
|
427 |
}
|
428 |
}
|
429 |
+
|
430 |
+
$this->tabs[ $tab ]->$method();
|
431 |
+
|
432 |
die();
|
433 |
}
|
434 |
|
449 |
$actions['woe_unmark_exported'] = __( 'Unmark exported', 'woo-order-export-lite' );
|
450 |
}
|
451 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
return $actions;
|
453 |
}
|
454 |
|
455 |
function export_orders_bulk_action_process( $redirect_to, $action, $ids ) {
|
456 |
+
$new_redirect_to = false;
|
457 |
switch ( $action ) {
|
458 |
case 'woe_export_selected_orders':
|
459 |
+
$new_redirect_to = admin_url( 'admin-ajax.php' ) . "?action=order_exporter&method=export_download_bulk_file&export_bulk_profile=now&ids=" . join( ',', $ids );
|
|
|
460 |
break;
|
461 |
case 'woe_mark_exported':
|
462 |
foreach ( $ids as $post_id ) {
|
463 |
update_post_meta( $post_id, 'woe_order_exported', 1 );
|
464 |
}
|
465 |
+
$new_redirect_to = add_query_arg( array(
|
466 |
'woe_bulk_mark_exported' => count( $ids ),
|
467 |
'woe_bulk_unmark_exported' => false,
|
468 |
), $redirect_to );
|
471 |
foreach ( $ids as $post_id ) {
|
472 |
delete_post_meta( $post_id, 'woe_order_exported' );
|
473 |
}
|
474 |
+
$new_redirect_to = add_query_arg( array(
|
475 |
'woe_bulk_mark_exported' => false,
|
476 |
'woe_bulk_unmark_exported' => count( $ids ),
|
477 |
), $redirect_to );
|
478 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
}
|
480 |
|
481 |
+
if ( $new_redirect_to ) {
|
482 |
+
wp_redirect( $new_redirect_to );
|
483 |
+
exit();
|
484 |
+
}
|
485 |
+
|
486 |
+
return $redirect_to;
|
487 |
}
|
488 |
|
489 |
function export_orders_bulk_action_notices() {
|
490 |
|
491 |
global $post_type, $pagenow;
|
492 |
|
493 |
+
if ( $pagenow == 'edit.php' && $post_type == 'shop_order' && isset( $_REQUEST['woe_bulk_mark_exported'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
$count = intval( $_REQUEST['woe_bulk_mark_exported'] );
|
495 |
printf(
|
496 |
'<div id="message" class="updated fade">' .
|
510 |
}
|
511 |
}
|
512 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
function must_run_ajax_methods() {
|
514 |
// wait admin ajax!
|
515 |
$script_name = ! empty( $_SERVER['SCRIPT_NAME'] ) ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF'];
|
521 |
return isset( $_REQUEST['action'] ) AND ( $_REQUEST['action'] == "order_exporter" OR $_REQUEST['action'] == "order_exporter_run" );
|
522 |
}
|
523 |
|
|
|
|
|
|
|
|
|
524 |
public static function user_can_add_custom_php() {
|
525 |
return apply_filters( 'woe_user_can_add_custom_php', current_user_can( 'edit_themes' ) );
|
526 |
}
|
classes/core/class-wc-order-export-data-extractor-ui.php
CHANGED
@@ -31,48 +31,31 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
31 |
$where_users = '';
|
32 |
}
|
33 |
$user_fields = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->usermeta} $where_users" );
|
34 |
-
$
|
35 |
} else {
|
36 |
$user_fields = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->posts} INNER JOIN {$wpdb->usermeta} ON {$wpdb->posts}.post_author = {$wpdb->usermeta}.user_id WHERE post_type = '" . self::$object_type . "' {$sql_in_orders}" );
|
37 |
-
$
|
38 |
}
|
39 |
|
40 |
foreach ( $user_fields as $k => $v ) {
|
41 |
$user_fields[ $k ] = 'USER_' . $v;
|
42 |
}
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
//debug set_transient( $transient_key, $fields, 60 ); //valid for a 1 min
|
46 |
}
|
47 |
|
48 |
return apply_filters( 'woe_get_all_order_custom_meta_fields', $fields );
|
49 |
}
|
50 |
|
51 |
-
//filter attributes by matched orders
|
52 |
-
public static function get_all_product_custom_meta_fields_for_orders( $sql_order_ids ) {
|
53 |
-
global $wpdb;
|
54 |
-
|
55 |
-
$wc_fields = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE order_item_id IN
|
56 |
-
(SELECT DISTINCT order_item_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'line_item' AND order_id IN ($sql_order_ids))" );
|
57 |
-
|
58 |
-
// WC internal table add attributes
|
59 |
-
$wc_attr_fields = $wpdb->get_results( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies" );
|
60 |
-
foreach ( $wc_attr_fields as $f ) {
|
61 |
-
$wc_fields[] = 'pa_' . $f->attribute_name;
|
62 |
-
}
|
63 |
-
|
64 |
-
//sql to gather product id for orders
|
65 |
-
$sql_products = "SELECT DISTINCT meta_value FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE meta_key ='_product_id' AND order_item_id IN
|
66 |
-
(SELECT DISTINCT order_item_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'line_item' AND order_id IN ($sql_order_ids))";
|
67 |
-
|
68 |
-
$wp_fields = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} WHERE post_id IN
|
69 |
-
(SELECT DISTINCT ID FROM {$wpdb->posts} WHERE post_type IN ('product','product_variation') AND ID IN ($sql_products))" );
|
70 |
-
|
71 |
-
$fields = array_unique( array_merge( $wp_fields, $wc_fields ) );
|
72 |
-
$fields = sort( $fields );
|
73 |
-
|
74 |
-
return apply_filters( 'get_all_product_custom_meta_fields_for_orders', $fields );
|
75 |
-
}
|
76 |
|
77 |
public static function get_order_item_custom_meta_fields_for_orders( $sql_order_ids ) {
|
78 |
global $wpdb;
|
@@ -98,10 +81,13 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
98 |
$sql_products = "SELECT DISTINCT meta_value FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE meta_key ='_product_id' AND order_item_id IN
|
99 |
(SELECT DISTINCT order_item_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'line_item' AND order_id IN ($sql_order_ids))";
|
100 |
|
101 |
-
$
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
105 |
|
106 |
return apply_filters( 'get_product_custom_meta_fields_for_orders', $wp_fields );
|
107 |
}
|
@@ -153,7 +139,7 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
153 |
ORDER BY post.post_title
|
154 |
LIMIT " . intval( $limit );
|
155 |
|
156 |
-
$products = $wpdb->get_results( $wpdb->prepare($query, '%'
|
157 |
foreach ( $products as $key => $product ) {
|
158 |
if ( $product->photo_id ) {
|
159 |
$photo = wp_get_attachment_image_src( $product->photo_id, 'thumbnail' );
|
@@ -197,7 +183,7 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
197 |
LIMIT 0,10
|
198 |
";
|
199 |
|
200 |
-
return $wpdb->get_results( $wpdb->prepare($query, '%'
|
201 |
}
|
202 |
|
203 |
public static function get_categories_like( $like ) {
|
@@ -510,6 +496,11 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
510 |
'checked' => 0,
|
511 |
'format' => 'string',
|
512 |
),
|
|
|
|
|
|
|
|
|
|
|
513 |
'image_url' => array(
|
514 |
'label' => __( 'Image URL', 'woo-order-export-lite' ),
|
515 |
'checked' => 0,
|
@@ -545,6 +536,11 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
545 |
'checked' => 0,
|
546 |
'format' => 'money',
|
547 |
),
|
|
|
|
|
|
|
|
|
|
|
548 |
);
|
549 |
|
550 |
foreach ( $map as $key => $value ) {
|
@@ -702,6 +698,11 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
702 |
'checked' => 0,
|
703 |
'format' => 'string',
|
704 |
),
|
|
|
|
|
|
|
|
|
|
|
705 |
);
|
706 |
}
|
707 |
|
@@ -742,57 +743,67 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
742 |
'checked' => 0,
|
743 |
'format' => 'number',
|
744 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
);
|
746 |
}
|
747 |
|
748 |
public static function get_order_fields_billing() {
|
749 |
return array(
|
750 |
-
'billing_first_name'
|
751 |
'label' => __( 'First Name (Billing)', 'woo-order-export-lite' ),
|
752 |
'checked' => 1,
|
753 |
'format' => 'string',
|
754 |
),
|
755 |
-
'billing_last_name'
|
756 |
'label' => __( 'Last Name (Billing)', 'woo-order-export-lite' ),
|
757 |
'checked' => 1,
|
758 |
'format' => 'string',
|
759 |
),
|
760 |
-
'billing_full_name'
|
761 |
'label' => __( 'Full Name (Billing)', 'woo-order-export-lite' ),
|
762 |
'checked' => 0,
|
763 |
'format' => 'string',
|
764 |
),
|
765 |
-
'billing_company'
|
766 |
'label' => __( 'Company (Billing)', 'woo-order-export-lite' ),
|
767 |
'checked' => 1,
|
768 |
'format' => 'string',
|
769 |
),
|
770 |
-
'billing_address'
|
771 |
'label' => __( 'Address 1&2 (Billing)', 'woo-order-export-lite' ),
|
772 |
'checked' => 1,
|
773 |
'format' => 'string',
|
774 |
),
|
775 |
-
'billing_address_1'
|
776 |
'label' => __( 'Address 1 (Billing)', 'woo-order-export-lite' ),
|
777 |
'checked' => 0,
|
778 |
'format' => 'string',
|
779 |
),
|
780 |
-
'billing_address_2'
|
781 |
'label' => __( 'Address 2 (Billing)', 'woo-order-export-lite' ),
|
782 |
'checked' => 0,
|
783 |
'format' => 'string',
|
784 |
),
|
785 |
-
'billing_city'
|
786 |
'label' => __( 'City (Billing)', 'woo-order-export-lite' ),
|
787 |
'checked' => 1,
|
788 |
'format' => 'string',
|
789 |
),
|
790 |
-
'billing_state'
|
791 |
'label' => __( 'State Code (Billing)', 'woo-order-export-lite' ),
|
792 |
'checked' => 1,
|
793 |
'format' => 'string',
|
794 |
),
|
795 |
-
'billing_citystatezip'
|
796 |
'label' => __( 'City, State, Zip (Billing)', 'woo-order-export-lite' ),
|
797 |
'checked' => 0,
|
798 |
'format' => 'string',
|
@@ -802,32 +813,32 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
802 |
'checked' => 0,
|
803 |
'format' => 'string',
|
804 |
),
|
805 |
-
'billing_state_full'
|
806 |
'label' => __( 'State Name (Billing)', 'woo-order-export-lite' ),
|
807 |
'checked' => 0,
|
808 |
'format' => 'string',
|
809 |
),
|
810 |
-
'billing_postcode'
|
811 |
'label' => __( 'Postcode (Billing)', 'woo-order-export-lite' ),
|
812 |
'checked' => 1,
|
813 |
'format' => 'string',
|
814 |
),
|
815 |
-
'billing_country'
|
816 |
'label' => __( 'Country Code (Billing)', 'woo-order-export-lite' ),
|
817 |
'checked' => 1,
|
818 |
'format' => 'string',
|
819 |
),
|
820 |
-
'billing_country_full'
|
821 |
'label' => __( 'Country Name (Billing)', 'woo-order-export-lite' ),
|
822 |
'checked' => 0,
|
823 |
'format' => 'string',
|
824 |
),
|
825 |
-
'billing_email'
|
826 |
'label' => __( 'Email (Billing)', 'woo-order-export-lite' ),
|
827 |
'checked' => 1,
|
828 |
'format' => 'string',
|
829 |
),
|
830 |
-
'billing_phone'
|
831 |
'label' => __( 'Phone (Billing)', 'woo-order-export-lite' ),
|
832 |
'checked' => 1,
|
833 |
'format' => 'string',
|
@@ -837,52 +848,52 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
837 |
|
838 |
public static function get_order_fields_shipping() {
|
839 |
return array(
|
840 |
-
'shipping_first_name'
|
841 |
'label' => __( 'First Name (Shipping)', 'woo-order-export-lite' ),
|
842 |
'checked' => 1,
|
843 |
'format' => 'string',
|
844 |
),
|
845 |
-
'shipping_last_name'
|
846 |
'label' => __( 'Last Name (Shipping)', 'woo-order-export-lite' ),
|
847 |
'checked' => 1,
|
848 |
'format' => 'string',
|
849 |
),
|
850 |
-
'shipping_full_name'
|
851 |
'label' => __( 'Full Name (Shipping)', 'woo-order-export-lite' ),
|
852 |
'checked' => 0,
|
853 |
'format' => 'string',
|
854 |
),
|
855 |
-
'shipping_company'
|
856 |
'label' => __( 'Company (Shipping)', 'woo-order-export-lite' ),
|
857 |
'checked' => 0,
|
858 |
'format' => 'string',
|
859 |
),
|
860 |
-
'shipping_address'
|
861 |
'label' => __( 'Address 1&2 (Shipping)', 'woo-order-export-lite' ),
|
862 |
'checked' => 1,
|
863 |
'format' => 'string',
|
864 |
),
|
865 |
-
'shipping_address_1'
|
866 |
'label' => __( 'Address 1 (Shipping)', 'woo-order-export-lite' ),
|
867 |
'checked' => 0,
|
868 |
'format' => 'string',
|
869 |
),
|
870 |
-
'shipping_address_2'
|
871 |
'label' => __( 'Address 2 (Shipping)', 'woo-order-export-lite' ),
|
872 |
'checked' => 0,
|
873 |
'format' => 'string',
|
874 |
),
|
875 |
-
'shipping_city'
|
876 |
'label' => __( 'City (Shipping)', 'woo-order-export-lite' ),
|
877 |
'checked' => 1,
|
878 |
'format' => 'string',
|
879 |
),
|
880 |
-
'shipping_state'
|
881 |
'label' => __( 'State Code (Shipping)', 'woo-order-export-lite' ),
|
882 |
'checked' => 1,
|
883 |
'format' => 'string',
|
884 |
),
|
885 |
-
'shipping_citystatezip'
|
886 |
'label' => __( 'City, State, Zip (Shipping)', 'woo-order-export-lite' ),
|
887 |
'checked' => 0,
|
888 |
'format' => 'string',
|
@@ -892,22 +903,22 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
892 |
'checked' => 0,
|
893 |
'format' => 'string',
|
894 |
),
|
895 |
-
'shipping_state_full'
|
896 |
'label' => __( 'State Name (Shipping)', 'woo-order-export-lite' ),
|
897 |
'checked' => 0,
|
898 |
'format' => 'string',
|
899 |
),
|
900 |
-
'shipping_postcode'
|
901 |
'label' => __( 'Postcode (Shipping)', 'woo-order-export-lite' ),
|
902 |
'checked' => 1,
|
903 |
'format' => 'string',
|
904 |
),
|
905 |
-
'shipping_country'
|
906 |
'label' => __( 'Country Code (Shipping)', 'woo-order-export-lite' ),
|
907 |
'checked' => 1,
|
908 |
'format' => 'string',
|
909 |
),
|
910 |
-
'shipping_country_full'
|
911 |
'label' => __( 'Country Name (Shipping)', 'woo-order-export-lite' ),
|
912 |
'checked' => 0,
|
913 |
'format' => 'string',
|
@@ -951,6 +962,11 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
951 |
'checked' => 0,
|
952 |
'format' => 'string',
|
953 |
),
|
|
|
|
|
|
|
|
|
|
|
954 |
'payment_method_title' => array(
|
955 |
'label' => __( 'Payment Method Title', 'woo-order-export-lite' ),
|
956 |
'checked' => 1,
|
@@ -1147,6 +1163,7 @@ class WC_Order_Export_Data_Extractor_UI extends WC_Order_Export_Data_Extractor {
|
|
1147 |
'money' => __( 'Money', 'woo-order-export-lite' ),
|
1148 |
'number' => __( 'Number', 'woo-order-export-lite' ),
|
1149 |
'date' => __( 'Date', 'woo-order-export-lite' ),
|
|
|
1150 |
);
|
1151 |
}
|
1152 |
|
31 |
$where_users = '';
|
32 |
}
|
33 |
$user_fields = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->usermeta} $where_users" );
|
34 |
+
$order_fields = self::get_order_custom_fields();
|
35 |
} else {
|
36 |
$user_fields = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->posts} INNER JOIN {$wpdb->usermeta} ON {$wpdb->posts}.post_author = {$wpdb->usermeta}.user_id WHERE post_type = '" . self::$object_type . "' {$sql_in_orders}" );
|
37 |
+
$order_fields = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->posts} INNER JOIN {$wpdb->postmeta} ON {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id WHERE post_type = '" . self::$object_type . "' {$sql_in_orders}" );
|
38 |
}
|
39 |
|
40 |
foreach ( $user_fields as $k => $v ) {
|
41 |
$user_fields[ $k ] = 'USER_' . $v;
|
42 |
}
|
43 |
+
|
44 |
+
$user_fields = array_unique( $user_fields );
|
45 |
+
$order_fields = array_unique( $order_fields );
|
46 |
+
sort( $user_fields );
|
47 |
+
sort( $order_fields );
|
48 |
+
|
49 |
+
$fields = array(
|
50 |
+
'user' => $user_fields,
|
51 |
+
'order' => $order_fields,
|
52 |
+
);
|
53 |
//debug set_transient( $transient_key, $fields, 60 ); //valid for a 1 min
|
54 |
}
|
55 |
|
56 |
return apply_filters( 'woe_get_all_order_custom_meta_fields', $fields );
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
public static function get_order_item_custom_meta_fields_for_orders( $sql_order_ids ) {
|
61 |
global $wpdb;
|
81 |
$sql_products = "SELECT DISTINCT meta_value FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE meta_key ='_product_id' AND order_item_id IN
|
82 |
(SELECT DISTINCT order_item_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_type = 'line_item' AND order_id IN ($sql_order_ids))";
|
83 |
|
84 |
+
$product_ids = $wpdb->get_col( "SELECT DISTINCT ID FROM {$wpdb->posts} WHERE post_type IN ('product','product_variation') AND ID IN ($sql_products) ORDER BY ID DESC LIMIT 1000" );
|
85 |
+
|
86 |
+
$wp_fields = array();
|
87 |
+
if($product_ids ) {
|
88 |
+
$product_ids = join(",", $product_ids);
|
89 |
+
$wp_fields = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} WHERE post_id IN ($product_ids) ORDER BY meta_key" );
|
90 |
+
}
|
91 |
|
92 |
return apply_filters( 'get_product_custom_meta_fields_for_orders', $wp_fields );
|
93 |
}
|
139 |
ORDER BY post.post_title
|
140 |
LIMIT " . intval( $limit );
|
141 |
|
142 |
+
$products = $wpdb->get_results( $wpdb->prepare( $query, '%' . $like . '%' ) );
|
143 |
foreach ( $products as $key => $product ) {
|
144 |
if ( $product->photo_id ) {
|
145 |
$photo = wp_get_attachment_image_src( $product->photo_id, 'thumbnail' );
|
183 |
LIMIT 0,10
|
184 |
";
|
185 |
|
186 |
+
return $wpdb->get_results( $wpdb->prepare( $query, '%' . $like . '%' ) );
|
187 |
}
|
188 |
|
189 |
public static function get_categories_like( $like ) {
|
496 |
'checked' => 0,
|
497 |
'format' => 'string',
|
498 |
),
|
499 |
+
'item_download_url' => array(
|
500 |
+
'label' => __( 'Item download URL', 'woo-order-export-lite' ),
|
501 |
+
'checked' => 0,
|
502 |
+
'format' => 'string',
|
503 |
+
),
|
504 |
'image_url' => array(
|
505 |
'label' => __( 'Image URL', 'woo-order-export-lite' ),
|
506 |
'checked' => 0,
|
536 |
'checked' => 0,
|
537 |
'format' => 'money',
|
538 |
),
|
539 |
+
'embedded_product_image' => array(
|
540 |
+
'label' => __( 'Embedded Product Image', 'woo-order-export-lite' ),
|
541 |
+
'checked' => 0,
|
542 |
+
'format' => 'image',
|
543 |
+
),
|
544 |
);
|
545 |
|
546 |
foreach ( $map as $key => $value ) {
|
698 |
'checked' => 0,
|
699 |
'format' => 'string',
|
700 |
),
|
701 |
+
'embedded_edit_order_link' => array(
|
702 |
+
'label' => __( 'Link to edit order', 'woo-order-export-lite' ),
|
703 |
+
'checked' => 0,
|
704 |
+
'format' => 'string',
|
705 |
+
),
|
706 |
);
|
707 |
}
|
708 |
|
743 |
'checked' => 0,
|
744 |
'format' => 'number',
|
745 |
),
|
746 |
+
'customer_first_order_date' => array(
|
747 |
+
'label' => __( 'Customer first order date', 'woo-order-export-lite' ),
|
748 |
+
'checked' => 0,
|
749 |
+
'format' => 'date',
|
750 |
+
),
|
751 |
+
'customer_last_order_date' => array(
|
752 |
+
'label' => __( 'Customer last order date', 'woo-order-export-lite' ),
|
753 |
+
'checked' => 0,
|
754 |
+
'format' => 'date',
|
755 |
+
),
|
756 |
);
|
757 |
}
|
758 |
|
759 |
public static function get_order_fields_billing() {
|
760 |
return array(
|
761 |
+
'billing_first_name' => array(
|
762 |
'label' => __( 'First Name (Billing)', 'woo-order-export-lite' ),
|
763 |
'checked' => 1,
|
764 |
'format' => 'string',
|
765 |
),
|
766 |
+
'billing_last_name' => array(
|
767 |
'label' => __( 'Last Name (Billing)', 'woo-order-export-lite' ),
|
768 |
'checked' => 1,
|
769 |
'format' => 'string',
|
770 |
),
|
771 |
+
'billing_full_name' => array(
|
772 |
'label' => __( 'Full Name (Billing)', 'woo-order-export-lite' ),
|
773 |
'checked' => 0,
|
774 |
'format' => 'string',
|
775 |
),
|
776 |
+
'billing_company' => array(
|
777 |
'label' => __( 'Company (Billing)', 'woo-order-export-lite' ),
|
778 |
'checked' => 1,
|
779 |
'format' => 'string',
|
780 |
),
|
781 |
+
'billing_address' => array(
|
782 |
'label' => __( 'Address 1&2 (Billing)', 'woo-order-export-lite' ),
|
783 |
'checked' => 1,
|
784 |
'format' => 'string',
|
785 |
),
|
786 |
+
'billing_address_1' => array(
|
787 |
'label' => __( 'Address 1 (Billing)', 'woo-order-export-lite' ),
|
788 |
'checked' => 0,
|
789 |
'format' => 'string',
|
790 |
),
|
791 |
+
'billing_address_2' => array(
|
792 |
'label' => __( 'Address 2 (Billing)', 'woo-order-export-lite' ),
|
793 |
'checked' => 0,
|
794 |
'format' => 'string',
|
795 |
),
|
796 |
+
'billing_city' => array(
|
797 |
'label' => __( 'City (Billing)', 'woo-order-export-lite' ),
|
798 |
'checked' => 1,
|
799 |
'format' => 'string',
|
800 |
),
|
801 |
+
'billing_state' => array(
|
802 |
'label' => __( 'State Code (Billing)', 'woo-order-export-lite' ),
|
803 |
'checked' => 1,
|
804 |
'format' => 'string',
|
805 |
),
|
806 |
+
'billing_citystatezip' => array(
|
807 |
'label' => __( 'City, State, Zip (Billing)', 'woo-order-export-lite' ),
|
808 |
'checked' => 0,
|
809 |
'format' => 'string',
|
813 |
'checked' => 0,
|
814 |
'format' => 'string',
|
815 |
),
|
816 |
+
'billing_state_full' => array(
|
817 |
'label' => __( 'State Name (Billing)', 'woo-order-export-lite' ),
|
818 |
'checked' => 0,
|
819 |
'format' => 'string',
|
820 |
),
|
821 |
+
'billing_postcode' => array(
|
822 |
'label' => __( 'Postcode (Billing)', 'woo-order-export-lite' ),
|
823 |
'checked' => 1,
|
824 |
'format' => 'string',
|
825 |
),
|
826 |
+
'billing_country' => array(
|
827 |
'label' => __( 'Country Code (Billing)', 'woo-order-export-lite' ),
|
828 |
'checked' => 1,
|
829 |
'format' => 'string',
|
830 |
),
|
831 |
+
'billing_country_full' => array(
|
832 |
'label' => __( 'Country Name (Billing)', 'woo-order-export-lite' ),
|
833 |
'checked' => 0,
|
834 |
'format' => 'string',
|
835 |
),
|
836 |
+
'billing_email' => array(
|
837 |
'label' => __( 'Email (Billing)', 'woo-order-export-lite' ),
|
838 |
'checked' => 1,
|
839 |
'format' => 'string',
|
840 |
),
|
841 |
+
'billing_phone' => array(
|
842 |
'label' => __( 'Phone (Billing)', 'woo-order-export-lite' ),
|
843 |
'checked' => 1,
|
844 |
'format' => 'string',
|
848 |
|
849 |
public static function get_order_fields_shipping() {
|
850 |
return array(
|
851 |
+
'shipping_first_name' => array(
|
852 |
'label' => __( 'First Name (Shipping)', 'woo-order-export-lite' ),
|
853 |
'checked' => 1,
|
854 |
'format' => 'string',
|
855 |
),
|
856 |
+
'shipping_last_name' => array(
|
857 |
'label' => __( 'Last Name (Shipping)', 'woo-order-export-lite' ),
|
858 |
'checked' => 1,
|
859 |
'format' => 'string',
|
860 |
),
|
861 |
+
'shipping_full_name' => array(
|
862 |
'label' => __( 'Full Name (Shipping)', 'woo-order-export-lite' ),
|
863 |
'checked' => 0,
|
864 |
'format' => 'string',
|
865 |
),
|
866 |
+
'shipping_company' => array(
|
867 |
'label' => __( 'Company (Shipping)', 'woo-order-export-lite' ),
|
868 |
'checked' => 0,
|
869 |
'format' => 'string',
|
870 |
),
|
871 |
+
'shipping_address' => array(
|
872 |
'label' => __( 'Address 1&2 (Shipping)', 'woo-order-export-lite' ),
|
873 |
'checked' => 1,
|
874 |
'format' => 'string',
|
875 |
),
|
876 |
+
'shipping_address_1' => array(
|
877 |
'label' => __( 'Address 1 (Shipping)', 'woo-order-export-lite' ),
|
878 |
'checked' => 0,
|
879 |
'format' => 'string',
|
880 |
),
|
881 |
+
'shipping_address_2' => array(
|
882 |
'label' => __( 'Address 2 (Shipping)', 'woo-order-export-lite' ),
|
883 |
'checked' => 0,
|
884 |
'format' => 'string',
|
885 |
),
|
886 |
+
'shipping_city' => array(
|
887 |
'label' => __( 'City (Shipping)', 'woo-order-export-lite' ),
|
888 |
'checked' => 1,
|
889 |
'format' => 'string',
|
890 |
),
|
891 |
+
'shipping_state' => array(
|
892 |
'label' => __( 'State Code (Shipping)', 'woo-order-export-lite' ),
|
893 |
'checked' => 1,
|
894 |
'format' => 'string',
|
895 |
),
|
896 |
+
'shipping_citystatezip' => array(
|
897 |
'label' => __( 'City, State, Zip (Shipping)', 'woo-order-export-lite' ),
|
898 |
'checked' => 0,
|
899 |
'format' => 'string',
|
903 |
'checked' => 0,
|
904 |
'format' => 'string',
|
905 |
),
|
906 |
+
'shipping_state_full' => array(
|
907 |
'label' => __( 'State Name (Shipping)', 'woo-order-export-lite' ),
|
908 |
'checked' => 0,
|
909 |
'format' => 'string',
|
910 |
),
|
911 |
+
'shipping_postcode' => array(
|
912 |
'label' => __( 'Postcode (Shipping)', 'woo-order-export-lite' ),
|
913 |
'checked' => 1,
|
914 |
'format' => 'string',
|
915 |
),
|
916 |
+
'shipping_country' => array(
|
917 |
'label' => __( 'Country Code (Shipping)', 'woo-order-export-lite' ),
|
918 |
'checked' => 1,
|
919 |
'format' => 'string',
|
920 |
),
|
921 |
+
'shipping_country_full' => array(
|
922 |
'label' => __( 'Country Name (Shipping)', 'woo-order-export-lite' ),
|
923 |
'checked' => 0,
|
924 |
'format' => 'string',
|
962 |
'checked' => 0,
|
963 |
'format' => 'string',
|
964 |
),
|
965 |
+
'shipping_method_only' => array(
|
966 |
+
'label' => __( 'Shipping Method (no id)', 'woo-order-export-lite' ),
|
967 |
+
'checked' => 0,
|
968 |
+
'format' => 'string',
|
969 |
+
),
|
970 |
'payment_method_title' => array(
|
971 |
'label' => __( 'Payment Method Title', 'woo-order-export-lite' ),
|
972 |
'checked' => 1,
|
1163 |
'money' => __( 'Money', 'woo-order-export-lite' ),
|
1164 |
'number' => __( 'Number', 'woo-order-export-lite' ),
|
1165 |
'date' => __( 'Date', 'woo-order-export-lite' ),
|
1166 |
+
'image' => __( 'Image', 'woo-order-export-lite' ),
|
1167 |
);
|
1168 |
}
|
1169 |
|
classes/core/class-wc-order-export-data-extractor.php
CHANGED
@@ -110,10 +110,20 @@ class WC_Order_Export_Data_Extractor {
|
|
110 |
|
111 |
$metas = get_transient( $transient_key );
|
112 |
if ( $metas === false ) {
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
118 |
|
119 |
return apply_filters( 'woe_get_product_itemmeta', $metas );
|
@@ -287,7 +297,7 @@ class WC_Order_Export_Data_Extractor {
|
|
287 |
if ( $settings['product_attributes'] ) {
|
288 |
$attrs = self::get_product_attributes();
|
289 |
$names2fields = array_flip( $attrs );
|
290 |
-
$filters = self::parse_complex_pairs( $settings['product_attributes']
|
291 |
foreach ( $filters as $operator => $fields ) {
|
292 |
foreach ( $fields as $field => $values ) {
|
293 |
$field = $names2fields[ $field ];
|
@@ -316,8 +326,7 @@ class WC_Order_Export_Data_Extractor {
|
|
316 |
$settings['product_itemmeta'][] = esc_html( $value );
|
317 |
}
|
318 |
|
319 |
-
$
|
320 |
-
$filters = self::parse_complex_pairs( $settings['product_itemmeta'], $itemmeta );
|
321 |
foreach ( $filters as $operator => $fields ) {
|
322 |
foreach ( $fields as $field => $values ) {
|
323 |
;
|
@@ -396,16 +405,19 @@ class WC_Order_Export_Data_Extractor {
|
|
396 |
$left_join_product_meta = "";
|
397 |
if ( $settings['product_custom_fields'] ) {
|
398 |
$left_join_product_meta = $product_meta_where = array();
|
399 |
-
$
|
400 |
-
$filters = self::parse_complex_pairs( $settings['product_custom_fields'], $cf_names );
|
401 |
$pos = 1;
|
402 |
foreach ( $filters as $operator => $fields ) {
|
403 |
foreach ( $fields as $field => $values ) {
|
404 |
if ( $values ) {
|
405 |
-
$left_join_product_meta[] = "LEFT JOIN {$wpdb->postmeta} AS productmeta_cf_{$pos} ON productmeta_cf_{$pos}.post_id = products.ID";
|
406 |
if ( $operator == 'IN' OR $operator == 'NOT IN' ) {
|
407 |
$values = self::sql_subset( $values );
|
408 |
-
$product_meta_where[] = "
|
|
|
|
|
|
|
|
|
409 |
} elseif ( in_array( $operator, self::$operator_must_check_values ) ) {
|
410 |
$pairs = array();
|
411 |
foreach ( $values as $v ) {
|
@@ -413,7 +425,7 @@ class WC_Order_Export_Data_Extractor {
|
|
413 |
$operator, $v );
|
414 |
}
|
415 |
$pairs = join( "OR", $pairs );
|
416 |
-
$product_meta_where[] = " (
|
417 |
}
|
418 |
$pos ++;
|
419 |
}//if values
|
@@ -461,17 +473,28 @@ class WC_Order_Export_Data_Extractor {
|
|
461 |
if ( $settings['product_taxonomies'] ) {
|
462 |
$attrs = self::get_product_taxonomies();
|
463 |
$names2fields = array_flip( $attrs );
|
464 |
-
$filters = self::parse_complex_pairs( $settings['product_taxonomies']
|
465 |
//print_r($filters );die();
|
466 |
foreach ( $filters as $operator => $fields ) {
|
467 |
foreach ( $fields as $label => $values ) {
|
468 |
$field = $names2fields[ $label ];
|
469 |
$values = self::sql_subset( $values );
|
470 |
if ( $values ) {
|
471 |
-
$label
|
472 |
-
|
473 |
-
|
474 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
}
|
476 |
}
|
477 |
}
|
@@ -552,7 +575,7 @@ class WC_Order_Export_Data_Extractor {
|
|
552 |
if ( $settings['product_attributes'] ) {
|
553 |
$attrs = self::get_product_attributes();
|
554 |
$names2fields = @array_flip( $attrs );
|
555 |
-
$filters = self::parse_complex_pairs( $settings['product_attributes']
|
556 |
foreach ( $filters as $operator => $fields ) {
|
557 |
foreach ( $fields as $field => $values ) {
|
558 |
$field = $names2fields[ $field ];
|
@@ -581,8 +604,7 @@ class WC_Order_Export_Data_Extractor {
|
|
581 |
$settings['product_itemmeta'][] = esc_html( $value );
|
582 |
}
|
583 |
|
584 |
-
$
|
585 |
-
$filters = self::parse_complex_pairs( $settings['product_itemmeta'], $itemmeta );
|
586 |
foreach ( $filters as $operator => $fields ) {
|
587 |
foreach ( $fields as $field => $values ) {
|
588 |
;
|
@@ -669,23 +691,36 @@ class WC_Order_Export_Data_Extractor {
|
|
669 |
|
670 |
// check item names ?
|
671 |
if ( ! empty( $settings['item_names'] ) ) {
|
672 |
-
$
|
673 |
-
|
674 |
foreach ( $filters as $operator => $fields ) {
|
675 |
foreach ( $fields as $field => $values ) {
|
676 |
if ( $values ) {
|
677 |
if ( $operator == 'IN' OR $operator == 'NOT IN' ) {
|
678 |
$values = self::sql_subset( $values );
|
679 |
-
$
|
680 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
681 |
}
|
682 |
}//if values
|
683 |
}
|
684 |
}
|
|
|
|
|
|
|
|
|
|
|
685 |
}
|
686 |
|
687 |
// check item metadata
|
688 |
if ( ! empty( $settings['item_metadata'] ) ) {
|
|
|
689 |
$filters = self::parse_complex_pairs( $settings['item_metadata'] );
|
690 |
foreach ( $filters as $operator => $fields ) {
|
691 |
foreach ( $fields as $field => $values ) {
|
@@ -694,14 +729,25 @@ class WC_Order_Export_Data_Extractor {
|
|
694 |
$key = esc_sql( $key );
|
695 |
if ( $operator == 'IN' OR $operator == 'NOT IN' ) {
|
696 |
$values = self::sql_subset( $values );
|
697 |
-
$
|
698 |
-
|
699 |
-
|
700 |
-
|
|
|
|
|
|
|
|
|
701 |
}
|
702 |
}//if values
|
703 |
}
|
704 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
705 |
}
|
706 |
|
707 |
|
@@ -709,6 +755,16 @@ class WC_Order_Export_Data_Extractor {
|
|
709 |
$left_join_order_meta = $order_meta_where = $user_meta_where = $inner_join_user_meta = array();
|
710 |
//add filter by custom fields in order
|
711 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
712 |
if ( $settings['export_unmarked_orders'] ) {
|
713 |
$pos = "export_unmarked_orders";
|
714 |
$field = "woe_order_exported";
|
@@ -717,8 +773,7 @@ class WC_Order_Export_Data_Extractor {
|
|
717 |
}
|
718 |
|
719 |
if ( $settings['order_custom_fields'] ) {
|
720 |
-
$
|
721 |
-
$filters = self::parse_complex_pairs( $settings['order_custom_fields'], $cf_names );
|
722 |
$pos = 1;
|
723 |
foreach ( $filters as $operator => $fields ) {
|
724 |
foreach ( $fields as $field => $values ) {
|
@@ -746,8 +801,7 @@ class WC_Order_Export_Data_Extractor {
|
|
746 |
}
|
747 |
}
|
748 |
if ( ! empty( $settings['user_custom_fields'] ) ) {
|
749 |
-
$
|
750 |
-
$filters = self::parse_complex_pairs( $settings['user_custom_fields'], $cf_names );
|
751 |
$pos = 1;
|
752 |
foreach ( $filters as $operator => $fields ) {
|
753 |
foreach ( $fields as $field => $values ) {
|
@@ -902,6 +956,18 @@ class WC_Order_Export_Data_Extractor {
|
|
902 |
|
903 |
private static function apply_order_filters_to_sql( &$where, $settings ) {
|
904 |
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
905 |
//default filter by date
|
906 |
if ( ! isset( $settings['export_rule_field'] ) ) {
|
907 |
$settings['export_rule_field'] = 'modified';
|
@@ -956,6 +1022,7 @@ class WC_Order_Export_Data_Extractor {
|
|
956 |
|
957 |
public static function get_date_range( $settings, $is_for_sql, $use_timestamps = false ) {
|
958 |
$result = array();
|
|
|
959 |
|
960 |
// fixed date range
|
961 |
if ( ! empty( $settings['from_date'] ) OR ! empty( $settings['to_date'] ) ) {
|
@@ -968,7 +1035,8 @@ class WC_Order_Export_Data_Extractor {
|
|
968 |
}
|
969 |
if ( $is_for_sql ) {
|
970 |
if ( $use_timestamps ) {
|
971 |
-
$from_date = mysql2date( '
|
|
|
972 |
}
|
973 |
$from_date = sprintf( ">='%s'", $from_date );
|
974 |
}
|
@@ -984,7 +1052,8 @@ class WC_Order_Export_Data_Extractor {
|
|
984 |
}
|
985 |
if ( $is_for_sql ) {
|
986 |
if ( $use_timestamps ) {
|
987 |
-
$to_date = mysql2date( '
|
|
|
988 |
}
|
989 |
$to_date = sprintf( "<='%s'", $to_date );
|
990 |
}
|
@@ -1090,7 +1159,8 @@ class WC_Order_Export_Data_Extractor {
|
|
1090 |
if ( isset( $from_date ) AND $from_date ) {
|
1091 |
if ( $is_for_sql ) {
|
1092 |
if ( $use_timestamps ) {
|
1093 |
-
$from_date = mysql2date( '
|
|
|
1094 |
}
|
1095 |
$from_date = sprintf( ">='%s'", $from_date );
|
1096 |
}
|
@@ -1100,7 +1170,8 @@ class WC_Order_Export_Data_Extractor {
|
|
1100 |
if ( isset( $to_date ) AND $to_date ) {
|
1101 |
if ( $is_for_sql ) {
|
1102 |
if ( $use_timestamps ) {
|
1103 |
-
$to_date = mysql2date( '
|
|
|
1104 |
}
|
1105 |
$to_date = sprintf( "<='%s'", $to_date );
|
1106 |
}
|
@@ -1179,8 +1250,9 @@ class WC_Order_Export_Data_Extractor {
|
|
1179 |
$coupons = array();
|
1180 |
foreach ( $order->get_items( 'coupon' ) as $item ) {
|
1181 |
$coupon_meta = array();
|
1182 |
-
$get_coupon_meta = ( array_diff( $labels->get_keys(),
|
1183 |
-
|
|
|
1184 |
if ( $get_coupon_meta ) {
|
1185 |
$recs = $wpdb->get_results( $wpdb->prepare( "SELECT meta_value,meta_key FROM {$wpdb->postmeta} AS meta
|
1186 |
JOIN {$wpdb->posts} AS posts ON posts.ID = meta.post_id
|
@@ -1188,6 +1260,10 @@ class WC_Order_Export_Data_Extractor {
|
|
1188 |
foreach ( $recs as $rec ) {
|
1189 |
$coupon_meta[ $rec->meta_key ] = $rec->meta_value;
|
1190 |
}
|
|
|
|
|
|
|
|
|
1191 |
}
|
1192 |
|
1193 |
$row = array();
|
@@ -1198,6 +1274,9 @@ class WC_Order_Export_Data_Extractor {
|
|
1198 |
$row['code'] = $item["name"];
|
1199 |
} elseif ( $field == 'discount_amount_plus_tax' ) {
|
1200 |
$row['discount_amount_plus_tax'] = $item["discount_amount"] + $item["discount_amount_tax"];
|
|
|
|
|
|
|
1201 |
} elseif ( isset( $coupon_meta[ $field ] ) ) {
|
1202 |
$row[ $field ] = $coupon_meta[ $field ];
|
1203 |
} elseif ( isset( $static_vals[ $field ] ) ) {
|
@@ -1205,14 +1284,9 @@ class WC_Order_Export_Data_Extractor {
|
|
1205 |
} else {
|
1206 |
$row[ $field ] = '';
|
1207 |
}
|
1208 |
-
|
1209 |
$row[ $field ] = apply_filters( "woe_get_order_coupon_value_{$field}", $row[ $field ], $order,
|
1210 |
$item );
|
1211 |
-
|
1212 |
-
if ( $field == 'excerpt' ) {
|
1213 |
-
$post = get_page_by_title( $item['name'], OBJECT, 'shop_' . $item['type'] );
|
1214 |
-
$row[ $field ] = $post ? $post->post_excerpt : '';
|
1215 |
-
}
|
1216 |
}
|
1217 |
$row = apply_filters( 'woe_fetch_order_coupon', $row, $item, $coupon_meta );
|
1218 |
if ( $row ) {
|
@@ -1258,8 +1332,10 @@ class WC_Order_Export_Data_Extractor {
|
|
1258 |
) {
|
1259 |
continue;
|
1260 |
}
|
|
|
1261 |
$product = $order->get_product_from_item( $item );
|
1262 |
$product = apply_filters( "woe_get_order_product", $product );
|
|
|
1263 |
$item_meta = get_metadata( 'order_item', $item_id );
|
1264 |
foreach ( $item_meta as $key => $value ) {
|
1265 |
$clear_key = wc_sanitize_taxonomy_name( $key );
|
@@ -1270,7 +1346,13 @@ class WC_Order_Export_Data_Extractor {
|
|
1270 |
$item_meta[ 'attribute_' . $key ][0] = isset( $term->name ) ? $term->name : $value[0];
|
1271 |
}
|
1272 |
}
|
|
|
|
|
|
|
|
|
|
|
1273 |
}
|
|
|
1274 |
$item_meta = apply_filters( "woe_get_order_product_item_meta", $item_meta );
|
1275 |
$product = apply_filters( "woe_get_order_product_and_item_meta", $product, $item_meta );
|
1276 |
if ( $product ) {
|
@@ -1342,6 +1424,25 @@ class WC_Order_Export_Data_Extractor {
|
|
1342 |
$row[ $field ] = $post ? $post->post_content : '';
|
1343 |
} elseif ( $field == 'post_excerpt' ) {
|
1344 |
$row[ $field ] = $post ? $post->post_excerpt : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1345 |
} elseif ( $field == 'type' ) {
|
1346 |
$row[ $field ] = '';
|
1347 |
if ( $product ) {
|
@@ -1411,7 +1512,7 @@ class WC_Order_Export_Data_Extractor {
|
|
1411 |
} elseif ( $field == 'download_url' ) {
|
1412 |
$row[ $field ] = '';
|
1413 |
if ( $product AND $product->is_downloadable() ) {
|
1414 |
-
$files = get_post_meta( $
|
1415 |
$links = array();
|
1416 |
if ( $files ) {
|
1417 |
foreach ( $files as $file ) {
|
@@ -1420,6 +1521,18 @@ class WC_Order_Export_Data_Extractor {
|
|
1420 |
}
|
1421 |
$row[ $field ] = implode( "\n", $links );
|
1422 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1423 |
} elseif ( $field == 'image_url' ) {
|
1424 |
// make full url, wp_get_attachment_image_src can return false
|
1425 |
$images_src = ( is_object( $product ) AND $product->get_image_id() ) ? wp_get_attachment_image_src( $product->get_image_id(),
|
@@ -1596,12 +1709,12 @@ class WC_Order_Export_Data_Extractor {
|
|
1596 |
}
|
1597 |
|
1598 |
// we know parent!
|
1599 |
-
if (
|
1600 |
-
|
1601 |
-
|
1602 |
-
$tmp_labels = !empty($labels['products']) ? clone $labels['products'] : new WC_Order_Export_Labels();
|
1603 |
//need qty?
|
1604 |
-
if ( isset( $labels['order']->total_weight_items )
|
1605 |
if ( ! isset( $tmp_labels->qty ) ) {
|
1606 |
$tmp_labels->qty = "";
|
1607 |
}
|
@@ -1612,7 +1725,7 @@ class WC_Order_Export_Data_Extractor {
|
|
1612 |
$tmp_labels->weight = "";
|
1613 |
}
|
1614 |
}
|
1615 |
-
|
1616 |
$data['products'] = self::fetch_order_products(
|
1617 |
$order,
|
1618 |
$tmp_labels,
|
@@ -1640,7 +1753,8 @@ class WC_Order_Export_Data_Extractor {
|
|
1640 |
// extra WP_User
|
1641 |
$user = ! empty( $order_meta['_customer_user'] ) ? get_userdata( $order_meta['_customer_user'] ) : false;
|
1642 |
// setup missed fields for full addresses
|
1643 |
-
|
|
|
1644 |
if ( ! isset( $order_meta[ $optional_field ] ) ) {
|
1645 |
$order_meta[ $optional_field ] = '';
|
1646 |
}
|
@@ -1729,6 +1843,14 @@ class WC_Order_Export_Data_Extractor {
|
|
1729 |
$row[ $field ] = ( isset( $user->roles[0] ) && isset( $roles[ $user->roles[0] ] ) ) ? $roles[ $user->roles[0] ]['name'] : ""; // take first role Name
|
1730 |
} elseif ( $field == 'customer_total_orders' ) {
|
1731 |
$row[ $field ] = ( isset( $user->ID ) ) ? wc_get_customer_order_count( $user->ID ) : 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1732 |
} elseif ( $field == 'billing_address' ) {
|
1733 |
$row[ $field ] = join( ", ",
|
1734 |
array_filter( array( $order_meta["_billing_address_1"], $order_meta["_billing_address_2"] ) ) );
|
@@ -1752,22 +1874,22 @@ class WC_Order_Export_Data_Extractor {
|
|
1752 |
} elseif ( $field == 'billing_citystatezip' ) {
|
1753 |
$row[ $field ] = self::get_city_state_postcode_field_value( $order, 'billing' );
|
1754 |
} elseif ( $field == 'billing_citystatezip_us' ) {
|
1755 |
-
$row[ $field ] = self::get_city_state_postcode_field_value( $order, 'billing', true);
|
1756 |
} elseif ( $field == 'shipping_citystatezip' ) {
|
1757 |
$row[ $field ] = self::get_city_state_postcode_field_value( $order, 'shipping' );
|
1758 |
} elseif ( $field == 'shipping_citystatezip_us' ) {
|
1759 |
-
$row[ $field ] = self::get_city_state_postcode_field_value( $order, 'shipping', true);
|
1760 |
} elseif ( $field == 'products' OR $field == 'coupons' ) {
|
1761 |
if ( isset( $data[ $field ] ) ) {
|
1762 |
$row[ $field ] = $data[ $field ];
|
1763 |
}
|
1764 |
} elseif ( $field == 'shipping_method_title' ) {
|
1765 |
$row[ $field ] = $order->get_shipping_method();
|
1766 |
-
} elseif ( $field == 'shipping_method' ) {
|
1767 |
$shipping_methods = $order->get_items( 'shipping' );
|
1768 |
$shipping_method = reset( $shipping_methods ); // take first entry
|
1769 |
if ( ! empty( $shipping_method ) ) {
|
1770 |
-
$row[ $field ] = $shipping_method['method_id'] . ':' . $shipping_method['instance_id'];
|
1771 |
}
|
1772 |
} elseif ( $field == 'coupons_used' ) {
|
1773 |
$row[ $field ] = count( $data['coupons'] );
|
@@ -1828,6 +1950,12 @@ class WC_Order_Export_Data_Extractor {
|
|
1828 |
}
|
1829 |
}
|
1830 |
$row[ $field ] = implode( "\n", $comments );
|
|
|
|
|
|
|
|
|
|
|
|
|
1831 |
} elseif ( isset( $order_meta[ $field ] ) ) {
|
1832 |
$field_data = array();
|
1833 |
do_action( 'woocommerce_order_export_add_field_data', $field_data, $order_meta[ $field ], $field );
|
@@ -1859,19 +1987,19 @@ class WC_Order_Export_Data_Extractor {
|
|
1859 |
}
|
1860 |
|
1861 |
//no labels - no data !
|
1862 |
-
if( empty($labels['products']) ) {
|
1863 |
-
$row['products']
|
1864 |
}
|
1865 |
-
if( empty($labels['coupons']) ) {
|
1866 |
-
$row['coupons']
|
1867 |
}
|
1868 |
-
|
1869 |
$row = apply_filters( "woe_fetch_order", $row, $order );
|
1870 |
|
1871 |
return $row;
|
1872 |
}
|
1873 |
|
1874 |
-
public static function get_city_state_postcode_field_value( $order, $type, $us_format = false
|
1875 |
if ( $type != 'shipping' && $type != 'billing' ) {
|
1876 |
return null;
|
1877 |
}
|
@@ -1886,13 +2014,14 @@ class WC_Order_Export_Data_Extractor {
|
|
1886 |
'get_' . $field_name ) ? $order->{'get_' . $field_name}() : $order->{$field_name};
|
1887 |
}
|
1888 |
|
1889 |
-
if( $us_format ) {
|
1890 |
//reformat as "Austin, TX 95076"
|
1891 |
-
$parts[] = $citystatepostcode[ $type . '_city' ]
|
1892 |
$parts[] = trim( $citystatepostcode[ $type . '_state' ] . " " . $citystatepostcode[ $type . '_postcode' ] );
|
1893 |
} else {
|
1894 |
$parts = $citystatepostcode;
|
1895 |
-
}
|
|
|
1896 |
return join( ", ", $parts );
|
1897 |
}
|
1898 |
|
@@ -2014,4 +2143,35 @@ class WC_Order_Export_Data_Extractor {
|
|
2014 |
return $shipping_methods;
|
2015 |
}
|
2016 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017 |
}
|
110 |
|
111 |
$metas = get_transient( $transient_key );
|
112 |
if ( $metas === false ) {
|
113 |
+
$total_orders = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = '" . self::$object_type . "'" );
|
114 |
+
if ( $total_orders < self::HUGE_SHOP_ORDERS ) {
|
115 |
+
// WP internal table, take all metas
|
116 |
+
$metas = $wpdb->get_col( "SELECT DISTINCT meta.meta_key FROM {$wpdb->prefix}woocommerce_order_itemmeta meta inner join {$wpdb->prefix}woocommerce_order_items item on item.order_item_id=meta.order_item_id and item.order_item_type = 'line_item' " );
|
117 |
+
sort( $metas );
|
118 |
+
set_transient( $transient_key, $metas, 60 ); //valid for a minute
|
119 |
+
} else {
|
120 |
+
$limit = self::HUGE_SHOP_ORDERS;
|
121 |
+
$order_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_type = '" . self::$object_type . "' AND post_status IN('wc-on-hold','wc-processing','wc-completed') ORDER BY post_date DESC LIMIT {$limit}" );
|
122 |
+
$order_ids = join( ",", $order_ids );
|
123 |
+
$metas = $wpdb->get_col( "SELECT DISTINCT meta.meta_key FROM {$wpdb->prefix}woocommerce_order_itemmeta meta inner join {$wpdb->prefix}woocommerce_order_items item on item.order_item_id=meta.order_item_id and item.order_item_type = 'line_item' WHERE item.order_id IN ($order_ids)" );
|
124 |
+
sort( $metas );
|
125 |
+
set_transient( $transient_key, $metas, 60 ); //valid for a minute
|
126 |
+
}
|
127 |
}
|
128 |
|
129 |
return apply_filters( 'woe_get_product_itemmeta', $metas );
|
297 |
if ( $settings['product_attributes'] ) {
|
298 |
$attrs = self::get_product_attributes();
|
299 |
$names2fields = array_flip( $attrs );
|
300 |
+
$filters = self::parse_complex_pairs( $settings['product_attributes']);
|
301 |
foreach ( $filters as $operator => $fields ) {
|
302 |
foreach ( $fields as $field => $values ) {
|
303 |
$field = $names2fields[ $field ];
|
326 |
$settings['product_itemmeta'][] = esc_html( $value );
|
327 |
}
|
328 |
|
329 |
+
$filters = self::parse_complex_pairs( $settings['product_itemmeta'] );
|
|
|
330 |
foreach ( $filters as $operator => $fields ) {
|
331 |
foreach ( $fields as $field => $values ) {
|
332 |
;
|
405 |
$left_join_product_meta = "";
|
406 |
if ( $settings['product_custom_fields'] ) {
|
407 |
$left_join_product_meta = $product_meta_where = array();
|
408 |
+
$filters = self::parse_complex_pairs( $settings['product_custom_fields']);
|
|
|
409 |
$pos = 1;
|
410 |
foreach ( $filters as $operator => $fields ) {
|
411 |
foreach ( $fields as $field => $values ) {
|
412 |
if ( $values ) {
|
413 |
+
$left_join_product_meta[] = "LEFT JOIN {$wpdb->postmeta} AS productmeta_cf_{$pos} ON productmeta_cf_{$pos}.post_id = products.ID AND productmeta_cf_{$pos}.meta_key='$field'";
|
414 |
if ( $operator == 'IN' OR $operator == 'NOT IN' ) {
|
415 |
$values = self::sql_subset( $values );
|
416 |
+
$product_meta_where[] = " productmeta_cf_{$pos}.meta_value $operator ($values) ";
|
417 |
+
} elseif ( $operator == 'NOT SET' ) {
|
418 |
+
$product_meta_where [] = " productmeta_cf_{$pos}.meta_value IS NULL ";
|
419 |
+
} elseif ( $operator == 'IS SET' ) {
|
420 |
+
$product_meta_where [] = " productmeta_cf_{$pos}.meta_value IS NOT NULL ";
|
421 |
} elseif ( in_array( $operator, self::$operator_must_check_values ) ) {
|
422 |
$pairs = array();
|
423 |
foreach ( $values as $v ) {
|
425 |
$operator, $v );
|
426 |
}
|
427 |
$pairs = join( "OR", $pairs );
|
428 |
+
$product_meta_where[] = " ($pairs) ";
|
429 |
}
|
430 |
$pos ++;
|
431 |
}//if values
|
473 |
if ( $settings['product_taxonomies'] ) {
|
474 |
$attrs = self::get_product_taxonomies();
|
475 |
$names2fields = array_flip( $attrs );
|
476 |
+
$filters = self::parse_complex_pairs( $settings['product_taxonomies']);
|
477 |
//print_r($filters );die();
|
478 |
foreach ( $filters as $operator => $fields ) {
|
479 |
foreach ( $fields as $label => $values ) {
|
480 |
$field = $names2fields[ $label ];
|
481 |
$values = self::sql_subset( $values );
|
482 |
if ( $values ) {
|
483 |
+
$label = esc_sql( $label );
|
484 |
+
|
485 |
+
if ($operator == 'NOT SET') {
|
486 |
+
$taxonomy_where .= " AND NOT ( orderitemmeta_product.meta_key IN('_product_id') AND orderitemmeta_product.meta_value IN (SELECT object_id FROM {$wpdb->term_relationships} AS `{$field}_rel`
|
487 |
+
INNER JOIN {$wpdb->term_taxonomy} AS `{$field}_cat` ON `{$field}_cat`.term_taxonomy_id = `{$field}_rel`.term_taxonomy_id
|
488 |
+
WHERE `{$field}_cat`.taxonomy='$label' AND `{$field}_cat`.term_id IN (SELECT term_id FROM {$wpdb->terms} ) ))";
|
489 |
+
} elseif ($operator == 'IS SET') {
|
490 |
+
$taxonomy_where .= " AND ( orderitemmeta_product.meta_key IN('_product_id') AND orderitemmeta_product.meta_value IN (SELECT object_id FROM {$wpdb->term_relationships} AS `{$field}_rel`
|
491 |
+
INNER JOIN {$wpdb->term_taxonomy} AS `{$field}_cat` ON `{$field}_cat`.term_taxonomy_id = `{$field}_rel`.term_taxonomy_id
|
492 |
+
WHERE `{$field}_cat`.taxonomy='$label' AND `{$field}_cat`.term_id IN (SELECT term_id FROM {$wpdb->terms} ) ))";
|
493 |
+
} else {
|
494 |
+
$taxonomy_where .= " AND ( orderitemmeta_product.meta_key IN('_product_id') AND orderitemmeta_product.meta_value $operator (SELECT object_id FROM {$wpdb->term_relationships} AS `{$field}_rel`
|
495 |
+
INNER JOIN {$wpdb->term_taxonomy} AS `{$field}_cat` ON `{$field}_cat`.term_taxonomy_id = `{$field}_rel`.term_taxonomy_id
|
496 |
+
WHERE `{$field}_cat`.taxonomy='$label' AND `{$field}_cat`.term_id IN (SELECT term_id FROM {$wpdb->terms} WHERE name IN ($values) ) ))";
|
497 |
+
}
|
498 |
}
|
499 |
}
|
500 |
}
|
575 |
if ( $settings['product_attributes'] ) {
|
576 |
$attrs = self::get_product_attributes();
|
577 |
$names2fields = @array_flip( $attrs );
|
578 |
+
$filters = self::parse_complex_pairs( $settings['product_attributes']);
|
579 |
foreach ( $filters as $operator => $fields ) {
|
580 |
foreach ( $fields as $field => $values ) {
|
581 |
$field = $names2fields[ $field ];
|
604 |
$settings['product_itemmeta'][] = esc_html( $value );
|
605 |
}
|
606 |
|
607 |
+
$filters = self::parse_complex_pairs( $settings['product_itemmeta']);
|
|
|
608 |
foreach ( $filters as $operator => $fields ) {
|
609 |
foreach ( $fields as $field => $values ) {
|
610 |
;
|
691 |
|
692 |
// check item names ?
|
693 |
if ( ! empty( $settings['item_names'] ) ) {
|
694 |
+
$order_items_name_where = array();
|
695 |
+
$filters = self::parse_complex_pairs( $settings['item_names'], array( 'coupon', 'fee', 'line_item', 'shipping', 'tax' ) );
|
696 |
foreach ( $filters as $operator => $fields ) {
|
697 |
foreach ( $fields as $field => $values ) {
|
698 |
if ( $values ) {
|
699 |
if ( $operator == 'IN' OR $operator == 'NOT IN' ) {
|
700 |
$values = self::sql_subset( $values );
|
701 |
+
$order_items_name_where[] = "(order_item_type='$field' AND order_item_name $operator ($values))";
|
702 |
+
} elseif ( in_array( $operator, self::$operator_must_check_values ) ) {
|
703 |
+
$pairs = array();
|
704 |
+
foreach ( $values as $v ) {
|
705 |
+
$pairs[] = self::operator_compare_field_and_value( "order_item_name", $operator, $v );
|
706 |
+
}
|
707 |
+
$pairs = join( "OR", $pairs );
|
708 |
+
$order_items_name_where[] = "(order_item_type='$field' AND ({$pairs}))";
|
709 |
+
|
710 |
}
|
711 |
}//if values
|
712 |
}
|
713 |
}
|
714 |
+
|
715 |
+
$order_items_name_where_sql = join( " OR ", $order_items_name_where );
|
716 |
+
$where_item_names = " SELECT order_id FROM {$wpdb->prefix}woocommerce_order_items WHERE {$order_items_name_where_sql}";
|
717 |
+
|
718 |
+
$order_items_where .= " AND orders.ID IN ($where_item_names)";
|
719 |
}
|
720 |
|
721 |
// check item metadata
|
722 |
if ( ! empty( $settings['item_metadata'] ) ) {
|
723 |
+
$order_items_metadata_where = array();
|
724 |
$filters = self::parse_complex_pairs( $settings['item_metadata'] );
|
725 |
foreach ( $filters as $operator => $fields ) {
|
726 |
foreach ( $fields as $field => $values ) {
|
729 |
$key = esc_sql( $key );
|
730 |
if ( $operator == 'IN' OR $operator == 'NOT IN' ) {
|
731 |
$values = self::sql_subset( $values );
|
732 |
+
$order_items_metadata_where[] = "(order_item_type='$type' AND meta_key='$key' AND meta_value $operator ($values))";
|
733 |
+
} elseif ( in_array( $operator, self::$operator_must_check_values ) ) {
|
734 |
+
$pairs = array();
|
735 |
+
foreach ( $values as $v ) {
|
736 |
+
$pairs[] = self::operator_compare_field_and_value( "meta_value", $operator, $v );
|
737 |
+
}
|
738 |
+
$pairs = join( "OR", $pairs );
|
739 |
+
$order_items_metadata_where[] = "(order_item_type='$type' AND meta_key='$key' AND ({$pairs}))";
|
740 |
}
|
741 |
}//if values
|
742 |
}
|
743 |
}
|
744 |
+
|
745 |
+
$order_items_metadata_where_sql = join( " OR ", $order_items_metadata_where );
|
746 |
+
$where_item_metadata = " SELECT order_id FROM {$wpdb->prefix}woocommerce_order_items AS items
|
747 |
+
JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS meta ON meta.order_item_id = items.order_item_id
|
748 |
+
WHERE {$order_items_metadata_where_sql}";
|
749 |
+
|
750 |
+
$order_items_where .= " AND orders.ID IN ($where_item_metadata)";
|
751 |
}
|
752 |
|
753 |
|
755 |
$left_join_order_meta = $order_meta_where = $user_meta_where = $inner_join_user_meta = array();
|
756 |
//add filter by custom fields in order
|
757 |
|
758 |
+
if ( $settings['sort'] ) {
|
759 |
+
$sort_field = $settings['sort'];
|
760 |
+
|
761 |
+
if ( ! in_array( $settings['sort'], WC_Order_Export_Engine::get_wp_posts_fields() ) ) {
|
762 |
+
$pos = "sort";
|
763 |
+
$left_join_order_meta[] = "LEFT JOIN {$wpdb->postmeta} AS ordermeta_cf_{$pos} " .
|
764 |
+
"ON ordermeta_cf_{$pos}.post_id = orders.ID AND ordermeta_cf_{$pos}.meta_key='{$sort_field}'";
|
765 |
+
}
|
766 |
+
}
|
767 |
+
|
768 |
if ( $settings['export_unmarked_orders'] ) {
|
769 |
$pos = "export_unmarked_orders";
|
770 |
$field = "woe_order_exported";
|
773 |
}
|
774 |
|
775 |
if ( $settings['order_custom_fields'] ) {
|
776 |
+
$filters = self::parse_complex_pairs( $settings['order_custom_fields'] );
|
|
|
777 |
$pos = 1;
|
778 |
foreach ( $filters as $operator => $fields ) {
|
779 |
foreach ( $fields as $field => $values ) {
|
801 |
}
|
802 |
}
|
803 |
if ( ! empty( $settings['user_custom_fields'] ) ) {
|
804 |
+
$filters = self::parse_complex_pairs( $settings['user_custom_fields'] );
|
|
|
805 |
$pos = 1;
|
806 |
foreach ( $filters as $operator => $fields ) {
|
807 |
foreach ( $fields as $field => $values ) {
|
956 |
|
957 |
private static function apply_order_filters_to_sql( &$where, $settings ) {
|
958 |
global $wpdb;
|
959 |
+
|
960 |
+
if ( ! empty( $settings['order_ids'] ) ) {
|
961 |
+
$order_ids = $settings['order_ids'];
|
962 |
+
|
963 |
+
if ( is_array( $settings['order_ids'] ) && count( array_filter( array_map( 'is_numeric', $order_ids ) ) ) === count( $order_ids ) ) {
|
964 |
+
$order_ids_str = self::sql_subset( $order_ids );
|
965 |
+
if ( $order_ids_str ) {
|
966 |
+
$where[] = "orders.id IN ($order_ids_str)";
|
967 |
+
}
|
968 |
+
}
|
969 |
+
}
|
970 |
+
|
971 |
//default filter by date
|
972 |
if ( ! isset( $settings['export_rule_field'] ) ) {
|
973 |
$settings['export_rule_field'] = 'modified';
|
1022 |
|
1023 |
public static function get_date_range( $settings, $is_for_sql, $use_timestamps = false ) {
|
1024 |
$result = array();
|
1025 |
+
$diff_utc = current_time( "timestamp" ) - current_time( "timestamp", 1 );
|
1026 |
|
1027 |
// fixed date range
|
1028 |
if ( ! empty( $settings['from_date'] ) OR ! empty( $settings['to_date'] ) ) {
|
1035 |
}
|
1036 |
if ( $is_for_sql ) {
|
1037 |
if ( $use_timestamps ) {
|
1038 |
+
$from_date = mysql2date( 'G', $from_date );
|
1039 |
+
$from_date -= $diff_utc;
|
1040 |
}
|
1041 |
$from_date = sprintf( ">='%s'", $from_date );
|
1042 |
}
|
1052 |
}
|
1053 |
if ( $is_for_sql ) {
|
1054 |
if ( $use_timestamps ) {
|
1055 |
+
$to_date = mysql2date( 'G', $to_date );
|
1056 |
+
$to_date -= $diff_utc;
|
1057 |
}
|
1058 |
$to_date = sprintf( "<='%s'", $to_date );
|
1059 |
}
|
1159 |
if ( isset( $from_date ) AND $from_date ) {
|
1160 |
if ( $is_for_sql ) {
|
1161 |
if ( $use_timestamps ) {
|
1162 |
+
$from_date = mysql2date( 'G', $from_date );
|
1163 |
+
$from_date -= $diff_utc;
|
1164 |
}
|
1165 |
$from_date = sprintf( ">='%s'", $from_date );
|
1166 |
}
|
1170 |
if ( isset( $to_date ) AND $to_date ) {
|
1171 |
if ( $is_for_sql ) {
|
1172 |
if ( $use_timestamps ) {
|
1173 |
+
$to_date = mysql2date( 'G', $to_date );
|
1174 |
+
$to_date -= $diff_utc;
|
1175 |
}
|
1176 |
$to_date = sprintf( "<='%s'", $to_date );
|
1177 |
}
|
1250 |
$coupons = array();
|
1251 |
foreach ( $order->get_items( 'coupon' ) as $item ) {
|
1252 |
$coupon_meta = array();
|
1253 |
+
$get_coupon_meta = ( array_diff( $labels->get_keys(), array( 'code', 'discount_amount', 'discount_amount_tax', 'excerpt' ) ) );
|
1254 |
+
$coupon_object = new WC_Coupon( $item['name'] );
|
1255 |
+
|
1256 |
if ( $get_coupon_meta ) {
|
1257 |
$recs = $wpdb->get_results( $wpdb->prepare( "SELECT meta_value,meta_key FROM {$wpdb->postmeta} AS meta
|
1258 |
JOIN {$wpdb->posts} AS posts ON posts.ID = meta.post_id
|
1260 |
foreach ( $recs as $rec ) {
|
1261 |
$coupon_meta[ $rec->meta_key ] = $rec->meta_value;
|
1262 |
}
|
1263 |
+
|
1264 |
+
foreach ( $coupon_object->get_meta_data() as $meta) {
|
1265 |
+
$coupon_meta[ $meta->key ] = $meta->value;
|
1266 |
+
};
|
1267 |
}
|
1268 |
|
1269 |
$row = array();
|
1274 |
$row['code'] = $item["name"];
|
1275 |
} elseif ( $field == 'discount_amount_plus_tax' ) {
|
1276 |
$row['discount_amount_plus_tax'] = $item["discount_amount"] + $item["discount_amount_tax"];
|
1277 |
+
} elseif ( $field == 'excerpt' ) {
|
1278 |
+
$post = get_page_by_title( $item['name'], OBJECT, 'shop_' . $item['type'] );
|
1279 |
+
$row[ $field ] = $post ? $post->post_excerpt : '';
|
1280 |
} elseif ( isset( $coupon_meta[ $field ] ) ) {
|
1281 |
$row[ $field ] = $coupon_meta[ $field ];
|
1282 |
} elseif ( isset( $static_vals[ $field ] ) ) {
|
1284 |
} else {
|
1285 |
$row[ $field ] = '';
|
1286 |
}
|
1287 |
+
|
1288 |
$row[ $field ] = apply_filters( "woe_get_order_coupon_value_{$field}", $row[ $field ], $order,
|
1289 |
$item );
|
|
|
|
|
|
|
|
|
|
|
1290 |
}
|
1291 |
$row = apply_filters( 'woe_fetch_order_coupon', $row, $item, $coupon_meta );
|
1292 |
if ( $row ) {
|
1332 |
) {
|
1333 |
continue;
|
1334 |
}
|
1335 |
+
|
1336 |
$product = $order->get_product_from_item( $item );
|
1337 |
$product = apply_filters( "woe_get_order_product", $product );
|
1338 |
+
|
1339 |
$item_meta = get_metadata( 'order_item', $item_id );
|
1340 |
foreach ( $item_meta as $key => $value ) {
|
1341 |
$clear_key = wc_sanitize_taxonomy_name( $key );
|
1346 |
$item_meta[ 'attribute_' . $key ][0] = isset( $term->name ) ? $term->name : $value[0];
|
1347 |
}
|
1348 |
}
|
1349 |
+
|
1350 |
+
//some plugins encode meta keys!
|
1351 |
+
$key2 = html_entity_decode ($key,ENT_QUOTES);
|
1352 |
+
if( !isset($item_meta[$key2]) )
|
1353 |
+
$item_meta[$key2] = $item_meta[$key];
|
1354 |
}
|
1355 |
+
|
1356 |
$item_meta = apply_filters( "woe_get_order_product_item_meta", $item_meta );
|
1357 |
$product = apply_filters( "woe_get_order_product_and_item_meta", $product, $item_meta );
|
1358 |
if ( $product ) {
|
1424 |
$row[ $field ] = $post ? $post->post_content : '';
|
1425 |
} elseif ( $field == 'post_excerpt' ) {
|
1426 |
$row[ $field ] = $post ? $post->post_excerpt : '';
|
1427 |
+
} elseif ( $field == 'embedded_product_image' ) {
|
1428 |
+
$row[ $field ] = "";
|
1429 |
+
|
1430 |
+
if ( $post && get_post_thumbnail_id( $post->ID ) ) {
|
1431 |
+
$attachment_id = get_post_thumbnail_id( $post->ID );
|
1432 |
+
} else {
|
1433 |
+
$attachment_id = get_option( 'woocommerce_placeholder_image', 0 );
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
if ( is_array( $imagedata = wp_get_attachment_metadata( $attachment_id ) ) ) {
|
1437 |
+
$file = get_attached_file( $attachment_id );
|
1438 |
+
if ( ! empty( $imagedata['sizes']['woocommerce_thumbnail']['file'] ) ) {
|
1439 |
+
$thumbnail_base_name = $imagedata['sizes']['woocommerce_thumbnail']['file'];
|
1440 |
+
|
1441 |
+
if ( ( $thumbfile = str_replace( basename( $file ), $thumbnail_base_name, $file ) ) && file_exists( $thumbfile ) ) {
|
1442 |
+
$row[ $field ] = $thumbfile;
|
1443 |
+
}
|
1444 |
+
}
|
1445 |
+
}
|
1446 |
} elseif ( $field == 'type' ) {
|
1447 |
$row[ $field ] = '';
|
1448 |
if ( $product ) {
|
1512 |
} elseif ( $field == 'download_url' ) {
|
1513 |
$row[ $field ] = '';
|
1514 |
if ( $product AND $product->is_downloadable() ) {
|
1515 |
+
$files = get_post_meta( $product->get_id(), '_downloadable_files', true );
|
1516 |
$links = array();
|
1517 |
if ( $files ) {
|
1518 |
foreach ( $files as $file ) {
|
1521 |
}
|
1522 |
$row[ $field ] = implode( "\n", $links );
|
1523 |
}
|
1524 |
+
} elseif ( $field == 'item_download_url' ) {
|
1525 |
+
$row[ $field ] = '';
|
1526 |
+
if ( $product AND $product->is_downloadable() ) {
|
1527 |
+
$files = $item->get_item_downloads();
|
1528 |
+
$links = array();
|
1529 |
+
if ( $files ) {
|
1530 |
+
foreach ( $files as $file ) {
|
1531 |
+
$links[] = $file['download_url'];
|
1532 |
+
}
|
1533 |
+
}
|
1534 |
+
$row[ $field ] = implode( "\n", $links );
|
1535 |
+
}
|
1536 |
} elseif ( $field == 'image_url' ) {
|
1537 |
// make full url, wp_get_attachment_image_src can return false
|
1538 |
$images_src = ( is_object( $product ) AND $product->get_image_id() ) ? wp_get_attachment_image_src( $product->get_image_id(),
|
1709 |
}
|
1710 |
|
1711 |
// we know parent!
|
1712 |
+
if ( ( $export['products'] || $options['include_products'] ) && ! empty( $labels['products'] ) ||
|
1713 |
+
isset( $labels['order']->count_unique_products ) || isset( $labels['order']->total_weight_items ) ) {
|
1714 |
+
// no labels for products??
|
1715 |
+
$tmp_labels = ! empty( $labels['products'] ) ? clone $labels['products'] : new WC_Order_Export_Labels();
|
1716 |
//need qty?
|
1717 |
+
if ( isset( $labels['order']->total_weight_items ) || isset( $labels['order']->count_unique_products ) ) {
|
1718 |
if ( ! isset( $tmp_labels->qty ) ) {
|
1719 |
$tmp_labels->qty = "";
|
1720 |
}
|
1725 |
$tmp_labels->weight = "";
|
1726 |
}
|
1727 |
}
|
1728 |
+
|
1729 |
$data['products'] = self::fetch_order_products(
|
1730 |
$order,
|
1731 |
$tmp_labels,
|
1753 |
// extra WP_User
|
1754 |
$user = ! empty( $order_meta['_customer_user'] ) ? get_userdata( $order_meta['_customer_user'] ) : false;
|
1755 |
// setup missed fields for full addresses
|
1756 |
+
$optional_fields = array( '_billing_address_1', '_billing_address_2', '_billing_first_name', '_billing_last_name', '_shipping_address_1', '_shipping_address_2', '_shipping_first_name', '_shipping_last_name' );
|
1757 |
+
foreach ($optional_fields as $optional_field ) {
|
1758 |
if ( ! isset( $order_meta[ $optional_field ] ) ) {
|
1759 |
$order_meta[ $optional_field ] = '';
|
1760 |
}
|
1843 |
$row[ $field ] = ( isset( $user->roles[0] ) && isset( $roles[ $user->roles[0] ] ) ) ? $roles[ $user->roles[0] ]['name'] : ""; // take first role Name
|
1844 |
} elseif ( $field == 'customer_total_orders' ) {
|
1845 |
$row[ $field ] = ( isset( $user->ID ) ) ? wc_get_customer_order_count( $user->ID ) : 0;
|
1846 |
+
} elseif ( $field == 'customer_first_order_date' ) {
|
1847 |
+
$order = ( isset( $user->ID ) ) ? self::get_customer_order( $user->ID, 'first' ) : false;
|
1848 |
+
$row[ $field ] = $order ? ( $order->get_date_created() ? gmdate( 'Y-m-d H:i:s',
|
1849 |
+
$order->get_date_created()->getOffsetTimestamp() ) : '' ) : '';
|
1850 |
+
} elseif ( $field == 'customer_last_order_date' ) {
|
1851 |
+
$order = ( isset( $user->ID ) ) ? self::get_customer_order( $user->ID, 'last' ) : false;
|
1852 |
+
$row[ $field ] = $order ? ( $order->get_date_created() ? gmdate( 'Y-m-d H:i:s',
|
1853 |
+
$order->get_date_created()->getOffsetTimestamp() ) : '' ) : '';
|
1854 |
} elseif ( $field == 'billing_address' ) {
|
1855 |
$row[ $field ] = join( ", ",
|
1856 |
array_filter( array( $order_meta["_billing_address_1"], $order_meta["_billing_address_2"] ) ) );
|
1874 |
} elseif ( $field == 'billing_citystatezip' ) {
|
1875 |
$row[ $field ] = self::get_city_state_postcode_field_value( $order, 'billing' );
|
1876 |
} elseif ( $field == 'billing_citystatezip_us' ) {
|
1877 |
+
$row[ $field ] = self::get_city_state_postcode_field_value( $order, 'billing', true );
|
1878 |
} elseif ( $field == 'shipping_citystatezip' ) {
|
1879 |
$row[ $field ] = self::get_city_state_postcode_field_value( $order, 'shipping' );
|
1880 |
} elseif ( $field == 'shipping_citystatezip_us' ) {
|
1881 |
+
$row[ $field ] = self::get_city_state_postcode_field_value( $order, 'shipping', true );
|
1882 |
} elseif ( $field == 'products' OR $field == 'coupons' ) {
|
1883 |
if ( isset( $data[ $field ] ) ) {
|
1884 |
$row[ $field ] = $data[ $field ];
|
1885 |
}
|
1886 |
} elseif ( $field == 'shipping_method_title' ) {
|
1887 |
$row[ $field ] = $order->get_shipping_method();
|
1888 |
+
} elseif ( $field == 'shipping_method' OR $field == 'shipping_method_only') {
|
1889 |
$shipping_methods = $order->get_items( 'shipping' );
|
1890 |
$shipping_method = reset( $shipping_methods ); // take first entry
|
1891 |
if ( ! empty( $shipping_method ) ) {
|
1892 |
+
$row[ $field ] = $field == 'shipping_method_only' ? $shipping_method['method_id'] : $shipping_method['method_id'] . ':' . $shipping_method['instance_id'];
|
1893 |
}
|
1894 |
} elseif ( $field == 'coupons_used' ) {
|
1895 |
$row[ $field ] = count( $data['coupons'] );
|
1950 |
}
|
1951 |
}
|
1952 |
$row[ $field ] = implode( "\n", $comments );
|
1953 |
+
} elseif ( $field == 'embedded_edit_order_link' ) {
|
1954 |
+
$row[ $field ] = sprintf(
|
1955 |
+
'<a href="%s" target="_blank">%s</a>',
|
1956 |
+
get_edit_post_link($order_id),
|
1957 |
+
__( 'Edit order', 'woo-order-export-lite' )
|
1958 |
+
);
|
1959 |
} elseif ( isset( $order_meta[ $field ] ) ) {
|
1960 |
$field_data = array();
|
1961 |
do_action( 'woocommerce_order_export_add_field_data', $field_data, $order_meta[ $field ], $field );
|
1987 |
}
|
1988 |
|
1989 |
//no labels - no data !
|
1990 |
+
if ( empty( $labels['products'] ) ) {
|
1991 |
+
$row['products'] = array();
|
1992 |
}
|
1993 |
+
if ( empty( $labels['coupons'] ) ) {
|
1994 |
+
$row['coupons'] = array();
|
1995 |
}
|
1996 |
+
|
1997 |
$row = apply_filters( "woe_fetch_order", $row, $order );
|
1998 |
|
1999 |
return $row;
|
2000 |
}
|
2001 |
|
2002 |
+
public static function get_city_state_postcode_field_value( $order, $type, $us_format = false ) {
|
2003 |
if ( $type != 'shipping' && $type != 'billing' ) {
|
2004 |
return null;
|
2005 |
}
|
2014 |
'get_' . $field_name ) ? $order->{'get_' . $field_name}() : $order->{$field_name};
|
2015 |
}
|
2016 |
|
2017 |
+
if ( $us_format ) {
|
2018 |
//reformat as "Austin, TX 95076"
|
2019 |
+
$parts[] = $citystatepostcode[ $type . '_city' ];
|
2020 |
$parts[] = trim( $citystatepostcode[ $type . '_state' ] . " " . $citystatepostcode[ $type . '_postcode' ] );
|
2021 |
} else {
|
2022 |
$parts = $citystatepostcode;
|
2023 |
+
}
|
2024 |
+
|
2025 |
return join( ", ", $parts );
|
2026 |
}
|
2027 |
|
2143 |
return $shipping_methods;
|
2144 |
}
|
2145 |
|
2146 |
+
private static function get_customer_order( $customer_id, $first_or_last ) {
|
2147 |
+
global $wpdb;
|
2148 |
+
|
2149 |
+
if ( 'first' === $first_or_last ) {
|
2150 |
+
$direction = 'ASC';
|
2151 |
+
} else if ( 'last' === $first_or_last ) {
|
2152 |
+
$direction = 'DESC';
|
2153 |
+
} else {
|
2154 |
+
return false;
|
2155 |
+
}
|
2156 |
+
|
2157 |
+
$order = $wpdb->get_var(
|
2158 |
+
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
|
2159 |
+
"SELECT posts.ID
|
2160 |
+
FROM $wpdb->posts AS posts
|
2161 |
+
LEFT JOIN {$wpdb->postmeta} AS meta on posts.ID = meta.post_id
|
2162 |
+
WHERE meta.meta_key = '_customer_user'
|
2163 |
+
AND meta.meta_value = '" . esc_sql( $customer_id ) . "'
|
2164 |
+
AND posts.post_type = 'shop_order'
|
2165 |
+
AND posts.post_status IN ( '" . implode( "','", array_map( 'esc_sql', array_keys( wc_get_order_statuses() ) ) ) . "' )
|
2166 |
+
ORDER BY posts.ID {$direction}"
|
2167 |
+
// phpcs:enable
|
2168 |
+
);
|
2169 |
+
|
2170 |
+
if ( ! $order ) {
|
2171 |
+
return false;
|
2172 |
+
}
|
2173 |
+
|
2174 |
+
return wc_get_order( absint( $order ) );
|
2175 |
+
}
|
2176 |
+
|
2177 |
}
|
classes/core/class-wc-order-export-engine.php
CHANGED
@@ -10,89 +10,10 @@ class WC_Order_Export_Engine {
|
|
10 |
public static $date_format;
|
11 |
|
12 |
public static $order_id = '';
|
|
|
13 |
public static $orders_exported = 0;
|
14 |
public static $make_separate_orders = false;
|
15 |
|
16 |
-
//
|
17 |
-
public static function export( $settings, $filepath ) {
|
18 |
-
if ( empty( $settings['destination']['type'] ) ) {
|
19 |
-
return __( "No destination selected", 'woo-order-export-lite' );
|
20 |
-
}
|
21 |
-
|
22 |
-
if ( ! is_array( $settings['destination']['type'] ) ) {
|
23 |
-
$settings['destination']['type'] = array( $settings['destination']['type'] );
|
24 |
-
}
|
25 |
-
$results = array();
|
26 |
-
foreach ( $settings['destination']['type'] as $export_type ) {
|
27 |
-
$export_type = strtolower( $export_type );
|
28 |
-
if ( ! in_array( strtoupper( $export_type ), WC_Order_Export_Admin::$export_types ) ) {
|
29 |
-
return __( "Wrong format", 'woo-order-export-lite' );
|
30 |
-
}
|
31 |
-
|
32 |
-
include_once dirname( dirname( __FILE__ ) ) . "/exports/abstract-class-woe-export.php";
|
33 |
-
include_once dirname( dirname( __FILE__ ) ) . "/exports/class-woe-export-{$export_type}.php";
|
34 |
-
$class = 'WOE_Export_' . $export_type;
|
35 |
-
$exporter = new $class( $settings['destination'] );
|
36 |
-
|
37 |
-
$filename = self::make_filename( $settings['export_filename'] );
|
38 |
-
$custom_export = apply_filters( 'woe_custom_export_to_' . $export_type, false, $filename, $filepath,
|
39 |
-
$exporter );
|
40 |
-
if ( ! $custom_export ) {
|
41 |
-
// try many times?
|
42 |
-
$num_retries = 0;
|
43 |
-
while ( $num_retries < $exporter->get_num_of_retries() ) {
|
44 |
-
$num_retries ++;
|
45 |
-
$results[] = $exporter->run_export( $filename, $filepath );
|
46 |
-
if ( $exporter->finished_successfully ) {
|
47 |
-
break;
|
48 |
-
}
|
49 |
-
}
|
50 |
-
do_action( "woe_export_destination_finished", $exporter->finished_successfully, $export_type, $filename,
|
51 |
-
$filepath, $settings, $exporter );
|
52 |
-
} else {
|
53 |
-
$results[] = $custom_export;
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
return implode( "<br>\r\n", $results );
|
58 |
-
}
|
59 |
-
|
60 |
-
/* Zapier will pull files! */
|
61 |
-
public static function prepare( $settings, $filepath ) {
|
62 |
-
if ( empty( $settings['destination']['type'] ) ) {
|
63 |
-
return __( "No destination selected", 'woo-order-export-lite' );
|
64 |
-
}
|
65 |
-
|
66 |
-
if ( ! is_array( $settings['destination']['type'] ) ) {
|
67 |
-
$settings['destination']['type'] = array( $settings['destination']['type'] );
|
68 |
-
}
|
69 |
-
$results = array();
|
70 |
-
foreach ( $settings['destination']['type'] as $export_type ) {
|
71 |
-
$export_type = strtolower( $export_type );
|
72 |
-
if ( ! in_array( strtoupper( $export_type ), WC_Order_Export_Admin::$export_types ) ) {
|
73 |
-
return __( "Wrong export type", 'woo-order-export-lite' );
|
74 |
-
}
|
75 |
-
|
76 |
-
include_once dirname( dirname( __FILE__ ) ) . "/exports/abstract-class-woe-export.php";
|
77 |
-
include_once dirname( dirname( __FILE__ ) ) . "/exports/class-woe-export-{$export_type}.php";
|
78 |
-
$class = 'WOE_Export_' . $export_type;
|
79 |
-
$exporter = new $class( $settings['destination'] );
|
80 |
-
|
81 |
-
$filename = self::make_filename( $settings['export_filename'] );
|
82 |
-
$custom_prepare = apply_filters( 'woe_custom_prepare_to_' . $export_type, false, $filename, $filepath,
|
83 |
-
$exporter );
|
84 |
-
if ( ! $custom_prepare ) {
|
85 |
-
if ( method_exists( $exporter, 'prepare' ) ) {
|
86 |
-
$results[] = $exporter->prepare( $filename, $filepath );
|
87 |
-
}
|
88 |
-
} else {
|
89 |
-
$results[] = $custom_prepare;
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
return $results;
|
94 |
-
}
|
95 |
-
|
96 |
public static function make_filename( $mask ) {
|
97 |
if ( self::$make_separate_orders && strpos( $mask, '%order_id' ) === false ) {
|
98 |
$mask_parts = explode( '.', $mask );
|
@@ -143,7 +64,7 @@ class WC_Order_Export_Engine {
|
|
143 |
return $filename;
|
144 |
}
|
145 |
|
146 |
-
|
147 |
$fields = $settings['order_fields'];
|
148 |
|
149 |
$labels = new WC_Order_Export_Labels();
|
@@ -186,7 +107,7 @@ class WC_Order_Export_Engine {
|
|
186 |
}
|
187 |
|
188 |
/* process product/coupon fields*/
|
189 |
-
|
190 |
$labels = new WC_Order_Export_Labels();
|
191 |
$static_fields = array();
|
192 |
$field_formats = array();
|
@@ -242,7 +163,7 @@ class WC_Order_Export_Engine {
|
|
242 |
*
|
243 |
* @return WOE_Formatter
|
244 |
*/
|
245 |
-
|
246 |
$format = strtolower( $settings['format'] );
|
247 |
include_once dirname( dirname( __FILE__ ) ) . "/formats/abstract-class-woe-formatter.php";
|
248 |
if ( ! apply_filters( 'woe_load_custom_formatter_' . $format, false ) ) {
|
@@ -267,7 +188,7 @@ class WC_Order_Export_Engine {
|
|
267 |
$offset );
|
268 |
}
|
269 |
|
270 |
-
|
271 |
$format = strtolower( $settings['format'] );
|
272 |
|
273 |
// $static_vals = array( 'order' => array(), 'products' => array(), 'coupons' => array() );
|
@@ -280,7 +201,7 @@ class WC_Order_Export_Engine {
|
|
280 |
// $field_formats ),
|
281 |
// );
|
282 |
|
283 |
-
$field_formats_ar = array( 'money', 'number', 'date', 'string' );
|
284 |
$labels_data = array(
|
285 |
'order' => self::get_order_labels( $settings, $format, $field_formats_ar ),
|
286 |
'products' => self::get_sub_segment_labels( 'product', $settings, $format, $field_formats_ar ),
|
@@ -309,7 +230,7 @@ class WC_Order_Export_Engine {
|
|
309 |
* @param $settings
|
310 |
* @param $export
|
311 |
*/
|
312 |
-
|
313 |
$export['products'] = false;
|
314 |
$export['coupons'] = false;
|
315 |
foreach ( $settings['order_fields'] as $field ) {
|
@@ -326,7 +247,7 @@ class WC_Order_Export_Engine {
|
|
326 |
|
327 |
}
|
328 |
|
329 |
-
|
330 |
global $wpdb;
|
331 |
|
332 |
$format = strtolower( $settings['format'] );
|
@@ -386,7 +307,7 @@ class WC_Order_Export_Engine {
|
|
386 |
return $options;
|
387 |
}
|
388 |
|
389 |
-
|
390 |
if ( empty( $settings['sort'] ) ) {
|
391 |
$settings['sort'] = 'order_id';
|
392 |
}
|
@@ -409,7 +330,7 @@ class WC_Order_Export_Engine {
|
|
409 |
return apply_filters( 'woe_settings_validate_defaults', $settings );
|
410 |
}
|
411 |
|
412 |
-
|
413 |
$error = error_get_last();
|
414 |
|
415 |
if ( is_null( $error ) ) {
|
@@ -424,14 +345,14 @@ class WC_Order_Export_Engine {
|
|
424 |
return $m;
|
425 |
}
|
426 |
|
427 |
-
|
428 |
if ( isset( $settings['change_order_status_to'] ) && wc_is_order_status( $settings['change_order_status_to'] ) ) {
|
429 |
$order = new WC_Order( $order_id );
|
430 |
$order->update_status( $settings['change_order_status_to'] );
|
431 |
}
|
432 |
}
|
433 |
|
434 |
-
|
435 |
if ( $settings['mark_exported_orders'] ) {
|
436 |
update_post_meta( $order_id, 'woe_order_exported', current_time( 'timestamp' ) );
|
437 |
}
|
@@ -456,7 +377,7 @@ class WC_Order_Export_Engine {
|
|
456 |
if ( $make_mode == 'preview' AND $settings['enable_debug'] ) {
|
457 |
WC_Order_Export_Data_Extractor::start_track_queries();
|
458 |
}
|
459 |
-
// might run sql!
|
460 |
self::$extractor_options = self::_install_options( $settings );
|
461 |
|
462 |
if ( $output_mode == 'browser' ) {
|
@@ -480,6 +401,7 @@ class WC_Order_Export_Engine {
|
|
480 |
|
481 |
//get IDs
|
482 |
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
|
|
483 |
if ( $make_mode == 'estimate' ) { //if estimate return total count
|
484 |
return $wpdb->get_var( str_replace( 'ID AS order_id', 'COUNT(ID) AS order_count', $sql ) );
|
485 |
} elseif ( $make_mode == 'preview' ) {
|
@@ -494,6 +416,7 @@ class WC_Order_Export_Engine {
|
|
494 |
}
|
495 |
|
496 |
$order_ids = apply_filters( "woe_get_order_ids", $wpdb->get_col( $sql ) );
|
|
|
497 |
|
498 |
// prepare for XLS/CSV moved to plain formatter
|
499 |
|
@@ -541,7 +464,7 @@ class WC_Order_Export_Engine {
|
|
541 |
$formater->finish_partial();
|
542 |
} elseif ( $make_mode == 'preview' ) {
|
543 |
// self::maybe_output_summary_report( $formater );
|
544 |
-
//limit debug output
|
545 |
if ( $settings['enable_debug'] AND self::is_plain_format( $settings['format'] ) ) {
|
546 |
echo "<b>" . __( 'Main SQL queries are listed below', 'woo-order-export-lite' ) . "</b>";
|
547 |
echo '<textarea rows=5 style="width:100%">';
|
@@ -577,17 +500,21 @@ class WC_Order_Export_Engine {
|
|
577 |
// self::maybe_init_summary_report( $labels );
|
578 |
// self::maybe_start_summary_report();
|
579 |
|
|
|
|
|
|
|
580 |
//get IDs
|
581 |
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
|
|
582 |
$sql .= apply_filters( "woe_sql_get_order_ids_order_by",
|
583 |
" ORDER BY " . $settings['sort'] . " " . $settings['sort_direction'] );
|
584 |
|
585 |
if ( $limit ) {
|
586 |
$sql .= " LIMIT " . intval( $limit );
|
587 |
}
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
|
592 |
if ( empty( $order_ids ) AND apply_filters( 'woe_schedule_job_skip_empty_file',
|
593 |
(bool) $settings['skip_empty_file'] ) ) {
|
@@ -640,132 +567,26 @@ class WC_Order_Export_Engine {
|
|
640 |
return $filename;
|
641 |
}
|
642 |
|
643 |
-
public static function
|
644 |
-
$
|
645 |
-
$filename = '',
|
646 |
-
$limit = 0,
|
647 |
-
$order_ids = array()
|
648 |
-
) {
|
649 |
-
global $wpdb;
|
650 |
-
|
651 |
-
self::kill_buffers();
|
652 |
-
$settings = self::validate_defaults( $settings );
|
653 |
-
self::$current_job_settings = $settings;
|
654 |
-
self::$current_job_build_mode = 'full';
|
655 |
-
self::$date_format = trim( $settings['date_format'] . ' ' . $settings['time_format'] );
|
656 |
-
self::$extractor_options = self::_install_options( $settings );
|
657 |
-
|
658 |
-
$filename = ( ! empty( $filename ) ? $filename : self::tempnam( sys_get_temp_dir(), $settings['format'] ) );
|
659 |
-
|
660 |
-
// $format = strtolower( $settings['format'] );
|
661 |
-
|
662 |
-
//get IDs
|
663 |
-
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
664 |
-
$sql .= apply_filters( "woe_sql_get_order_ids_order_by",
|
665 |
-
" ORDER BY " . $settings['sort'] . " " . $settings['sort_direction'] );
|
666 |
-
|
667 |
-
if ( $limit ) {
|
668 |
-
$sql .= " LIMIT " . intval( $limit );
|
669 |
-
}
|
670 |
-
|
671 |
-
if ( ! $order_ids ) {
|
672 |
-
$order_ids = apply_filters( "woe_get_order_ids", $wpdb->get_col( $sql ) );
|
673 |
-
}
|
674 |
-
|
675 |
-
if ( empty( $order_ids ) ) {
|
676 |
-
return false;
|
677 |
-
}
|
678 |
-
// prepare for XLS/CSV moved to plain formatter
|
679 |
-
|
680 |
-
// check it once
|
681 |
-
self::_check_products_and_coupons_fields( $settings, $export );
|
682 |
-
|
683 |
-
// make header moved to plain formatter
|
684 |
-
|
685 |
-
$result = false;
|
686 |
-
|
687 |
-
WC_Order_Export_Data_Extractor::prepare_for_export();
|
688 |
-
self::$make_separate_orders = true;
|
689 |
-
foreach ( $order_ids as $order_id ) {
|
690 |
-
$order_id = apply_filters( "woe_order_export_started", $order_id );
|
691 |
-
if ( ! $order_id ) {
|
692 |
-
continue;
|
693 |
-
}
|
694 |
-
self::$order_id = $order_id;
|
695 |
-
$formater = self::init_formater( '', $settings, $filename, $labels, $static_vals, 0 );
|
696 |
-
|
697 |
-
$formater->truncate();
|
698 |
-
$formater->start();
|
699 |
-
$row = WC_Order_Export_Data_Extractor::fetch_order_data( $order_id, $labels,
|
700 |
-
$export, $static_vals, self::$extractor_options );
|
701 |
-
$row = apply_filters( "woe_fetch_order_row", $row, $order_id );
|
702 |
-
|
703 |
-
if ( $row ) {
|
704 |
-
$formater->output( $row );
|
705 |
-
do_action( "woe_order_row_exported", $row, $order_id );
|
706 |
-
}
|
707 |
-
do_action( "woe_order_exported", $order_id );
|
708 |
-
self::$orders_exported = 1;
|
709 |
-
self::try_modify_status( $order_id, $settings );
|
710 |
-
self::try_mark_order( $order_id, $settings );
|
711 |
-
$formater->finish();
|
712 |
-
|
713 |
-
if ( $filename !== false ) {
|
714 |
-
$result = self::export( $settings, $filename );
|
715 |
-
//if ($result) {
|
716 |
-
// return $result;
|
717 |
-
//}
|
718 |
-
}
|
719 |
-
self::$order_id = '';
|
720 |
-
}
|
721 |
-
|
722 |
-
do_action( 'woe_export_finished' );
|
723 |
-
|
724 |
-
return $result; //return last result
|
725 |
}
|
726 |
|
727 |
-
|
728 |
-
|
729 |
-
if ( ! empty( $settings['destination']['separate_files'] ) ) {
|
730 |
-
$result = self::build_separate_files_and_export( $settings, $filename, $limit, $order_ids );
|
731 |
-
} else {
|
732 |
-
$file = self::build_file_full( $settings, $filename, $limit, $order_ids );
|
733 |
-
if ( $file !== false ) {
|
734 |
-
|
735 |
-
$result = self::export( $settings, $file );
|
736 |
-
|
737 |
-
if ( file_exists( $file ) ) {
|
738 |
-
unlink( $file );
|
739 |
-
}
|
740 |
-
|
741 |
-
} else {
|
742 |
-
$result = false;
|
743 |
-
}
|
744 |
-
}
|
745 |
-
|
746 |
-
if ( $result === false ) {
|
747 |
-
$result = __( 'Nothing to export. Please, adjust your filters', 'woo-order-export-lite' );
|
748 |
-
}
|
749 |
-
|
750 |
-
return $result;
|
751 |
}
|
752 |
|
753 |
-
public static function
|
754 |
-
$
|
755 |
-
if ( $file !== false ) {
|
756 |
-
$result = self::prepare( $settings, $file );
|
757 |
-
|
758 |
-
return $result;
|
759 |
-
} else {
|
760 |
-
return __( 'Nothing to export. Please, adjust your filters', 'woo-order-export-lite' );
|
761 |
-
}
|
762 |
-
}
|
763 |
|
764 |
-
|
765 |
-
return in_array( strtolower( $format ), self::get_plain_formats() );
|
766 |
}
|
767 |
|
768 |
-
public static function
|
769 |
-
return array(
|
|
|
|
|
|
|
|
|
|
|
770 |
}
|
771 |
}
|
10 |
public static $date_format;
|
11 |
|
12 |
public static $order_id = '';
|
13 |
+
public static $orders_for_export = array();
|
14 |
public static $orders_exported = 0;
|
15 |
public static $make_separate_orders = false;
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
public static function make_filename( $mask ) {
|
18 |
if ( self::$make_separate_orders && strpos( $mask, '%order_id' ) === false ) {
|
19 |
$mask_parts = explode( '.', $mask );
|
64 |
return $filename;
|
65 |
}
|
66 |
|
67 |
+
protected static function get_order_labels( $settings, $format, $field_formats_list ) {
|
68 |
$fields = $settings['order_fields'];
|
69 |
|
70 |
$labels = new WC_Order_Export_Labels();
|
107 |
}
|
108 |
|
109 |
/* process product/coupon fields*/
|
110 |
+
protected static function get_sub_segment_labels( $segment, $settings, $format, $field_formats_list ) {
|
111 |
$labels = new WC_Order_Export_Labels();
|
112 |
$static_fields = array();
|
113 |
$field_formats = array();
|
163 |
*
|
164 |
* @return WOE_Formatter
|
165 |
*/
|
166 |
+
protected static function init_formater( $mode, $settings, $fname, &$labels, &$static_vals, $offset ) {
|
167 |
$format = strtolower( $settings['format'] );
|
168 |
include_once dirname( dirname( __FILE__ ) ) . "/formats/abstract-class-woe-formatter.php";
|
169 |
if ( ! apply_filters( 'woe_load_custom_formatter_' . $format, false ) ) {
|
188 |
$offset );
|
189 |
}
|
190 |
|
191 |
+
protected static function init_labels( $settings, &$labels, &$static_vals, &$field_formats ) {
|
192 |
$format = strtolower( $settings['format'] );
|
193 |
|
194 |
// $static_vals = array( 'order' => array(), 'products' => array(), 'coupons' => array() );
|
201 |
// $field_formats ),
|
202 |
// );
|
203 |
|
204 |
+
$field_formats_ar = array( 'money', 'number', 'date', 'string', 'image' );
|
205 |
$labels_data = array(
|
206 |
'order' => self::get_order_labels( $settings, $format, $field_formats_ar ),
|
207 |
'products' => self::get_sub_segment_labels( 'product', $settings, $format, $field_formats_ar ),
|
230 |
* @param $settings
|
231 |
* @param $export
|
232 |
*/
|
233 |
+
protected static function _check_products_and_coupons_fields( $settings, &$export ) {
|
234 |
$export['products'] = false;
|
235 |
$export['coupons'] = false;
|
236 |
foreach ( $settings['order_fields'] as $field ) {
|
247 |
|
248 |
}
|
249 |
|
250 |
+
protected static function _install_options( $settings ) {
|
251 |
global $wpdb;
|
252 |
|
253 |
$format = strtolower( $settings['format'] );
|
307 |
return $options;
|
308 |
}
|
309 |
|
310 |
+
protected static function validate_defaults( $settings ) {
|
311 |
if ( empty( $settings['sort'] ) ) {
|
312 |
$settings['sort'] = 'order_id';
|
313 |
}
|
330 |
return apply_filters( 'woe_settings_validate_defaults', $settings );
|
331 |
}
|
332 |
|
333 |
+
protected static function code_error_callback( $out ) {
|
334 |
$error = error_get_last();
|
335 |
|
336 |
if ( is_null( $error ) ) {
|
345 |
return $m;
|
346 |
}
|
347 |
|
348 |
+
protected static function try_modify_status( $order_id, $settings ) {
|
349 |
if ( isset( $settings['change_order_status_to'] ) && wc_is_order_status( $settings['change_order_status_to'] ) ) {
|
350 |
$order = new WC_Order( $order_id );
|
351 |
$order->update_status( $settings['change_order_status_to'] );
|
352 |
}
|
353 |
}
|
354 |
|
355 |
+
protected static function try_mark_order( $order_id, $settings ) {
|
356 |
if ( $settings['mark_exported_orders'] ) {
|
357 |
update_post_meta( $order_id, 'woe_order_exported', current_time( 'timestamp' ) );
|
358 |
}
|
377 |
if ( $make_mode == 'preview' AND $settings['enable_debug'] ) {
|
378 |
WC_Order_Export_Data_Extractor::start_track_queries();
|
379 |
}
|
380 |
+
// might run sql!
|
381 |
self::$extractor_options = self::_install_options( $settings );
|
382 |
|
383 |
if ( $output_mode == 'browser' ) {
|
401 |
|
402 |
//get IDs
|
403 |
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
404 |
+
$settings = self::replace_sort_field( $settings );
|
405 |
if ( $make_mode == 'estimate' ) { //if estimate return total count
|
406 |
return $wpdb->get_var( str_replace( 'ID AS order_id', 'COUNT(ID) AS order_count', $sql ) );
|
407 |
} elseif ( $make_mode == 'preview' ) {
|
416 |
}
|
417 |
|
418 |
$order_ids = apply_filters( "woe_get_order_ids", $wpdb->get_col( $sql ) );
|
419 |
+
self::$orders_for_export = $order_ids;
|
420 |
|
421 |
// prepare for XLS/CSV moved to plain formatter
|
422 |
|
464 |
$formater->finish_partial();
|
465 |
} elseif ( $make_mode == 'preview' ) {
|
466 |
// self::maybe_output_summary_report( $formater );
|
467 |
+
//limit debug output
|
468 |
if ( $settings['enable_debug'] AND self::is_plain_format( $settings['format'] ) ) {
|
469 |
echo "<b>" . __( 'Main SQL queries are listed below', 'woo-order-export-lite' ) . "</b>";
|
470 |
echo '<textarea rows=5 style="width:100%">';
|
500 |
// self::maybe_init_summary_report( $labels );
|
501 |
// self::maybe_start_summary_report();
|
502 |
|
503 |
+
// deprecated second argument (was $sql)
|
504 |
+
$order_ids = apply_filters( "woe_pre_get_order_ids", $order_ids, "" );
|
505 |
+
$settings['order_ids'] = $order_ids;
|
506 |
//get IDs
|
507 |
$sql = WC_Order_Export_Data_Extractor::sql_get_order_ids( $settings );
|
508 |
+
$settings = self::replace_sort_field( $settings );
|
509 |
$sql .= apply_filters( "woe_sql_get_order_ids_order_by",
|
510 |
" ORDER BY " . $settings['sort'] . " " . $settings['sort_direction'] );
|
511 |
|
512 |
if ( $limit ) {
|
513 |
$sql .= " LIMIT " . intval( $limit );
|
514 |
}
|
515 |
+
|
516 |
+
$order_ids = apply_filters( "woe_get_order_ids", $wpdb->get_col( $sql ) );
|
517 |
+
self::$orders_for_export = $order_ids;
|
518 |
|
519 |
if ( empty( $order_ids ) AND apply_filters( 'woe_schedule_job_skip_empty_file',
|
520 |
(bool) $settings['skip_empty_file'] ) ) {
|
567 |
return $filename;
|
568 |
}
|
569 |
|
570 |
+
public static function is_plain_format( $format ) {
|
571 |
+
return in_array( strtolower( $format ), self::get_plain_formats() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
572 |
}
|
573 |
|
574 |
+
public static function get_plain_formats() {
|
575 |
+
return array( 'xls', 'csv', 'tsv', 'pdf', 'html' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
}
|
577 |
|
578 |
+
public static function replace_sort_field( $settings ) {
|
579 |
+
$settings['sort'] = ! in_array( $settings['sort'], self::get_wp_posts_fields() ) ? 'meta_value' : $settings['sort'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
|
581 |
+
return $settings;
|
|
|
582 |
}
|
583 |
|
584 |
+
public static function get_wp_posts_fields() {
|
585 |
+
return array(
|
586 |
+
'order_id',
|
587 |
+
'post_date',
|
588 |
+
'post_modified',
|
589 |
+
'post_status',
|
590 |
+
);
|
591 |
}
|
592 |
}
|
classes/formats/abstract-class-woe-formatter-plain-format.php
CHANGED
@@ -10,6 +10,7 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
|
|
10 |
private $duplicate_settings = array();
|
11 |
private $summary_report;
|
12 |
protected $rows;
|
|
|
13 |
|
14 |
protected $summary_processing = false;
|
15 |
|
@@ -28,9 +29,11 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
|
|
28 |
$this->summary_report = $this->settings['global_job_settings']['summary_report_by_products'];
|
29 |
if ( $this->summary_report ) {
|
30 |
self::check_create_session();
|
31 |
-
$this->field_formats["order"] = $this->field_formats["products"];// Products at top level!
|
32 |
}
|
33 |
$this->summary_processing = false; //true only when we finish order scan
|
|
|
|
|
34 |
}
|
35 |
|
36 |
public function output( $rec ) {
|
@@ -53,7 +56,7 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
|
|
53 |
//get modes
|
54 |
$products_repeat = $this->duplicate_settings['products']['repeat'];
|
55 |
$coupons_repeat = $this->duplicate_settings['coupons']['repeat'];
|
56 |
-
|
57 |
$tmp_rec = array();
|
58 |
foreach ( $this->labels['order']->get_labels() as $label_data ) {
|
59 |
$original_key = $label_data['key'];
|
@@ -63,7 +66,7 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
|
|
63 |
}
|
64 |
$rec = $tmp_rec;
|
65 |
|
66 |
-
|
67 |
//simpleast
|
68 |
if ( $products_repeat == 'inside_one_cell' ) {
|
69 |
$rec = $this->merge_nested_rows_to_one_record( $rec, 'products' );
|
@@ -102,6 +105,10 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
|
|
102 |
}
|
103 |
if ( isset( $row['line_number'] ) && $index > 0 ) {
|
104 |
$row['line_number'] = $this->counter_value;
|
|
|
|
|
|
|
|
|
105 |
$this->counter_value ++;
|
106 |
}
|
107 |
|
@@ -122,6 +129,8 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
|
|
122 |
$repeat['products'] = $this->duplicate_settings['products']['repeat'];
|
123 |
$repeat['coupons'] = $this->duplicate_settings['coupons']['repeat'];
|
124 |
|
|
|
|
|
125 |
if ( $this->summary_report ) {
|
126 |
return $this->make_summary_header( $data );
|
127 |
}
|
@@ -142,6 +151,9 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
|
|
142 |
$added_to_group = false;
|
143 |
|
144 |
if ( preg_match( '/^plain_(products|coupons)_.+/', $field, $matches ) ) {
|
|
|
|
|
|
|
145 |
$type = $matches[1];
|
146 |
$current_group_type = $type;
|
147 |
if ( 'columns' == $repeat[ $type ] ) {
|
@@ -206,6 +218,9 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
|
|
206 |
self::check_create_session();
|
207 |
$_SESSION['woe_summary_products'] = array();
|
208 |
|
|
|
|
|
|
|
209 |
foreach ( $this->labels['products']->get_labels() as $label_data ) {
|
210 |
$field_header = $label_data['label'];
|
211 |
$key = $label_data['key'];
|
@@ -281,15 +296,15 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
|
|
281 |
protected function try_apply_summary_report_fields() {
|
282 |
if ( $this->summary_report ) {
|
283 |
$this->summary_processing = true;
|
284 |
-
|
285 |
//sort by name
|
286 |
-
$first_row = reset($_SESSION['woe_summary_products']);
|
287 |
if ( isset( $first_row['name'] ) ) {
|
288 |
-
uasort($_SESSION['woe_summary_products'], function($a
|
289 |
-
return strcmp($a['name']
|
290 |
-
});
|
291 |
}
|
292 |
-
|
293 |
do_action( 'woe_summary_before_output' );
|
294 |
if ( $this->mode == 'preview' ) {
|
295 |
if ( empty( $this->rows ) ) // no headers!
|
@@ -305,4 +320,45 @@ abstract class WOE_Formatter_Plain_Format extends WOE_Formatter {
|
|
305 |
}
|
306 |
}
|
307 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
}
|
10 |
private $duplicate_settings = array();
|
11 |
private $summary_report;
|
12 |
protected $rows;
|
13 |
+
var $encoding;
|
14 |
|
15 |
protected $summary_processing = false;
|
16 |
|
29 |
$this->summary_report = $this->settings['global_job_settings']['summary_report_by_products'];
|
30 |
if ( $this->summary_report ) {
|
31 |
self::check_create_session();
|
32 |
+
$this->field_formats["order"] = isset($this->field_formats["products"]) ? $this->field_formats["products"] : array() ;// Products at top level!
|
33 |
}
|
34 |
$this->summary_processing = false; //true only when we finish order scan
|
35 |
+
|
36 |
+
$this->encoding = isset( $this->settings['encoding'] ) ? $this->settings['encoding'] : '';
|
37 |
}
|
38 |
|
39 |
public function output( $rec ) {
|
56 |
//get modes
|
57 |
$products_repeat = $this->duplicate_settings['products']['repeat'];
|
58 |
$coupons_repeat = $this->duplicate_settings['coupons']['repeat'];
|
59 |
+
|
60 |
$tmp_rec = array();
|
61 |
foreach ( $this->labels['order']->get_labels() as $label_data ) {
|
62 |
$original_key = $label_data['key'];
|
66 |
}
|
67 |
$rec = $tmp_rec;
|
68 |
|
69 |
+
|
70 |
//simpleast
|
71 |
if ( $products_repeat == 'inside_one_cell' ) {
|
72 |
$rec = $this->merge_nested_rows_to_one_record( $rec, 'products' );
|
105 |
}
|
106 |
if ( isset( $row['line_number'] ) && $index > 0 ) {
|
107 |
$row['line_number'] = $this->counter_value;
|
108 |
+
foreach( $row as $k=>$v ) {
|
109 |
+
if( preg_match("#^line_number_\d+$#",$k) )
|
110 |
+
$row[$k] = $row['line_number'];
|
111 |
+
}
|
112 |
$this->counter_value ++;
|
113 |
}
|
114 |
|
129 |
$repeat['products'] = $this->duplicate_settings['products']['repeat'];
|
130 |
$repeat['coupons'] = $this->duplicate_settings['coupons']['repeat'];
|
131 |
|
132 |
+
$item_rows_start_from_new_line = ( $this->format == 'csv' && $this->settings['global_job_settings']['format_csv_item_rows_start_from_new_line'] );
|
133 |
+
|
134 |
if ( $this->summary_report ) {
|
135 |
return $this->make_summary_header( $data );
|
136 |
}
|
151 |
$added_to_group = false;
|
152 |
|
153 |
if ( preg_match( '/^plain_(products|coupons)_.+/', $field, $matches ) ) {
|
154 |
+
if ( $item_rows_start_from_new_line ) {
|
155 |
+
continue;
|
156 |
+
}
|
157 |
$type = $matches[1];
|
158 |
$current_group_type = $type;
|
159 |
if ( 'columns' == $repeat[ $type ] ) {
|
218 |
self::check_create_session();
|
219 |
$_SESSION['woe_summary_products'] = array();
|
220 |
|
221 |
+
if( empty($this->labels['products']) ) // error , no product fields?!
|
222 |
+
return array();
|
223 |
+
|
224 |
foreach ( $this->labels['products']->get_labels() as $label_data ) {
|
225 |
$field_header = $label_data['label'];
|
226 |
$key = $label_data['key'];
|
296 |
protected function try_apply_summary_report_fields() {
|
297 |
if ( $this->summary_report ) {
|
298 |
$this->summary_processing = true;
|
299 |
+
|
300 |
//sort by name
|
301 |
+
$first_row = reset( $_SESSION['woe_summary_products'] );
|
302 |
if ( isset( $first_row['name'] ) ) {
|
303 |
+
uasort( $_SESSION['woe_summary_products'], function ( $a, $b ) {
|
304 |
+
return strcmp( $a['name'], $b['name'] );
|
305 |
+
} );
|
306 |
}
|
307 |
+
|
308 |
do_action( 'woe_summary_before_output' );
|
309 |
if ( $this->mode == 'preview' ) {
|
310 |
if ( empty( $this->rows ) ) // no headers!
|
320 |
}
|
321 |
}
|
322 |
|
323 |
+
protected function field_format_is( $field, $format_fields ) {
|
324 |
+
if ( in_array( $field, $format_fields ) ) {
|
325 |
+
return true;
|
326 |
+
}
|
327 |
+
if ( preg_match( '#^(.+?)_\d+$#', $field, $duplicated_field ) ) {
|
328 |
+
return in_array( $duplicated_field[1], $format_fields );
|
329 |
+
}
|
330 |
+
|
331 |
+
return false;
|
332 |
+
}
|
333 |
+
|
334 |
+
protected function get_tmp_data_transient_name() {
|
335 |
+
return 'woe_tmp_data_' . $this->filename;
|
336 |
+
}
|
337 |
+
|
338 |
+
protected function make_img_html_from_path( $path, $width = null, $height = null ) {
|
339 |
+
$uploads_dir = wp_upload_dir();
|
340 |
+
|
341 |
+
if ( ! $uploads_dir || ! isset( $uploads_dir['basedir'], $uploads_dir['baseurl'] ) ) {
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
$hwstring = image_hwstring( $width, $height );
|
345 |
+
|
346 |
+
$attr = array();
|
347 |
+
$src = str_replace( $uploads_dir['basedir'], $uploads_dir['baseurl'], $path );
|
348 |
+
if ( ! $src ) {
|
349 |
+
$src = wc_placeholder_img_src();
|
350 |
+
}
|
351 |
+
$attr['src'] = $src;
|
352 |
+
|
353 |
+
$attr = array_map( 'esc_attr', $attr );
|
354 |
+
|
355 |
+
$html = rtrim( "<img $hwstring" );
|
356 |
+
foreach ( $attr as $name => $value ) {
|
357 |
+
$html .= " $name=" . '"' . $value . '"';
|
358 |
+
}
|
359 |
+
$html .= ' />';
|
360 |
+
|
361 |
+
return $html;
|
362 |
+
}
|
363 |
+
|
364 |
}
|
classes/formats/abstract-class-woe-formatter-sv.php
CHANGED
@@ -12,7 +12,6 @@ abstract class WOE_Formatter_sv extends WOE_Formatter_Plain_Format {
|
|
12 |
var $enclosure;
|
13 |
var $linebreak;
|
14 |
var $delimiter;
|
15 |
-
var $encoding;
|
16 |
|
17 |
public function __construct(
|
18 |
$mode,
|
@@ -29,7 +28,6 @@ abstract class WOE_Formatter_sv extends WOE_Formatter_Plain_Format {
|
|
29 |
$this->enclosure = $this->convert_literals( isset( $this->settings['enclosure'] ) ? $this->settings['enclosure'] : '' );
|
30 |
$this->linebreak = $this->convert_literals( isset( $this->settings['linebreak'] ) ? $this->settings['linebreak'] : '' );
|
31 |
$this->delimiter = $this->convert_literals( isset( $this->settings['delimiter'] ) ? $this->settings['delimiter'] : '' );
|
32 |
-
$this->encoding = isset( $this->settings['encoding'] ) ? $this->settings['encoding'] : '';
|
33 |
|
34 |
// register the filter
|
35 |
WOE_Formatter_sv_crlf_filter::set_linebreak( $this->linebreak );
|
@@ -44,11 +42,11 @@ abstract class WOE_Formatter_sv extends WOE_Formatter_Plain_Format {
|
|
44 |
$this->prepare_array( $data );
|
45 |
parent::start( $data );
|
46 |
|
47 |
-
if ( ! empty($this->settings['add_utf8_bom']) ) {
|
48 |
fwrite( $this->handle, chr( 239 ) . chr( 187 ) . chr( 191 ) );
|
49 |
}
|
50 |
|
51 |
-
if ( ! empty($this->settings['display_column_names']) AND $data ) {
|
52 |
if ( $this->mode == 'preview' ) {
|
53 |
$this->rows[] = $data;
|
54 |
} else {
|
@@ -91,6 +89,7 @@ abstract class WOE_Formatter_sv extends WOE_Formatter_Plain_Format {
|
|
91 |
}
|
92 |
}
|
93 |
|
|
|
94 |
}
|
95 |
|
96 |
public function finish() {
|
@@ -100,10 +99,10 @@ abstract class WOE_Formatter_sv extends WOE_Formatter_Plain_Format {
|
|
100 |
$this->rows = apply_filters( "woe_{$this->format}_preview_rows", $this->rows );
|
101 |
fwrite( $this->handle, '<table>' );
|
102 |
if ( count( $this->rows ) < 2 ) {
|
103 |
-
$this->rows[] = array(
|
104 |
}
|
105 |
foreach ( $this->rows as $num => $rec ) {
|
106 |
-
if ( $num == 0 AND ! empty($this->settings['display_column_names']) ) {
|
107 |
fwrite( $this->handle,
|
108 |
'<tr style="font-weight:bold"><td>' . join( '</td><td>', $rec ) . "</td><tr>\n" );
|
109 |
} else {
|
12 |
var $enclosure;
|
13 |
var $linebreak;
|
14 |
var $delimiter;
|
|
|
15 |
|
16 |
public function __construct(
|
17 |
$mode,
|
28 |
$this->enclosure = $this->convert_literals( isset( $this->settings['enclosure'] ) ? $this->settings['enclosure'] : '' );
|
29 |
$this->linebreak = $this->convert_literals( isset( $this->settings['linebreak'] ) ? $this->settings['linebreak'] : '' );
|
30 |
$this->delimiter = $this->convert_literals( isset( $this->settings['delimiter'] ) ? $this->settings['delimiter'] : '' );
|
|
|
31 |
|
32 |
// register the filter
|
33 |
WOE_Formatter_sv_crlf_filter::set_linebreak( $this->linebreak );
|
42 |
$this->prepare_array( $data );
|
43 |
parent::start( $data );
|
44 |
|
45 |
+
if ( ! empty( $this->settings['add_utf8_bom'] ) ) {
|
46 |
fwrite( $this->handle, chr( 239 ) . chr( 187 ) . chr( 191 ) );
|
47 |
}
|
48 |
|
49 |
+
if ( ! empty( $this->settings['display_column_names'] ) AND $data ) {
|
50 |
if ( $this->mode == 'preview' ) {
|
51 |
$this->rows[] = $data;
|
52 |
} else {
|
89 |
}
|
90 |
}
|
91 |
|
92 |
+
return $rows;
|
93 |
}
|
94 |
|
95 |
public function finish() {
|
99 |
$this->rows = apply_filters( "woe_{$this->format}_preview_rows", $this->rows );
|
100 |
fwrite( $this->handle, '<table>' );
|
101 |
if ( count( $this->rows ) < 2 ) {
|
102 |
+
$this->rows[] = array( '<td colspan=10><b>' . __( 'No results', 'woo-order-export-lite' ) . '</b></td>' );
|
103 |
}
|
104 |
foreach ( $this->rows as $num => $rec ) {
|
105 |
+
if ( $num == 0 AND ! empty( $this->settings['display_column_names'] ) ) {
|
106 |
fwrite( $this->handle,
|
107 |
'<tr style="font-weight:bold"><td>' . join( '</td><td>', $rec ) . "</td><tr>\n" );
|
108 |
} else {
|
classes/formats/class-woe-formatter-csv.php
CHANGED
@@ -19,7 +19,7 @@ class WOE_Formatter_Csv extends WOE_Formatter_sv {
|
|
19 |
}
|
20 |
|
21 |
protected function prepare_array( &$arr ) {
|
22 |
-
if ( ! empty($this->settings['delete_linebreaks']) ) {
|
23 |
$this->delete_linebreaks_from_array( $arr );
|
24 |
}
|
25 |
parent::prepare_array( $arr );
|
19 |
}
|
20 |
|
21 |
protected function prepare_array( &$arr ) {
|
22 |
+
if ( ! empty( $this->settings['delete_linebreaks'] ) ) {
|
23 |
$this->delete_linebreaks_from_array( $arr );
|
24 |
}
|
25 |
parent::prepare_array( $arr );
|
classes/formats/class-woe-formatter-html.php
ADDED
@@ -0,0 +1,288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
include_once 'abstract-class-woe-formatter-plain-format.php';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class WOE_Formatter_PDF
|
10 |
+
*
|
11 |
+
* Using CSV formatter as basis. Works like CSV (even creates csv file) but after finish,
|
12 |
+
* fetches data from file and paste them to PDF as table
|
13 |
+
*/
|
14 |
+
class WOE_Formatter_Html extends WOE_Formatter_Plain_Format {
|
15 |
+
|
16 |
+
protected $css;
|
17 |
+
protected $table_header_row;
|
18 |
+
|
19 |
+
public function __construct(
|
20 |
+
$mode,
|
21 |
+
$filename,
|
22 |
+
$settings,
|
23 |
+
$format,
|
24 |
+
$labels,
|
25 |
+
$field_formats,
|
26 |
+
$date_format,
|
27 |
+
$offset
|
28 |
+
) {
|
29 |
+
parent::__construct( $mode, $filename, $settings, $format, $labels, $field_formats, $date_format, $offset );
|
30 |
+
|
31 |
+
$this->css = $this->get_prepared_css();
|
32 |
+
}
|
33 |
+
|
34 |
+
public function start( $data = '' ) {
|
35 |
+
$data = $this->make_header( $data );
|
36 |
+
$data = apply_filters( "woe_{$this->format}_header_filter", $data );
|
37 |
+
$this->prepare_array( $data );
|
38 |
+
parent::start( $data );
|
39 |
+
|
40 |
+
$this->table_header_row = $data;
|
41 |
+
|
42 |
+
if ( $this->mode != 'preview' ) {
|
43 |
+
|
44 |
+
$this->set_table_header_row($this->table_header_row);
|
45 |
+
|
46 |
+
if( $this->settings['custom_css'] )
|
47 |
+
$this->css['style'] = '';
|
48 |
+
|
49 |
+
fwrite( $this->handle, '<html><head><style type="text/css">'.$this->css['style'].$this->settings['custom_css'].'</style></head><body>' );
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( ! empty( $this->settings['display_column_names'] ) AND $data ) {
|
53 |
+
if ( $this->mode == 'preview' ) {
|
54 |
+
$this->rows[] = $data;
|
55 |
+
} else {
|
56 |
+
|
57 |
+
if ( $this->settings['header_text'] ) {
|
58 |
+
fwrite( $this->handle, '<div class="header">' . $this->settings['header_text'] . '</div>' );
|
59 |
+
}
|
60 |
+
|
61 |
+
fwrite( $this->handle, '<table>' );
|
62 |
+
|
63 |
+
do_action( "woe_before_{$this->format}_print_header", $this->handle, $data, $this );
|
64 |
+
|
65 |
+
if ( ! apply_filters( "woe_{$this->format}_custom_output_func", false, $this->handle, $data, true ) ) {
|
66 |
+
fwrite( $this->handle, '<thead><tr><th>' . join( '</th><th>', $data ) . "</th></tr></thead>\n" );
|
67 |
+
}
|
68 |
+
|
69 |
+
do_action( "woe_{$this->format}_print_header", $this->handle, $data, $this );
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
public function output( $rec ) {
|
75 |
+
$rows = parent::output( $rec );
|
76 |
+
foreach ( $rows as $row ) {
|
77 |
+
$this->prepare_array( $row );
|
78 |
+
if ( $this->has_output_filter ) {
|
79 |
+
$row = apply_filters( "woe_{$this->format}_output_filter", $row, $this );
|
80 |
+
if ( ! $row ) {
|
81 |
+
continue;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
if ( $this->mode == 'preview' ) {
|
86 |
+
$this->rows[] = $row;
|
87 |
+
} else {
|
88 |
+
|
89 |
+
if ( ! apply_filters( "woe_{$this->format}_custom_output_func", false, $this->handle, $row, false ) ) {
|
90 |
+
|
91 |
+
fwrite( $this->handle, '<tr><td>' . join( '</td><td>', $row ) . "</td></tr>\n" );
|
92 |
+
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
public function finish() {
|
100 |
+
$this->try_apply_summary_report_fields();
|
101 |
+
|
102 |
+
if ( $this->mode == 'preview' ) {
|
103 |
+
|
104 |
+
if( $this->settings['custom_css'] ) {
|
105 |
+
foreach( $this->css['inline'] as $k=>$v)
|
106 |
+
$this->css['inline'][$k] = '';
|
107 |
+
}
|
108 |
+
|
109 |
+
$this->rows = apply_filters( "woe_{$this->format}_preview_rows", $this->rows );
|
110 |
+
|
111 |
+
fwrite( $this->handle, '<div style="'.$this->css['inline']['body'].'">' );
|
112 |
+
|
113 |
+
if ( $this->settings['header_text'] ) {
|
114 |
+
fwrite( $this->handle, '<div class="header" style="'.$this->css['inline']['header'].'">' . $this->settings['header_text'] . '</div>' );
|
115 |
+
}
|
116 |
+
|
117 |
+
fwrite( $this->handle, '<table>' );
|
118 |
+
|
119 |
+
if ( count( $this->rows ) < 2 ) {
|
120 |
+
$this->rows[] = array( '<td colspan=10 style="'.$this->css['inline']['td'].'"><b>' . __( 'No results', 'woo-order-export-lite' ) .'</b></td>' );
|
121 |
+
}
|
122 |
+
foreach ( $this->rows as $num => $rec ) {
|
123 |
+
if ( $num == 0 AND ! empty( $this->settings['display_column_names'] ) ) {
|
124 |
+
fwrite( $this->handle,
|
125 |
+
'<thead><tr><th style="'.$this->css['inline']['th'].'">' . join( '</th><th style="'.$this->css['inline']['th'].'">', $rec ) . "</th></tr></thead>\n" );
|
126 |
+
} else {
|
127 |
+
fwrite( $this->handle, '<tr><td style="'.$this->css['inline']['td'].'">' . join( '</td><td style="'.$this->css['inline']['td'].'">', $rec ) . "</td></tr>\n" );
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
if (! empty( $this->settings['display_column_names'] ) && ! empty( $this->settings['repeat_header_last_line'] ) && $this->table_header_row) {
|
132 |
+
fwrite( $this->handle, '<tfoot><tr><th style="'.$this->css['inline']['th'].'">' . join( '</th><th style="'.$this->css['inline']['th'].'">', $this->table_header_row ) . "</th></tr></tfoot>\n" );
|
133 |
+
}
|
134 |
+
|
135 |
+
fwrite( $this->handle, '</table>' );
|
136 |
+
|
137 |
+
if ( $this->settings['footer_text'] ) {
|
138 |
+
fwrite( $this->handle, '<div class="footer" style="'.$this->css['inline']['footer'].'">' . $this->settings['footer_text'] . '</div>' );
|
139 |
+
}
|
140 |
+
|
141 |
+
fwrite( $this->handle, '</div>' );
|
142 |
+
|
143 |
+
} else {
|
144 |
+
do_action( "woe_{$this->format}_print_footer", $this->handle, $this );
|
145 |
+
|
146 |
+
$this->table_header_row = $this->get_table_header_row();
|
147 |
+
|
148 |
+
if (! empty( $this->settings['display_column_names'] ) && ! empty( $this->settings['repeat_header_last_line'] ) && $this->table_header_row) {
|
149 |
+
if ( ! apply_filters( "woe_{$this->format}_custom_output_func", false, $this->handle, $this->table_header_row, true ) ) {
|
150 |
+
fwrite( $this->handle, '<tfoot><tr><th>' . join( '</th><th>', $this->table_header_row ) . "</th></tr></tfoot>\n" );
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
fwrite( $this->handle, '</table>' );
|
155 |
+
|
156 |
+
if ( $this->settings['footer_text'] ) {
|
157 |
+
fwrite( $this->handle, '<div class="footer">' . $this->settings['footer_text'] . '</div>' );
|
158 |
+
}
|
159 |
+
|
160 |
+
fwrite( $this->handle, '</body></html>' );
|
161 |
+
}
|
162 |
+
parent::finish();
|
163 |
+
}
|
164 |
+
|
165 |
+
protected function prepare_array( &$arr ) {
|
166 |
+
if ( apply_filters( "woe_stop_csv_injection", true ) ) {
|
167 |
+
$arr = array_map( array( $this, 'stop_csv_injection' ), $arr );
|
168 |
+
}
|
169 |
+
|
170 |
+
if ( ! in_array( $this->encoding, array( '', 'utf-8', 'UTF-8' ) ) ) {
|
171 |
+
$arr = array_map( array( $this, 'encode_value' ), $arr );
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
protected function stop_csv_injection( $value ) {
|
176 |
+
$formula_chars = array( "=", "+", "-", "@" );
|
177 |
+
if ( in_array( substr( $value, 0, 1 ), $formula_chars ) ) {
|
178 |
+
$value = " " . $value;
|
179 |
+
}
|
180 |
+
|
181 |
+
return $value;
|
182 |
+
}
|
183 |
+
|
184 |
+
protected function encode_value( $value ) {
|
185 |
+
return iconv( 'UTF-8', $this->encoding, $value );
|
186 |
+
}
|
187 |
+
|
188 |
+
protected function get_prepared_css() {
|
189 |
+
|
190 |
+
$default_css = array();
|
191 |
+
|
192 |
+
if ($this->settings['font_size']) {
|
193 |
+
$default_css['font-size'] = $this->settings['font_size'] . 'px';
|
194 |
+
}
|
195 |
+
|
196 |
+
$default_header_css = array();
|
197 |
+
|
198 |
+
if ( $this->settings['header_text_color'] ) {
|
199 |
+
$default_header_css['color'] = $this->settings['header_text_color'];
|
200 |
+
}
|
201 |
+
|
202 |
+
$default_footer_css = array();
|
203 |
+
|
204 |
+
if ( $this->settings['footer_text_color'] ) {
|
205 |
+
$default_footer_css['color'] = $this->settings['footer_text_color'];
|
206 |
+
}
|
207 |
+
|
208 |
+
$align = "left";
|
209 |
+
|
210 |
+
switch($this->settings['cols_align']) {
|
211 |
+
case 'L':
|
212 |
+
$align = "left";
|
213 |
+
break;
|
214 |
+
case 'R':
|
215 |
+
$align = "right";
|
216 |
+
break;
|
217 |
+
case 'C':
|
218 |
+
$align = "center";
|
219 |
+
break;
|
220 |
+
}
|
221 |
+
|
222 |
+
$default_th_css = array('text-align' => $align, 'font-weight' => 'bold');
|
223 |
+
$default_td_css = array('text-align' => $align);
|
224 |
+
|
225 |
+
if ( $this->settings['table_header_text_color'] ) {
|
226 |
+
$default_th_css['color'] = $this->settings['table_header_text_color'];
|
227 |
+
}
|
228 |
+
|
229 |
+
if ( $this->settings['table_header_background_color'] ) {
|
230 |
+
$default_th_css['background-color'] = $this->settings['table_header_background_color'];
|
231 |
+
}
|
232 |
+
|
233 |
+
if ( $this->settings['table_row_text_color'] ) {
|
234 |
+
$default_td_css['color'] = $this->settings['table_row_text_color'];
|
235 |
+
}
|
236 |
+
|
237 |
+
if ( $this->settings['table_row_background_color'] ) {
|
238 |
+
$default_td_css['background-color'] = $this->settings['table_row_background_color'];
|
239 |
+
}
|
240 |
+
|
241 |
+
$css = array();
|
242 |
+
|
243 |
+
$default = array(
|
244 |
+
'body' => $default_css,
|
245 |
+
'header' => $default_header_css,
|
246 |
+
'footer' => $default_footer_css,
|
247 |
+
'th' => $default_th_css,
|
248 |
+
'td' => $default_td_css,
|
249 |
+
);
|
250 |
+
|
251 |
+
foreach ($default as $key => $tmp) {
|
252 |
+
|
253 |
+
$tmp_css = array();
|
254 |
+
|
255 |
+
foreach ($tmp as $p => $s) {
|
256 |
+
$tmp_css[] = sprintf('%s: %s', $p, $s);
|
257 |
+
}
|
258 |
+
|
259 |
+
$css[$key] = implode('; ', $tmp_css);
|
260 |
+
}
|
261 |
+
|
262 |
+
$style = '
|
263 |
+
body, .header, .footer, table th, table td {'.$css['body'].'}
|
264 |
+
table th {'.$css['th'].'}
|
265 |
+
table td {'.$css['td'].'}
|
266 |
+
.header {'.$css['header'].'}
|
267 |
+
.footer {'.$css['footer'].'}
|
268 |
+
';
|
269 |
+
|
270 |
+
return array(
|
271 |
+
'style' => $style,
|
272 |
+
'inline'=> $css,
|
273 |
+
);
|
274 |
+
}
|
275 |
+
|
276 |
+
public function get_table_header_row() {
|
277 |
+
return get_transient($this->get_transient_key_table_header_row());
|
278 |
+
}
|
279 |
+
|
280 |
+
public function set_table_header_row($row) {
|
281 |
+
return set_transient($this->get_transient_key_table_header_row(), $row, 5 * MINUTE_IN_SECONDS);
|
282 |
+
}
|
283 |
+
|
284 |
+
public function get_transient_key_table_header_row() {
|
285 |
+
return 'woocommerce-order-file-'. str_replace('/', '-', $this->filename) .'-html-table-header-row';
|
286 |
+
}
|
287 |
+
|
288 |
+
}
|
classes/formats/class-woe-formatter-json.php
CHANGED
@@ -57,10 +57,12 @@ class WOE_Formatter_Json extends WOE_Formatter {
|
|
57 |
$rec_out[ $label ] = $field_value;
|
58 |
continue;
|
59 |
}
|
60 |
-
|
61 |
-
if( empty($child_labels ) ) // can't export!
|
|
|
62 |
continue;
|
63 |
-
|
|
|
64 |
$rec_out[ $label ] = array();
|
65 |
foreach ( $field_value as $child_element ) {
|
66 |
$child = array();
|
57 |
$rec_out[ $label ] = $field_value;
|
58 |
continue;
|
59 |
}
|
60 |
+
|
61 |
+
if ( empty( $child_labels ) ) // can't export!
|
62 |
+
{
|
63 |
continue;
|
64 |
+
}
|
65 |
+
|
66 |
$rec_out[ $label ] = array();
|
67 |
foreach ( $field_value as $child_element ) {
|
68 |
$child = array();
|
classes/formats/class-woe-formatter-pdf.php
CHANGED
@@ -25,6 +25,8 @@ class WOE_Formatter_PDF extends WOE_Formatter_Csv {
|
|
25 |
private $font_size = 5;
|
26 |
private $repeat_header = false;
|
27 |
|
|
|
|
|
28 |
public function __construct( $mode, $filename, $settings, $format, $labels, $field_formats, $date_format, $offset ) {
|
29 |
|
30 |
$settings['enclosure'] = '"';
|
@@ -41,15 +43,88 @@ class WOE_Formatter_PDF extends WOE_Formatter_Csv {
|
|
41 |
$filename = str_replace( '.pdf', '.csv', $filename );
|
42 |
}
|
43 |
|
|
|
|
|
|
|
44 |
parent::__construct( $mode, $filename, $settings, $format, $labels, $field_formats, $date_format, $offset );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
|
47 |
public function finish() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
parent::finish();
|
49 |
|
50 |
if ( $this->mode != 'preview' ) {
|
|
|
|
|
|
|
|
|
|
|
51 |
$this->pdf = new WOE_PDF_MC_Table( $this->orientation, 'mm', $this->page_size );
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
$this->pdf->SetFont( 'Arial', '', $this->font_size );
|
54 |
$this->pdf->SetFillColor( null );
|
55 |
$this->pdf->setProperties( array(
|
@@ -59,15 +134,16 @@ class WOE_Formatter_PDF extends WOE_Formatter_Csv {
|
|
59 |
'size' => '10',
|
60 |
'text_color' => $this->hex2RGB( $this->settings['page_header_text_color'] ),
|
61 |
'logo' => array(
|
62 |
-
'source' => $this->settings['logo_source'],
|
63 |
'width' => $this->settings['logo_width'],
|
64 |
'height' => $this->settings['logo_height'],
|
65 |
'align' => $this->settings['logo_align'],
|
66 |
),
|
67 |
),
|
68 |
'table' => array(
|
69 |
-
'stretch' =>
|
70 |
'column_width' => explode( ",", $this->settings['cols_width'] ),
|
|
|
71 |
),
|
72 |
'table_header' => array(
|
73 |
'size' => 10,
|
@@ -96,6 +172,7 @@ class WOE_Formatter_PDF extends WOE_Formatter_Csv {
|
|
96 |
|
97 |
$this->handle = fopen( $this->filename, 'r' );
|
98 |
$row = fgetcsv( $this->handle, 0, $this->delimiter, $this->enclosure );
|
|
|
99 |
|
100 |
if ( ! empty( $this->settings['display_column_names'] ) and $row ) {
|
101 |
$this->pdf->addTableHeader( $row );
|
@@ -104,12 +181,27 @@ class WOE_Formatter_PDF extends WOE_Formatter_Csv {
|
|
104 |
}
|
105 |
|
106 |
while ( $row ) {
|
107 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
$row = fgetcsv( $this->handle, 0, $this->delimiter, $this->enclosure );
|
109 |
}
|
110 |
|
111 |
do_action("woe_pdf_finished", $this->pdf, $this);
|
112 |
$this->pdf->Output( 'f', str_replace( '.csv', '.pdf', $this->filename ) );
|
|
|
|
|
113 |
}
|
114 |
}
|
115 |
|
@@ -117,6 +209,7 @@ class WOE_Formatter_PDF extends WOE_Formatter_Csv {
|
|
117 |
* Convert a hexa decimal color code to its RGB equivalent
|
118 |
*
|
119 |
* @param string $hexStr (hexadecimal color value)
|
|
|
120 |
* @return array|boolean Returns False if invalid hex color value
|
121 |
*/
|
122 |
private function hex2RGB( $hexStr ) {
|
25 |
private $font_size = 5;
|
26 |
private $repeat_header = false;
|
27 |
|
28 |
+
private $image_positions = array();
|
29 |
+
|
30 |
public function __construct( $mode, $filename, $settings, $format, $labels, $field_formats, $date_format, $offset ) {
|
31 |
|
32 |
$settings['enclosure'] = '"';
|
43 |
$filename = str_replace( '.pdf', '.csv', $filename );
|
44 |
}
|
45 |
|
46 |
+
$this->image_format_fields = isset( $field_formats['order']['image'] ) ? $field_formats['order']['image'] : array();
|
47 |
+
$this->image_format_fields = apply_filters( "woe_{$format}_image_format_fields", $this->image_format_fields );
|
48 |
+
|
49 |
parent::__construct( $mode, $filename, $settings, $format, $labels, $field_formats, $date_format, $offset );
|
50 |
+
|
51 |
+
$this->image_positions = array();
|
52 |
+
if ( $this->mode != 'preview' ) {
|
53 |
+
$tmp_data = get_transient( $this->get_tmp_data_transient_name() );
|
54 |
+
|
55 |
+
if ( ! empty( $tmp_data['image_positions'] ) ) {
|
56 |
+
$this->image_positions = $tmp_data['image_positions'];
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
public function output( $rec ) {
|
62 |
+
$rows = parent::output( $rec );
|
63 |
+
|
64 |
+
if ( $this->mode != 'preview' ) {
|
65 |
+
if ( 0 === count($this->image_positions) ) {
|
66 |
+
foreach ( $rows as $row ) {
|
67 |
+
$pos = 0;
|
68 |
+
foreach ( $row as $field => $text ) {
|
69 |
+
if ( $this->field_format_is( $field, $this->image_format_fields ) ) {
|
70 |
+
$this->image_positions[] = $pos;
|
71 |
+
}
|
72 |
+
$pos ++;
|
73 |
+
}
|
74 |
+
break;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
$tmp_data['image_positions'] = $this->image_positions;
|
79 |
+
set_transient( $this->get_tmp_data_transient_name(), $tmp_data );
|
80 |
+
}
|
81 |
+
|
82 |
+
return $rows;
|
83 |
}
|
84 |
|
85 |
public function finish() {
|
86 |
+
if ( $this->mode === 'preview' ) {
|
87 |
+
$image_preview_multiply = 5;
|
88 |
+
foreach ( $this->rows as $row_index => $row ) {
|
89 |
+
if ( ! empty( $this->settings['display_column_names'] ) && $row_index === 0 ) {
|
90 |
+
continue;
|
91 |
+
}
|
92 |
+
foreach ( $row as $column => $cell ) {
|
93 |
+
if ( $this->field_format_is( $column, $this->image_format_fields ) ) {
|
94 |
+
$html = $this->make_img_html_from_path(
|
95 |
+
$cell,
|
96 |
+
$this->settings['row_images_width'] * $image_preview_multiply,
|
97 |
+
$this->settings['row_images_height'] * $image_preview_multiply );
|
98 |
+
|
99 |
+
if ( $html ) {
|
100 |
+
$this->rows[ $row_index ][ $column ] = $html;
|
101 |
+
} else {
|
102 |
+
$this->rows[ $row_index ][ $column ] = "";
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
parent::finish();
|
110 |
|
111 |
if ( $this->mode != 'preview' ) {
|
112 |
+
|
113 |
+
if ( apply_filters( 'woe_pdf_output', false, $this->settings, str_replace( '.csv', '.pdf', $this->filename ) ) ) {
|
114 |
+
return;
|
115 |
+
}
|
116 |
+
|
117 |
$this->pdf = new WOE_PDF_MC_Table( $this->orientation, 'mm', $this->page_size );
|
118 |
|
119 |
+
|
120 |
+
$solid_width = array();
|
121 |
+
if ( count( $this->image_positions ) ) {
|
122 |
+
foreach ( $this->image_positions as $position ) {
|
123 |
+
$solid_width[ $position ] = $this->settings['row_images_width'];
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
|
128 |
$this->pdf->SetFont( 'Arial', '', $this->font_size );
|
129 |
$this->pdf->SetFillColor( null );
|
130 |
$this->pdf->setProperties( array(
|
134 |
'size' => '10',
|
135 |
'text_color' => $this->hex2RGB( $this->settings['page_header_text_color'] ),
|
136 |
'logo' => array(
|
137 |
+
'source' => $this->settings['logo_source_id'] ? get_attached_file( $this->settings['logo_source_id'], true ) : $this->settings['logo_source'],
|
138 |
'width' => $this->settings['logo_width'],
|
139 |
'height' => $this->settings['logo_height'],
|
140 |
'align' => $this->settings['logo_align'],
|
141 |
),
|
142 |
),
|
143 |
'table' => array(
|
144 |
+
'stretch' => ! $this->settings['fit_page_width'],
|
145 |
'column_width' => explode( ",", $this->settings['cols_width'] ),
|
146 |
+
'solid_width' => $solid_width,
|
147 |
),
|
148 |
'table_header' => array(
|
149 |
'size' => 10,
|
172 |
|
173 |
$this->handle = fopen( $this->filename, 'r' );
|
174 |
$row = fgetcsv( $this->handle, 0, $this->delimiter, $this->enclosure );
|
175 |
+
$row = apply_filters( 'woe_row_before_format_pdf', $row );
|
176 |
|
177 |
if ( ! empty( $this->settings['display_column_names'] ) and $row ) {
|
178 |
$this->pdf->addTableHeader( $row );
|
181 |
}
|
182 |
|
183 |
while ( $row ) {
|
184 |
+
if ( count( $this->image_positions ) ) {
|
185 |
+
foreach ( $this->image_positions as $position ) {
|
186 |
+
$source = $row[ $position ];
|
187 |
+
$row[ $position ] = array(
|
188 |
+
'type' => 'image',
|
189 |
+
'value' => $source,
|
190 |
+
);
|
191 |
+
}
|
192 |
+
$row_height = $this->settings['row_images_height'] ? $this->settings['row_images_height']: null;
|
193 |
+
} else {
|
194 |
+
$row_height = null;
|
195 |
+
}
|
196 |
+
$row = apply_filters( 'woe_pdf_prepare_row', $row );
|
197 |
+
$this->pdf->addRow( $row, null, $row_height );
|
198 |
$row = fgetcsv( $this->handle, 0, $this->delimiter, $this->enclosure );
|
199 |
}
|
200 |
|
201 |
do_action("woe_pdf_finished", $this->pdf, $this);
|
202 |
$this->pdf->Output( 'f', str_replace( '.csv', '.pdf', $this->filename ) );
|
203 |
+
|
204 |
+
delete_transient( $this->get_tmp_data_transient_name() );
|
205 |
}
|
206 |
}
|
207 |
|
209 |
* Convert a hexa decimal color code to its RGB equivalent
|
210 |
*
|
211 |
* @param string $hexStr (hexadecimal color value)
|
212 |
+
*
|
213 |
* @return array|boolean Returns False if invalid hex color value
|
214 |
*/
|
215 |
private function hex2RGB( $hexStr ) {
|
classes/formats/class-woe-formatter-xls.php
CHANGED
@@ -13,6 +13,7 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
|
|
13 |
private $string_format_force = false;
|
14 |
private $string_format_fields;
|
15 |
private $date_format_fields;
|
|
|
16 |
|
17 |
public function __construct(
|
18 |
$mode,
|
@@ -29,10 +30,13 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
|
|
29 |
$this->string_format_force = apply_filters( "woe_{$format}_string_format_force", false );
|
30 |
|
31 |
$field_formats = $this->field_formats['order']; // overwrite! probably modified by parent
|
32 |
-
|
33 |
if ( $this->settings['force_general_format'] ) {
|
34 |
-
foreach( array( "string", "date", "money", "number" ) as $type)
|
35 |
-
add_filter( "woe_xls_{$type}_format_fields", function($fields) {
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
$this->string_format_fields = isset( $field_formats['string'] ) ? $field_formats['string'] : array();
|
@@ -47,7 +51,10 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
|
|
47 |
|
48 |
$this->number_format_fields = isset( $field_formats['number'] ) ? $field_formats['number'] : array();
|
49 |
$this->number_format_fields = apply_filters( "woe_{$format}_number_format_fields", $this->number_format_fields );
|
50 |
-
|
|
|
|
|
|
|
51 |
if ( $mode != 'preview' ) {
|
52 |
//more memory for XLS?
|
53 |
ini_set( 'memory_limit', '512M' );
|
@@ -74,13 +81,22 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
|
|
74 |
}
|
75 |
|
76 |
// Excel uses another format!
|
77 |
-
$this->date_format
|
78 |
-
$this->money_format
|
79 |
$this->number_format = apply_filters( 'woe_xls_number_format', PHPExcel_Style_NumberFormat::FORMAT_NUMBER );
|
80 |
// Excel will format!
|
81 |
$this->auto_format_dates = false;
|
82 |
$this->format_number_fields_original = $this->format_number_fields;
|
83 |
$this->format_number_fields = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
} else {
|
85 |
$this->auto_format_dates = true;
|
86 |
}
|
@@ -134,6 +150,21 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
|
|
134 |
public function output( $rec ) {
|
135 |
$rows = parent::output( $rec );
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
foreach ( $rows as $row ) {
|
138 |
if ( $this->has_output_filter ) {
|
139 |
$row = apply_filters( "woe_xls_output_filter", $row, $this );
|
@@ -144,13 +175,26 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
|
|
144 |
|
145 |
if ( $this->mode == 'preview' ) {
|
146 |
$row = array_map( "nl2br", $row );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
$this->rows[] = $row;
|
148 |
} else {
|
149 |
$this->last_row ++;
|
150 |
$pos = 0;
|
151 |
foreach ( $row as $field => $text ) {
|
152 |
-
if ( $this->string_format_force OR $this->field_format_is( $field
|
153 |
-
$this->objPHPExcel->getActiveSheet()->getStyleByColumnAndRow( $pos
|
154 |
$this->objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow( $pos, $this->last_row, $text );
|
155 |
} elseif ( $this->format_number_fields_original AND $this->field_format_is( $field, $this->money_format_fields ) ) { // MONEY
|
156 |
$this->objPHPExcel->getActiveSheet()->getStyleByColumnAndRow( $pos, $this->last_row )->getNumberFormat()->setFormatCode( $this->money_format );
|
@@ -176,6 +220,13 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
|
|
176 |
}
|
177 |
}
|
178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
}
|
180 |
|
181 |
public function finish() {
|
@@ -184,7 +235,7 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
|
|
184 |
$max_columns = 0;
|
185 |
fwrite( $this->handle, '<table>' );
|
186 |
if ( count( $this->rows ) < 2 ) {
|
187 |
-
$this->rows[] = array(
|
188 |
}
|
189 |
foreach ( $this->rows as $num => $rec ) {
|
190 |
$max_columns = max( $max_columns, count( $rec ) );
|
@@ -218,10 +269,71 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
|
|
218 |
//do nothing here , adjustment failed gracefully
|
219 |
}
|
220 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
do_action( 'woe_xls_print_footer', $this->objPHPExcel, $this );
|
222 |
$objWriter = PHPExcel_IOFactory::createWriter( $this->objPHPExcel,
|
223 |
$this->settings['use_xls_format'] ? 'Excel5' : 'Excel2007' );
|
224 |
$objWriter->save( $this->filename );
|
|
|
|
|
225 |
}
|
226 |
}
|
227 |
|
@@ -267,14 +379,4 @@ class WOE_Formatter_Xls extends WOE_Formatter_Plain_Format {
|
|
267 |
return strtr( $date_format, $replacements );
|
268 |
}
|
269 |
|
270 |
-
protected function field_format_is( $field, $format_fields ) {
|
271 |
-
if ( in_array( $field, $format_fields ) ) {
|
272 |
-
return true;
|
273 |
-
}
|
274 |
-
if ( preg_match( '#^(.+?)_\d+$#', $field, $duplicated_field ) ) {
|
275 |
-
return in_array( $duplicated_field[1], $format_fields );
|
276 |
-
}
|
277 |
-
|
278 |
-
return false;
|
279 |
-
}
|
280 |
}
|
13 |
private $string_format_force = false;
|
14 |
private $string_format_fields;
|
15 |
private $date_format_fields;
|
16 |
+
private $image_positions = array();
|
17 |
|
18 |
public function __construct(
|
19 |
$mode,
|
30 |
$this->string_format_force = apply_filters( "woe_{$format}_string_format_force", false );
|
31 |
|
32 |
$field_formats = $this->field_formats['order']; // overwrite! probably modified by parent
|
33 |
+
|
34 |
if ( $this->settings['force_general_format'] ) {
|
35 |
+
foreach ( array( "string", "date", "money", "number" ) as $type ) {
|
36 |
+
add_filter( "woe_xls_{$type}_format_fields", function ( $fields ) {
|
37 |
+
return array();
|
38 |
+
} );
|
39 |
+
}
|
40 |
}
|
41 |
|
42 |
$this->string_format_fields = isset( $field_formats['string'] ) ? $field_formats['string'] : array();
|
51 |
|
52 |
$this->number_format_fields = isset( $field_formats['number'] ) ? $field_formats['number'] : array();
|
53 |
$this->number_format_fields = apply_filters( "woe_{$format}_number_format_fields", $this->number_format_fields );
|
54 |
+
|
55 |
+
$this->image_format_fields = isset( $field_formats['image'] ) ? $field_formats['image'] : array();
|
56 |
+
$this->image_format_fields = apply_filters( "woe_{$format}_image_format_fields", $this->image_format_fields );
|
57 |
+
|
58 |
if ( $mode != 'preview' ) {
|
59 |
//more memory for XLS?
|
60 |
ini_set( 'memory_limit', '512M' );
|
81 |
}
|
82 |
|
83 |
// Excel uses another format!
|
84 |
+
$this->date_format = apply_filters( 'woe_xls_date_format', $this->convert_php_date_format( $date_format ) );
|
85 |
+
$this->money_format = apply_filters( 'woe_xls_money_format', PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00 );
|
86 |
$this->number_format = apply_filters( 'woe_xls_number_format', PHPExcel_Style_NumberFormat::FORMAT_NUMBER );
|
87 |
// Excel will format!
|
88 |
$this->auto_format_dates = false;
|
89 |
$this->format_number_fields_original = $this->format_number_fields;
|
90 |
$this->format_number_fields = false;
|
91 |
+
|
92 |
+
$this->image_positions = array();
|
93 |
+
if ( $this->mode != 'preview' ) {
|
94 |
+
$tmp_data = get_transient( $this->get_tmp_data_transient_name() );
|
95 |
+
|
96 |
+
if ( ! empty( $tmp_data['image_positions'] ) ) {
|
97 |
+
$this->image_positions = $tmp_data['image_positions'];
|
98 |
+
}
|
99 |
+
}
|
100 |
} else {
|
101 |
$this->auto_format_dates = true;
|
102 |
}
|
150 |
public function output( $rec ) {
|
151 |
$rows = parent::output( $rec );
|
152 |
|
153 |
+
if ( $this->mode != 'preview' ) {
|
154 |
+
if ( 0 === count( $this->image_positions ) ) {
|
155 |
+
foreach ( $rows as $row ) {
|
156 |
+
$pos = 0;
|
157 |
+
foreach ( $row as $field => $text ) {
|
158 |
+
if ( $this->field_format_is( $field, $this->image_format_fields ) ) {
|
159 |
+
$this->image_positions[] = $pos;
|
160 |
+
}
|
161 |
+
$pos ++;
|
162 |
+
}
|
163 |
+
break;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
foreach ( $rows as $row ) {
|
169 |
if ( $this->has_output_filter ) {
|
170 |
$row = apply_filters( "woe_xls_output_filter", $row, $this );
|
175 |
|
176 |
if ( $this->mode == 'preview' ) {
|
177 |
$row = array_map( "nl2br", $row );
|
178 |
+
|
179 |
+
$image_preview_multiply = 5;
|
180 |
+
foreach ( $row as $column => &$cell ) {
|
181 |
+
if ( $this->field_format_is( $column, $this->image_format_fields ) ) {
|
182 |
+
$html = $this->make_img_html_from_path(
|
183 |
+
$cell,
|
184 |
+
$this->settings['row_images_width'] * $image_preview_multiply,
|
185 |
+
$this->settings['row_images_height'] * $image_preview_multiply
|
186 |
+
);
|
187 |
+
$cell = $html ? $html : "";
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
$this->rows[] = $row;
|
192 |
} else {
|
193 |
$this->last_row ++;
|
194 |
$pos = 0;
|
195 |
foreach ( $row as $field => $text ) {
|
196 |
+
if ( $this->string_format_force OR $this->field_format_is( $field, $this->string_format_fields ) ) {// STRING
|
197 |
+
$this->objPHPExcel->getActiveSheet()->getStyleByColumnAndRow( $pos, $this->last_row )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_TEXT );
|
198 |
$this->objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow( $pos, $this->last_row, $text );
|
199 |
} elseif ( $this->format_number_fields_original AND $this->field_format_is( $field, $this->money_format_fields ) ) { // MONEY
|
200 |
$this->objPHPExcel->getActiveSheet()->getStyleByColumnAndRow( $pos, $this->last_row )->getNumberFormat()->setFormatCode( $this->money_format );
|
220 |
}
|
221 |
}
|
222 |
|
223 |
+
|
224 |
+
if ( $this->mode != 'preview' ) {
|
225 |
+
$tmp_data = array();
|
226 |
+
$tmp_data['image_positions'] = $this->image_positions;
|
227 |
+
set_transient( $this->get_tmp_data_transient_name(), $tmp_data );
|
228 |
+
}
|
229 |
+
|
230 |
}
|
231 |
|
232 |
public function finish() {
|
235 |
$max_columns = 0;
|
236 |
fwrite( $this->handle, '<table>' );
|
237 |
if ( count( $this->rows ) < 2 ) {
|
238 |
+
$this->rows[] = array( '<td colspan=10><b>'. __( 'No results', 'woo-order-export-lite' ) . '</b></td>');
|
239 |
}
|
240 |
foreach ( $this->rows as $num => $rec ) {
|
241 |
$max_columns = max( $max_columns, count( $rec ) );
|
269 |
//do nothing here , adjustment failed gracefully
|
270 |
}
|
271 |
}
|
272 |
+
|
273 |
+
$sheet = $this->objPHPExcel->getActiveSheet();
|
274 |
+
$start_row = $this->settings['display_column_names'] ? 2 : 1;
|
275 |
+
|
276 |
+
foreach ( $this->image_positions as $column_index ) {
|
277 |
+
$columnIterator = $sheet->getColumnIterator()
|
278 |
+
->seek(PHPExcel_Cell::stringFromColumnIndex($column_index))
|
279 |
+
->current()
|
280 |
+
->getCellIterator($start_row);
|
281 |
+
|
282 |
+
$columnIterator->setIterateOnlyExistingCells( true );
|
283 |
+
foreach ( $columnIterator as $cell ) {
|
284 |
+
/**
|
285 |
+
* @var PHPExcel_Cell $cell
|
286 |
+
*/
|
287 |
+
|
288 |
+
$value = $cell->getValue();
|
289 |
+
|
290 |
+
$objDrawing = new PHPExcel_Worksheet_Drawing(); //create object for Worksheet drawing
|
291 |
+
|
292 |
+
if ( wc_is_valid_url( $value ) ) {
|
293 |
+
$url = $value;
|
294 |
+
$path = get_temp_dir() . '/' . md5( $url ); //Path to signature .jpg file
|
295 |
+
|
296 |
+
if ( ! file_exists( $path ) ) {
|
297 |
+
$ch = curl_init( $url );
|
298 |
+
$fp = fopen( $path, 'wb' );
|
299 |
+
curl_setopt( $ch, CURLOPT_FILE, $fp );
|
300 |
+
curl_setopt( $ch, CURLOPT_HEADER, 0 );
|
301 |
+
curl_exec( $ch );
|
302 |
+
curl_close( $ch );
|
303 |
+
fclose( $fp );
|
304 |
+
}
|
305 |
+
} else {
|
306 |
+
$path = $value;
|
307 |
+
}
|
308 |
+
|
309 |
+
if ( file_exists( $path ) ) {
|
310 |
+
$objDrawing->setPath( $path );
|
311 |
+
$objDrawing->setCoordinates( $cell->getCoordinate() ); //set image to cell
|
312 |
+
$row = $cell->getRow();
|
313 |
+
$col = $cell->getColumn();
|
314 |
+
$row_image_width = $this->settings['row_images_width'];
|
315 |
+
$row_image_height = $this->settings['row_images_height'];
|
316 |
+
|
317 |
+
|
318 |
+
$this->objPHPExcel->getActiveSheet()->getColumnDimension( $col )->setWidth( $row_image_width );
|
319 |
+
$this->objPHPExcel->getActiveSheet()->getRowDimension( $row )->setRowHeight( $row_image_height );
|
320 |
+
|
321 |
+
$objDrawing->setResizeProportional( false ); // ignore proportional
|
322 |
+
$objDrawing->setWidth( $row_image_width ); //set width, height
|
323 |
+
$objDrawing->setHeight( $row_image_height );
|
324 |
+
|
325 |
+
$objDrawing->setWorksheet( $this->objPHPExcel->getActiveSheet() ); //save
|
326 |
+
$cell->setValue("");
|
327 |
+
}
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
do_action( 'woe_xls_print_footer', $this->objPHPExcel, $this );
|
332 |
$objWriter = PHPExcel_IOFactory::createWriter( $this->objPHPExcel,
|
333 |
$this->settings['use_xls_format'] ? 'Excel5' : 'Excel2007' );
|
334 |
$objWriter->save( $this->filename );
|
335 |
+
|
336 |
+
delete_transient( $this->get_tmp_data_transient_name() );
|
337 |
}
|
338 |
}
|
339 |
|
379 |
return strtr( $date_format, $replacements );
|
380 |
}
|
381 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
}
|
classes/formats/class-woe-formatter-xml.php
CHANGED
@@ -36,7 +36,7 @@ class WOE_Formatter_Xml extends WOE_Formatter {
|
|
36 |
fwrite( $this->handle, "<" . $this->settings['root_tag'] . ">" . $this->linebreak );
|
37 |
}
|
38 |
|
39 |
-
fwrite( $this->handle, apply_filters( "woe_xml_output_after_root_tag", '' ) );
|
40 |
|
41 |
}
|
42 |
|
@@ -71,11 +71,13 @@ class WOE_Formatter_Xml extends WOE_Formatter {
|
|
71 |
$rec );
|
72 |
$child_labels = apply_filters( 'woe_xml_child_labels_' . $original_key, $child_labels, $field_value,
|
73 |
$rec );
|
74 |
-
|
75 |
-
if( empty($child_labels ) ) // can't export!
|
|
|
76 |
continue;
|
77 |
-
|
78 |
-
|
|
|
79 |
|
80 |
foreach ( $field_value as $child_key => $child_element ) {
|
81 |
$tag_name = $child_tag ? $child_tag : $child_key;
|
@@ -114,6 +116,7 @@ class WOE_Formatter_Xml extends WOE_Formatter {
|
|
114 |
}
|
115 |
|
116 |
public function finish( $data = '' ) {
|
|
|
117 |
if ( $this->settings['root_tag'] ) {
|
118 |
fwrite( $this->handle, "</" . $this->settings['root_tag'] . ">" . $this->linebreak );
|
119 |
}
|
36 |
fwrite( $this->handle, "<" . $this->settings['root_tag'] . ">" . $this->linebreak );
|
37 |
}
|
38 |
|
39 |
+
fwrite( $this->handle, apply_filters( "woe_xml_output_after_root_tag", '', $this ) );
|
40 |
|
41 |
}
|
42 |
|
71 |
$rec );
|
72 |
$child_labels = apply_filters( 'woe_xml_child_labels_' . $original_key, $child_labels, $field_value,
|
73 |
$rec );
|
74 |
+
|
75 |
+
if ( empty( $child_labels ) ) // can't export!
|
76 |
+
{
|
77 |
continue;
|
78 |
+
}
|
79 |
+
|
80 |
+
$childs = $label ? $xml->addChild( $label ) : $xml; // add Products , or use root!
|
81 |
|
82 |
foreach ( $field_value as $child_key => $child_element ) {
|
83 |
$tag_name = $child_tag ? $child_tag : $child_key;
|
116 |
}
|
117 |
|
118 |
public function finish( $data = '' ) {
|
119 |
+
fwrite( $this->handle, apply_filters( "woe_xml_output_before_closing_root_tag", '', $this ) );
|
120 |
if ( $this->settings['root_tag'] ) {
|
121 |
fwrite( $this->handle, "</" . $this->settings['root_tag'] . ">" . $this->linebreak );
|
122 |
}
|
classes/formats/trait-woe-plain-format.php
CHANGED
@@ -141,7 +141,6 @@ trait WOE_Order_Export_Plain_Format {
|
|
141 |
$combinations = array();
|
142 |
|
143 |
$p_combinations = array();
|
144 |
-
$p_field_ids = array();
|
145 |
if ( $repeat_products ) {
|
146 |
foreach ( self::get_array_from_array( $row, 'products' ) as $products_fields_item ) {
|
147 |
$result_tmp = array();
|
@@ -149,7 +148,6 @@ trait WOE_Order_Export_Plain_Format {
|
|
149 |
if ( isset( $this->labels['products']->$field_name ) ) // label must be assigned!
|
150 |
{
|
151 |
$result_tmp[ 'plain_products_' . $field_name ] = $products_field_value;
|
152 |
-
$p_field_ids[] = 'plain_products_' . $field_name;
|
153 |
}
|
154 |
}
|
155 |
|
@@ -158,7 +156,6 @@ trait WOE_Order_Export_Plain_Format {
|
|
158 |
}
|
159 |
|
160 |
$c_combinations = array();
|
161 |
-
$c_field_ids = array();
|
162 |
if ( $repeat_coupons ) {
|
163 |
foreach ( self::get_array_from_array( $row, 'coupons' ) as $coupons_fields_item ) {
|
164 |
$result_tmp = array();
|
@@ -166,7 +163,6 @@ trait WOE_Order_Export_Plain_Format {
|
|
166 |
if ( isset( $this->labels['coupons']->$field_name ) ) // label must be assigned!
|
167 |
{
|
168 |
$result_tmp[ 'plain_coupons_' . $field_name ] = $coupons_field_value;
|
169 |
-
$c_fields_id[] = 'plain_coupons_' . $field_name;
|
170 |
}
|
171 |
}
|
172 |
|
@@ -213,12 +209,18 @@ trait WOE_Order_Export_Plain_Format {
|
|
213 |
// exclude product and coupon fields from first row when item rows start from new line
|
214 |
// to prevent empty extra delimiters in output csv
|
215 |
if ( $item_rows_start_from_new_line ) {
|
216 |
-
foreach ( $
|
217 |
-
|
|
|
|
|
|
|
218 |
}
|
219 |
|
220 |
-
foreach ( $
|
221 |
-
|
|
|
|
|
|
|
222 |
}
|
223 |
}
|
224 |
|
141 |
$combinations = array();
|
142 |
|
143 |
$p_combinations = array();
|
|
|
144 |
if ( $repeat_products ) {
|
145 |
foreach ( self::get_array_from_array( $row, 'products' ) as $products_fields_item ) {
|
146 |
$result_tmp = array();
|
148 |
if ( isset( $this->labels['products']->$field_name ) ) // label must be assigned!
|
149 |
{
|
150 |
$result_tmp[ 'plain_products_' . $field_name ] = $products_field_value;
|
|
|
151 |
}
|
152 |
}
|
153 |
|
156 |
}
|
157 |
|
158 |
$c_combinations = array();
|
|
|
159 |
if ( $repeat_coupons ) {
|
160 |
foreach ( self::get_array_from_array( $row, 'coupons' ) as $coupons_fields_item ) {
|
161 |
$result_tmp = array();
|
163 |
if ( isset( $this->labels['coupons']->$field_name ) ) // label must be assigned!
|
164 |
{
|
165 |
$result_tmp[ 'plain_coupons_' . $field_name ] = $coupons_field_value;
|
|
|
166 |
}
|
167 |
}
|
168 |
|
209 |
// exclude product and coupon fields from first row when item rows start from new line
|
210 |
// to prevent empty extra delimiters in output csv
|
211 |
if ( $item_rows_start_from_new_line ) {
|
212 |
+
foreach ( $this->labels['products']->to_Array() as $key => $label ) {
|
213 |
+
$key = 'plain_products_' . $key;
|
214 |
+
if ( isset( $row[ $key ] ) ) {
|
215 |
+
unset( $row[ $key ] );
|
216 |
+
}
|
217 |
}
|
218 |
|
219 |
+
foreach ( $this->labels['coupons']->to_Array() as $key => $label ) {
|
220 |
+
$key = 'plain_coupons_' . $key;
|
221 |
+
if ( isset( $row[ $key ] ) ) {
|
222 |
+
unset( $row[ $key ] );
|
223 |
+
}
|
224 |
}
|
225 |
}
|
226 |
|
i18n/languages/woo-order-export-lite.pot
CHANGED
@@ -3,7 +3,7 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: Advanced Order Export For WooCommerce\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
-
"POT-Creation-Date: 2019-
|
7 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
9 |
"Language-Team: \n"
|
@@ -12,596 +12,669 @@ msgstr ""
|
|
12 |
"MIME-Version: 1.0\n"
|
13 |
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
-
"X-Generator: Loco https://localise.biz
|
|
|
16 |
|
17 |
-
#: woo-order-export-lite.php:
|
18 |
msgid ""
|
19 |
"Please, <a href=\"plugins.php\">deactivate</a> Free version of Advanced "
|
20 |
"Order Export For WooCommerce!"
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: view/settings-form.php:
|
24 |
msgid "Field format"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: view/settings-form.php:
|
28 |
-
#: view/settings-form.php:
|
29 |
msgid "-"
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: view/settings-form.php:
|
33 |
msgid "Filter orders by"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: view/settings-form.php:
|
37 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
38 |
msgid "Order Date"
|
39 |
msgstr ""
|
40 |
|
41 |
-
#: view/settings-form.php:
|
42 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
43 |
msgid "Modification Date"
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: view/settings-form.php:
|
47 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
48 |
msgid "Paid Date"
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: view/settings-form.php:
|
52 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
53 |
msgid "Completed Date"
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: view/settings-form.php:
|
57 |
msgid "This date range should not be saved in the scheduled task"
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: view/settings-form.php:
|
61 |
msgid "Date range"
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: view/settings-form.php:
|
65 |
msgid "to"
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: view/settings-form.php:
|
69 |
msgid "Express export"
|
70 |
msgstr ""
|
71 |
|
72 |
-
#: view/settings-form.php:
|
73 |
msgid "Summary Report By Products"
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: view/settings-form.php:
|
77 |
msgid "Export filename"
|
78 |
msgstr ""
|
79 |
|
80 |
-
#: view/settings-form.php:
|
81 |
msgid "Format"
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: view/settings-form.php:
|
85 |
msgid "XLS options"
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: view/settings-form.php:
|
89 |
msgid "Export as .xls (Binary File Format)"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: view/settings-form.php:
|
93 |
msgid "Use sheet name"
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: view/settings-form.php:
|
97 |
-
#: view/settings-form.php:
|
|
|
98 |
msgid "Output column titles as first line"
|
99 |
msgstr ""
|
100 |
|
101 |
-
#: view/settings-form.php:
|
102 |
msgid "Auto column width"
|
103 |
msgstr ""
|
104 |
|
105 |
-
#: view/settings-form.php:
|
106 |
msgid "Right-to-Left direction"
|
107 |
msgstr ""
|
108 |
|
109 |
-
#: view/settings-form.php:
|
110 |
msgid "Force general format for all cells"
|
111 |
msgstr ""
|
112 |
|
113 |
-
#: view/settings-form.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
msgid "CSV options"
|
115 |
msgstr ""
|
116 |
|
117 |
-
#: view/settings-form.php:
|
118 |
msgid "Output UTF-8 BOM"
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: view/settings-form.php:
|
122 |
msgid "Convert line breaks to literals"
|
123 |
msgstr ""
|
124 |
|
125 |
-
#: view/settings-form.php:
|
126 |
-
msgid "
|
127 |
msgstr ""
|
128 |
|
129 |
-
#: view/settings-form.php:
|
130 |
msgid "Enclosure"
|
131 |
msgstr ""
|
132 |
|
133 |
-
#: view/settings-form.php:
|
134 |
msgid "Field Delimiter"
|
135 |
msgstr ""
|
136 |
|
137 |
-
#: view/settings-form.php:
|
138 |
msgid "Line Break"
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: view/settings-form.php:
|
142 |
msgid "Character encoding"
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: view/settings-form.php:
|
146 |
msgid "XML options"
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: view/settings-form.php:
|
150 |
msgid "Please, install/enable PHP XML Extension!"
|
151 |
msgstr ""
|
152 |
|
153 |
-
#: view/settings-form.php:
|
154 |
msgid "Prepend XML"
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: view/settings-form.php:
|
158 |
msgid "Root tag"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: view/settings-form.php:
|
162 |
msgid "Order tag"
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: view/settings-form.php:
|
166 |
msgid "Product tag"
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: view/settings-form.php:
|
170 |
msgid "Coupon tag"
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: view/settings-form.php:
|
174 |
msgid "Append XML"
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: view/settings-form.php:
|
178 |
msgid "Self closing tags"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: view/settings-form.php:
|
182 |
msgid "JSON options"
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: view/settings-form.php:
|
186 |
msgid "Start tag"
|
187 |
msgstr ""
|
188 |
|
189 |
-
#: view/settings-form.php:
|
190 |
msgid "End tag"
|
191 |
msgstr ""
|
192 |
|
193 |
-
#: view/settings-form.php:
|
194 |
msgid "TSV options"
|
195 |
msgstr ""
|
196 |
|
197 |
-
#: view/settings-form.php:
|
198 |
msgid "PDF options"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: view/settings-form.php:
|
202 |
msgid "repeat at each page"
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: view/settings-form.php:
|
206 |
msgid "Orientation"
|
207 |
msgstr ""
|
208 |
|
209 |
-
#: view/settings-form.php:
|
210 |
msgid "Page size"
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: view/settings-form.php:
|
214 |
msgid "Font size"
|
215 |
msgstr ""
|
216 |
|
217 |
-
#: view/settings-form.php:
|
218 |
msgid "Page numbers"
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: view/settings-form.php:
|
222 |
msgid "Left align"
|
223 |
msgstr ""
|
224 |
|
225 |
-
#: view/settings-form.php:
|
226 |
msgid "Center align"
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: view/settings-form.php:
|
230 |
msgid "Right align"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: view/settings-form.php:
|
234 |
msgid "No page numbers"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: view/settings-form.php:
|
238 |
msgid "Page header text"
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: view/settings-form.php:
|
242 |
msgid "Columns width"
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: view/settings-form.php:
|
|
|
246 |
msgid "comma separated list"
|
247 |
msgstr ""
|
248 |
|
249 |
-
#: view/settings-form.php:
|
250 |
msgid "Page footer text"
|
251 |
msgstr ""
|
252 |
|
253 |
-
#: view/settings-form.php:
|
254 |
msgid "Columns align"
|
255 |
msgstr ""
|
256 |
|
257 |
-
#: view/settings-form.php:
|
258 |
msgid "Fit table to page width"
|
259 |
msgstr ""
|
260 |
|
261 |
-
#: view/settings-form.php:
|
262 |
msgid "Yes"
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: view/settings-form.php:
|
266 |
msgid "No"
|
267 |
msgstr ""
|
268 |
|
269 |
-
#: view/settings-form.php:
|
270 |
msgid "Table header text color"
|
271 |
msgstr ""
|
272 |
|
273 |
-
#: view/settings-form.php:
|
274 |
msgid "Table header background color"
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: view/settings-form.php:
|
278 |
msgid "Table row text color"
|
279 |
msgstr ""
|
280 |
|
281 |
-
#: view/settings-form.php:
|
282 |
msgid "Table row background color"
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: view/settings-form.php:
|
286 |
msgid "Page header text color"
|
287 |
msgstr ""
|
288 |
|
289 |
-
#: view/settings-form.php:
|
290 |
msgid "Page footer text color"
|
291 |
msgstr ""
|
292 |
|
293 |
-
#: view/settings-form.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
msgid "Logo align"
|
295 |
msgstr ""
|
296 |
|
297 |
-
#: view/settings-form.php:
|
298 |
msgid "Logo height"
|
299 |
msgstr ""
|
300 |
|
301 |
-
#: view/settings-form.php:
|
302 |
msgid "Logo width"
|
303 |
msgstr ""
|
304 |
|
305 |
-
#: view/settings-form.php:
|
306 |
msgid "0 - auto scale"
|
307 |
msgstr ""
|
308 |
|
309 |
-
#: view/settings-form.php:
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
msgid "Date"
|
312 |
msgstr ""
|
313 |
|
314 |
-
#: view/settings-form.php:
|
315 |
msgid "custom"
|
316 |
msgstr ""
|
317 |
|
318 |
-
#: view/settings-form.php:
|
319 |
msgid "Time"
|
320 |
msgstr ""
|
321 |
|
322 |
-
#: view/settings-form.php:
|
323 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
324 |
msgid "Order ID"
|
325 |
msgstr ""
|
326 |
|
327 |
-
#: view/settings-form.php:
|
|
|
|
|
|
|
|
|
328 |
msgid "Descending"
|
329 |
msgstr ""
|
330 |
|
331 |
-
#: view/settings-form.php:
|
332 |
msgid "Ascending"
|
333 |
msgstr ""
|
334 |
|
335 |
-
#: view/settings-form.php:
|
336 |
#, php-format
|
337 |
msgid "Sort orders by %s in %s order"
|
338 |
msgstr ""
|
339 |
|
340 |
-
#: view/settings-form.php:
|
341 |
msgid "Change order status to"
|
342 |
msgstr ""
|
343 |
|
344 |
-
#: view/settings-form.php:
|
345 |
msgid "- don't modify -"
|
346 |
msgstr ""
|
347 |
|
348 |
-
#: view/settings-form.php:
|
349 |
msgid "Misc settings"
|
350 |
msgstr ""
|
351 |
|
352 |
-
#: view/settings-form.php:
|
353 |
msgid "Format numbers (use WC decimal separator)"
|
354 |
msgstr ""
|
355 |
|
356 |
-
#: view/settings-form.php:
|
357 |
msgid "Export all order notes"
|
358 |
msgstr ""
|
359 |
|
360 |
-
#: view/settings-form.php:
|
361 |
msgid "Export refund notes as Customer Note"
|
362 |
msgstr ""
|
363 |
|
364 |
-
#: view/settings-form.php:
|
365 |
msgid "Strip tags from Product Description/Variation"
|
366 |
msgstr ""
|
367 |
|
368 |
-
#: view/settings-form.php:
|
369 |
msgid "Cleanup phone (export only digits)"
|
370 |
msgstr ""
|
371 |
|
372 |
-
#: view/settings-form.php:
|
373 |
msgid "Enable debug output"
|
374 |
msgstr ""
|
375 |
|
376 |
-
#: view/settings-form.php:
|
377 |
msgid "Custom PHP code to modify output"
|
378 |
msgstr ""
|
379 |
|
380 |
-
#: view/settings-form.php:
|
381 |
msgid ""
|
382 |
"Please check permissions for your role. You must have capability "
|
383 |
"“edit_themes” to use this box."
|
384 |
msgstr ""
|
385 |
|
386 |
-
#: view/settings-form.php:
|
|
|
|
|
|
|
|
|
387 |
msgid "Use only unnamed functions!"
|
388 |
msgstr ""
|
389 |
|
390 |
-
#: view/settings-form.php:
|
391 |
msgid "Filter by order"
|
392 |
msgstr ""
|
393 |
|
394 |
-
#: view/settings-form.php:
|
395 |
msgid "Don't export child orders"
|
396 |
msgstr ""
|
397 |
|
398 |
-
#: view/settings-form.php:
|
399 |
msgid "Export refunds"
|
400 |
msgstr ""
|
401 |
|
402 |
-
#: view/settings-form.php:
|
403 |
msgid "Mark exported orders"
|
404 |
msgstr ""
|
405 |
|
406 |
-
#: view/settings-form.php:
|
407 |
msgid "Export unmarked orders only"
|
408 |
msgstr ""
|
409 |
|
410 |
-
#: view/settings-form.php:
|
411 |
msgid "Order statuses"
|
412 |
msgstr ""
|
413 |
|
414 |
-
#: view/settings-form.php:
|
415 |
msgid "Custom fields"
|
416 |
msgstr ""
|
417 |
|
418 |
-
#: view/settings-form.php:
|
419 |
msgid ""
|
420 |
"The filters won't work correctly.<br>Another plugin(or theme) has loaded "
|
421 |
"outdated Select2.js"
|
422 |
msgstr ""
|
423 |
|
424 |
-
#: view/settings-form.php:
|
425 |
msgid "Filter by product"
|
426 |
msgstr ""
|
427 |
|
428 |
-
#: view/settings-form.php:
|
429 |
msgid "Export all products from the order"
|
430 |
msgstr ""
|
431 |
|
432 |
-
#: view/settings-form.php:
|
433 |
msgid "Skip fully refunded items"
|
434 |
msgstr ""
|
435 |
|
436 |
-
#: view/settings-form.php:
|
437 |
msgid "Product categories"
|
438 |
msgstr ""
|
439 |
|
440 |
-
#: view/settings-form.php:
|
441 |
msgid "Vendor/creator"
|
442 |
msgstr ""
|
443 |
|
444 |
-
#: view/settings-form.php:
|
445 |
msgid "Product"
|
446 |
msgstr ""
|
447 |
|
448 |
-
#: view/settings-form.php:
|
449 |
msgid "Product taxonomies"
|
450 |
msgstr ""
|
451 |
|
452 |
-
#: view/settings-form.php:
|
453 |
msgid "Product custom fields"
|
454 |
msgstr ""
|
455 |
|
456 |
-
#: view/settings-form.php:
|
457 |
msgid "Variable product attributes"
|
458 |
msgstr ""
|
459 |
|
460 |
-
#: view/settings-form.php:
|
461 |
msgid "Item meta data"
|
462 |
msgstr ""
|
463 |
|
464 |
-
#: view/settings-form.php:
|
465 |
msgid "Filter by customers"
|
466 |
msgstr ""
|
467 |
|
468 |
-
#: view/settings-form.php:
|
469 |
msgid "Usernames"
|
470 |
msgstr ""
|
471 |
|
472 |
-
#: view/settings-form.php:
|
473 |
msgid "User roles"
|
474 |
msgstr ""
|
475 |
|
476 |
-
#: view/settings-form.php:
|
477 |
msgid "Filter by coupons"
|
478 |
msgstr ""
|
479 |
|
480 |
-
#: view/settings-form.php:
|
481 |
msgid "Any coupon used"
|
482 |
msgstr ""
|
483 |
|
484 |
-
#: view/settings-form.php:
|
485 |
-
#: classes/admin/class-wc-order-export-manage.php:
|
486 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
487 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
488 |
msgid "Coupons"
|
489 |
msgstr ""
|
490 |
|
491 |
-
#: view/settings-form.php:
|
492 |
msgid "Filter by billing"
|
493 |
msgstr ""
|
494 |
|
495 |
-
#: view/settings-form.php:
|
496 |
msgid "Billing locations"
|
497 |
msgstr ""
|
498 |
|
499 |
-
#: view/settings-form.php:
|
500 |
msgid "Payment methods"
|
501 |
msgstr ""
|
502 |
|
503 |
-
#: view/settings-form.php:
|
504 |
msgid "Filter by shipping"
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: view/settings-form.php:
|
508 |
msgid "Shipping locations"
|
509 |
msgstr ""
|
510 |
|
511 |
-
#: view/settings-form.php:
|
512 |
msgid "Shipping methods"
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: view/settings-form.php:
|
516 |
msgid "Filter by item and metadata"
|
517 |
msgstr ""
|
518 |
|
519 |
-
#: view/settings-form.php:
|
520 |
msgid "Item names"
|
521 |
msgstr ""
|
522 |
|
523 |
-
#: view/settings-form.php:
|
524 |
msgid "Item metadata"
|
525 |
msgstr ""
|
526 |
|
527 |
-
#: view/settings-form.php:
|
528 |
msgid "Set up fields to export"
|
529 |
msgstr ""
|
530 |
|
531 |
-
#: view/settings-form.php:
|
|
|
|
|
|
|
|
|
532 |
msgid "Drag rows to reorder exported fields"
|
533 |
msgstr ""
|
534 |
|
535 |
-
#: view/settings-form.php:
|
536 |
msgid "Remove all fields"
|
537 |
msgstr ""
|
538 |
|
539 |
-
#: view/settings-form.php:
|
540 |
msgid "Actions"
|
541 |
msgstr ""
|
542 |
|
543 |
-
#: view/settings-form.php:
|
544 |
msgid "Add field"
|
545 |
msgstr ""
|
546 |
|
547 |
-
#: view/settings-form.php:
|
548 |
msgid "Add static field"
|
549 |
msgstr ""
|
550 |
|
551 |
-
#: view/settings-form.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
msgid "Meta key"
|
553 |
msgstr ""
|
554 |
|
555 |
-
#: view/settings-form.php:
|
556 |
-
#: view/settings-form.php:
|
557 |
msgid "or type meta key here"
|
558 |
msgstr ""
|
559 |
|
560 |
-
#: view/settings-form.php:
|
561 |
-
#: view/settings-form.php:
|
562 |
msgid "Hide unused fields"
|
563 |
msgstr ""
|
564 |
|
565 |
-
#: view/settings-form.php:
|
566 |
-
#: view/settings-form.php:
|
567 |
-
#: view/settings-form.php:
|
|
|
568 |
msgid "Column name"
|
569 |
msgstr ""
|
570 |
|
571 |
-
#: view/settings-form.php:
|
572 |
-
#: view/settings-form.php:
|
573 |
-
#: view/settings-form.php:
|
|
|
574 |
msgid "Confirm"
|
575 |
msgstr ""
|
576 |
|
577 |
-
#: view/settings-form.php:
|
578 |
-
#: view/settings-form.php:
|
579 |
-
#: view/settings-form.php:
|
|
|
580 |
msgid "Cancel"
|
581 |
msgstr ""
|
582 |
|
583 |
-
#: view/settings-form.php:
|
584 |
-
#: view/settings-form.php:
|
585 |
msgid "Value"
|
586 |
msgstr ""
|
587 |
|
588 |
-
#: view/settings-form.php:
|
589 |
msgid "Product fields"
|
590 |
msgstr ""
|
591 |
|
592 |
-
#: view/settings-form.php:
|
593 |
msgid "Order item fields"
|
594 |
msgstr ""
|
595 |
|
596 |
-
#: view/settings-form.php:
|
597 |
msgid "OR"
|
598 |
msgstr ""
|
599 |
|
600 |
-
#: view/settings-form.php:
|
601 |
msgid "Taxonomy"
|
602 |
msgstr ""
|
603 |
|
604 |
-
#: view/settings-form.php:
|
605 |
#, php-format
|
606 |
msgid ""
|
607 |
"If you see this message after page load, user interface won't work correctly!"
|
@@ -609,60 +682,56 @@ msgid ""
|
|
609 |
"it). Probably, it's a conflict with another plugin or active theme."
|
610 |
msgstr ""
|
611 |
|
612 |
-
#: view/settings-form.php:
|
613 |
msgid "Preview"
|
614 |
msgstr ""
|
615 |
|
616 |
-
#: view/settings-form.php:
|
617 |
msgid "Might be different from actual export!"
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: view/settings-form.php:
|
621 |
msgid "Save settings"
|
622 |
msgstr ""
|
623 |
|
624 |
-
#: view/settings-form.php:
|
625 |
msgid "Save & Exit"
|
626 |
msgstr ""
|
627 |
|
628 |
-
#: view/settings-form.php:
|
629 |
msgid "Export"
|
630 |
msgstr ""
|
631 |
|
632 |
-
#: view/settings-form.php:
|
633 |
msgid "Export [w/o progressbar]"
|
634 |
msgstr ""
|
635 |
|
636 |
-
#: view/settings-form.php:
|
637 |
msgid "It might not work for huge datasets!"
|
638 |
msgstr ""
|
639 |
|
640 |
-
#: view/settings-form.php:
|
641 |
-
msgid "Save as a profile"
|
642 |
-
msgstr ""
|
643 |
-
|
644 |
-
#: view/settings-form.php:1448
|
645 |
msgid "Reset settings"
|
646 |
msgstr ""
|
647 |
|
648 |
-
#: view/settings-form.php:
|
649 |
#, php-format
|
650 |
msgid "Export total: %s orders"
|
651 |
msgstr ""
|
652 |
|
653 |
-
#: view/settings-form.php:
|
654 |
msgid "Preview size"
|
655 |
msgstr ""
|
656 |
|
657 |
-
#: view/settings-form.php:
|
658 |
msgid "Settings were successfully updated!"
|
659 |
msgstr ""
|
660 |
|
661 |
-
#: view/settings-form.php:
|
662 |
msgid "Press 'Esc' to cancel the export"
|
663 |
msgstr ""
|
664 |
|
665 |
-
#: view/settings-form.php:
|
666 |
msgid "Click here to download"
|
667 |
msgstr ""
|
668 |
|
@@ -670,244 +739,231 @@ msgstr ""
|
|
670 |
msgid "Settings saved"
|
671 |
msgstr ""
|
672 |
|
673 |
-
#:
|
674 |
-
msgid "Export now"
|
675 |
-
msgstr ""
|
676 |
-
|
677 |
-
#: view/main.php:12 view/tab/tools.php:22
|
678 |
-
msgid "Profiles"
|
679 |
-
msgstr ""
|
680 |
-
|
681 |
-
#: view/main.php:13 view/tab/tools.php:23
|
682 |
-
msgid "Status change jobs"
|
683 |
-
msgstr ""
|
684 |
-
|
685 |
-
#: view/main.php:14 view/tab/tools.php:24
|
686 |
-
msgid "Scheduled jobs"
|
687 |
-
msgstr ""
|
688 |
-
|
689 |
-
#: view/main.php:15
|
690 |
-
msgid "Tools"
|
691 |
-
msgstr ""
|
692 |
-
|
693 |
-
#: view/main.php:16
|
694 |
-
msgid "Help"
|
695 |
-
msgstr ""
|
696 |
-
|
697 |
-
#: classes/class-wc-order-export-admin.php:88
|
698 |
msgid "Export Status"
|
699 |
msgstr ""
|
700 |
|
701 |
-
#: classes/class-wc-order-export-admin.php:
|
702 |
msgid ""
|
703 |
"Advanced Order Export For WooCommerce is available <a href=\"admin.php?"
|
704 |
"page=wc-order-export\">on this page</a>."
|
705 |
msgstr ""
|
706 |
|
707 |
-
#: classes/class-wc-order-export-admin.php:
|
708 |
msgid "Settings"
|
709 |
msgstr ""
|
710 |
|
711 |
-
#: classes/class-wc-order-export-admin.php:
|
712 |
msgid "Docs"
|
713 |
msgstr ""
|
714 |
|
715 |
-
#: classes/class-wc-order-export-admin.php:
|
716 |
msgid "Support"
|
717 |
msgstr ""
|
718 |
|
719 |
-
#: classes/class-wc-order-export-admin.php:
|
720 |
-
#: classes/class-wc-order-export-admin.php:
|
721 |
-
#: classes/class-wc-order-export-admin.php:
|
722 |
-
#: classes/class-wc-order-export-admin.php:
|
723 |
msgid "Export Orders"
|
724 |
msgstr ""
|
725 |
|
726 |
-
#: classes/class-wc-order-export-admin.php:
|
727 |
-
msgid "Copied from \"Export now\""
|
728 |
-
msgstr ""
|
729 |
-
|
730 |
-
#: classes/class-wc-order-export-admin.php:657
|
731 |
#, php-format
|
732 |
msgid "Add %s fields"
|
733 |
msgstr ""
|
734 |
|
735 |
-
#: classes/class-wc-order-export-admin.php:
|
736 |
msgid "rows"
|
737 |
msgstr ""
|
738 |
|
739 |
-
#: classes/class-wc-order-export-admin.php:
|
740 |
msgid "columns"
|
741 |
msgstr ""
|
742 |
|
743 |
-
#: classes/class-wc-order-export-admin.php:
|
744 |
msgid "one row"
|
745 |
msgstr ""
|
746 |
|
747 |
-
#: classes/class-wc-order-export-admin.php:
|
748 |
msgid "Add"
|
749 |
msgstr ""
|
750 |
|
751 |
-
#: classes/class-wc-order-export-admin.php:
|
752 |
msgid "as"
|
753 |
msgstr ""
|
754 |
|
755 |
-
#: classes/class-wc-order-export-admin.php:
|
756 |
msgid "Split values by"
|
757 |
msgstr ""
|
758 |
|
759 |
-
#: classes/class-wc-order-export-admin.php:
|
760 |
msgid "Fill order columns for"
|
761 |
msgstr ""
|
762 |
|
763 |
-
#: classes/class-wc-order-export-admin.php:
|
764 |
msgid "all rows"
|
765 |
msgstr ""
|
766 |
|
767 |
-
#: classes/class-wc-order-export-admin.php:
|
768 |
msgid "1st row only"
|
769 |
msgstr ""
|
770 |
|
771 |
-
#: classes/class-wc-order-export-admin.php:
|
772 |
msgid "Grouping by product"
|
773 |
msgstr ""
|
774 |
|
775 |
-
#: classes/class-wc-order-export-admin.php:
|
776 |
msgid "Grouping by coupon"
|
777 |
msgstr ""
|
778 |
|
779 |
-
#: classes/class-wc-order-export-admin.php:
|
780 |
msgid "Set up product fields"
|
781 |
msgstr ""
|
782 |
|
783 |
-
#: classes/class-wc-order-export-admin.php:
|
784 |
msgid "Set up coupon fields"
|
785 |
msgstr ""
|
786 |
|
787 |
-
#: classes/class-wc-order-export-admin.php:
|
788 |
msgid "products"
|
789 |
msgstr ""
|
790 |
|
791 |
-
#: classes/class-wc-order-export-admin.php:
|
792 |
msgid "coupons"
|
793 |
msgstr ""
|
794 |
|
795 |
-
#: classes/class-wc-order-export-admin.php:
|
796 |
msgid "Remove all fields?"
|
797 |
msgstr ""
|
798 |
|
799 |
-
#: classes/class-wc-order-export-admin.php:
|
800 |
msgid ""
|
801 |
"This action will reset filters, settings and fields to default state. Are "
|
802 |
"you sure?"
|
803 |
msgstr ""
|
804 |
|
805 |
-
#: classes/class-wc-order-export-admin.php:
|
806 |
msgid "empty column name"
|
807 |
msgstr ""
|
808 |
|
809 |
-
#: classes/class-wc-order-export-admin.php:
|
810 |
msgid "empty meta key"
|
811 |
msgstr ""
|
812 |
|
813 |
-
#: classes/class-wc-order-export-admin.php:
|
814 |
msgid "select product field or item field or taxonomy"
|
815 |
msgstr ""
|
816 |
|
817 |
-
#: classes/class-wc-order-export-admin.php:
|
818 |
msgid "empty value"
|
819 |
msgstr ""
|
820 |
|
821 |
-
#: classes/class-wc-order-export-admin.php:
|
822 |
msgid "title is empty"
|
823 |
msgstr ""
|
824 |
|
825 |
-
#: classes/class-wc-order-export-admin.php:
|
826 |
msgid "Date From is greater than Date To"
|
827 |
msgstr ""
|
828 |
|
829 |
-
#: classes/class-wc-order-export-admin.php:
|
830 |
msgid "Please, set up fields to export"
|
831 |
msgstr ""
|
832 |
|
833 |
-
#: classes/class-wc-order-export-admin.php:
|
834 |
-
#: classes/admin/
|
835 |
-
#: classes/core/class-wc-order-export-engine.php:747
|
836 |
-
#: classes/core/class-wc-order-export-engine.php:760
|
837 |
msgid "Nothing to export. Please, adjust your filters"
|
838 |
msgstr ""
|
839 |
|
840 |
-
#: classes/class-wc-order-export-admin.php:
|
841 |
-
#: classes/core/class-wc-order-export-data-extractor.php:
|
842 |
msgid "empty"
|
843 |
msgstr ""
|
844 |
|
845 |
-
#: classes/class-wc-order-export-admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
846 |
#, php-format
|
847 |
-
msgid "
|
848 |
msgstr ""
|
849 |
|
850 |
-
#: classes/class-wc-order-export-admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
851 |
#, php-format
|
852 |
msgid "Export as %s"
|
853 |
msgstr ""
|
854 |
|
855 |
-
#: classes/class-wc-order-export-admin.php:
|
856 |
msgid "Mark exported"
|
857 |
msgstr ""
|
858 |
|
859 |
-
#: classes/class-wc-order-export-admin.php:
|
860 |
msgid "Unmark exported"
|
861 |
msgstr ""
|
862 |
|
863 |
-
#: classes/class-wc-order-export-admin.php:
|
864 |
-
#, php-format
|
865 |
-
msgid "Export as profile '%s'"
|
866 |
-
msgstr ""
|
867 |
-
|
868 |
-
#: classes/class-wc-order-export-admin.php:1004
|
869 |
#, php-format
|
870 |
msgid "%s order marked."
|
871 |
msgid_plural "%s orders marked."
|
872 |
msgstr[0] ""
|
873 |
msgstr[1] ""
|
874 |
|
875 |
-
#: classes/class-wc-order-export-admin.php:
|
876 |
#, php-format
|
877 |
msgid "%s order unmarked."
|
878 |
msgid_plural "%s orders unmarked."
|
879 |
msgstr[0] ""
|
880 |
msgstr[1] ""
|
881 |
|
882 |
-
#: view/tab/tools.php:
|
883 |
msgid "Export settings"
|
884 |
msgstr ""
|
885 |
|
886 |
-
#: view/tab/tools.php:
|
887 |
msgid ""
|
888 |
"Copy these settings and use it to migrate plugin to another WordPress "
|
889 |
"install."
|
890 |
msgstr ""
|
891 |
|
892 |
-
#: view/tab/tools.php:
|
893 |
msgid "All"
|
894 |
msgstr ""
|
895 |
|
896 |
-
#: view/tab/tools.php:
|
|
|
|
|
|
|
|
|
|
|
897 |
msgid "Just click inside the textarea and copy (Ctrl+C)"
|
898 |
msgstr ""
|
899 |
|
900 |
-
#: view/tab/tools.php:
|
901 |
msgid "Import settings"
|
902 |
msgstr ""
|
903 |
|
904 |
-
#: view/tab/tools.php:
|
905 |
msgid ""
|
906 |
"Paste text into this field to import settings into the current WordPress "
|
907 |
"install."
|
908 |
msgstr ""
|
909 |
|
910 |
-
#: view/tab/tools.php:
|
911 |
msgid ""
|
912 |
"This process will overwrite your settings for \"Advanced Order Export For "
|
913 |
"WooCommerce\" !"
|
@@ -917,7 +973,7 @@ msgstr ""
|
|
917 |
msgid "Import"
|
918 |
msgstr ""
|
919 |
|
920 |
-
#: view/tab/tools.php:
|
921 |
msgid "Are you sure to continue?"
|
922 |
msgstr ""
|
923 |
|
@@ -974,17 +1030,18 @@ msgstr ""
|
|
974 |
msgid "Buy %s to get access to Scheduled jobs"
|
975 |
msgstr ""
|
976 |
|
977 |
-
#: classes/formats/abstract-class-woe-formatter-sv.php:
|
978 |
-
#: classes/formats/class-woe-formatter-
|
979 |
-
|
|
|
980 |
msgstr ""
|
981 |
|
982 |
#: classes/formats/abstract-class-woe-formatter.php:49
|
983 |
msgid "can not open for output"
|
984 |
msgstr ""
|
985 |
|
986 |
-
#: classes/formats/class-woe-formatter-xls.php:
|
987 |
-
#: classes/admin/class-wc-order-export-manage.php:
|
988 |
msgid "Orders"
|
989 |
msgstr ""
|
990 |
|
@@ -1016,602 +1073,641 @@ msgstr ""
|
|
1016 |
msgid "Sat"
|
1017 |
msgstr ""
|
1018 |
|
1019 |
-
#: classes/admin/class-wc-order-export-manage.php:
|
1020 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1021 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1022 |
msgid "Products"
|
1023 |
msgstr ""
|
1024 |
|
1025 |
-
#: classes/
|
1026 |
-
msgid "Wrong key for cron url!"
|
1027 |
-
msgstr ""
|
1028 |
-
|
1029 |
-
#: classes/admin/class-wc-order-export-ajax.php:260
|
1030 |
-
msgid "Can't create temporary file"
|
1031 |
-
msgstr ""
|
1032 |
-
|
1033 |
-
#: classes/admin/class-wc-order-export-ajax.php:282
|
1034 |
-
msgid "Can't find exported file"
|
1035 |
-
msgstr ""
|
1036 |
-
|
1037 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:344
|
1038 |
msgid "Item ID"
|
1039 |
msgstr ""
|
1040 |
|
1041 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1042 |
msgid "Item #"
|
1043 |
msgstr ""
|
1044 |
|
1045 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1046 |
msgid "SKU"
|
1047 |
msgstr ""
|
1048 |
|
1049 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1050 |
msgid "Item Name"
|
1051 |
msgstr ""
|
1052 |
|
1053 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1054 |
msgid "Product Id"
|
1055 |
msgstr ""
|
1056 |
|
1057 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1058 |
msgid "Product Name"
|
1059 |
msgstr ""
|
1060 |
|
1061 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1062 |
msgid "Variation Id"
|
1063 |
msgstr ""
|
1064 |
|
1065 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1066 |
msgid "Product Variation"
|
1067 |
msgstr ""
|
1068 |
|
1069 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1070 |
msgid "Item Seller"
|
1071 |
msgstr ""
|
1072 |
|
1073 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1074 |
msgid "Quantity"
|
1075 |
msgstr ""
|
1076 |
|
1077 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1078 |
msgid "Quantity (- Refund)"
|
1079 |
msgstr ""
|
1080 |
|
1081 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1082 |
msgid "Item Cost"
|
1083 |
msgstr ""
|
1084 |
|
1085 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1086 |
msgid "Product Current Price"
|
1087 |
msgstr ""
|
1088 |
|
1089 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1090 |
msgid "Order Line (w/o tax)"
|
1091 |
msgstr ""
|
1092 |
|
1093 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1094 |
msgid "Order Line Tax"
|
1095 |
msgstr ""
|
1096 |
|
1097 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1098 |
msgid "Order Line Tax Refunded"
|
1099 |
msgstr ""
|
1100 |
|
1101 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1102 |
msgid "Order Line Tax (- Refund)"
|
1103 |
msgstr ""
|
1104 |
|
1105 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1106 |
msgid "Order Line Subtotal"
|
1107 |
msgstr ""
|
1108 |
|
1109 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1110 |
msgid "Order Line Subtotal Tax"
|
1111 |
msgstr ""
|
1112 |
|
1113 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1114 |
msgid "Order Line Total"
|
1115 |
msgstr ""
|
1116 |
|
1117 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1118 |
msgid "Order Line Total (include tax)"
|
1119 |
msgstr ""
|
1120 |
|
1121 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1122 |
msgid "Order Line Total Refunded"
|
1123 |
msgstr ""
|
1124 |
|
1125 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1126 |
msgid "Order Line Total (- Refund)"
|
1127 |
msgstr ""
|
1128 |
|
1129 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1130 |
msgid "Item Discount Amount"
|
1131 |
msgstr ""
|
1132 |
|
1133 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1134 |
msgid "Item Tax Rate"
|
1135 |
msgstr ""
|
1136 |
|
1137 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1138 |
msgid "Type"
|
1139 |
msgstr ""
|
1140 |
|
1141 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1142 |
msgid "Category"
|
1143 |
msgstr ""
|
1144 |
|
1145 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1146 |
msgid "Tags"
|
1147 |
msgstr ""
|
1148 |
|
1149 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1150 |
msgid "Width"
|
1151 |
msgstr ""
|
1152 |
|
1153 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1154 |
msgid "Length"
|
1155 |
msgstr ""
|
1156 |
|
1157 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1158 |
msgid "Height"
|
1159 |
msgstr ""
|
1160 |
|
1161 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1162 |
msgid "Weight"
|
1163 |
msgstr ""
|
1164 |
|
1165 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1166 |
msgid "Product URL"
|
1167 |
msgstr ""
|
1168 |
|
1169 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1170 |
msgid "Download URL"
|
1171 |
msgstr ""
|
1172 |
|
1173 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
|
|
|
|
|
|
|
|
1174 |
msgid "Image URL"
|
1175 |
msgstr ""
|
1176 |
|
1177 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1178 |
msgid "Product Shipping Class"
|
1179 |
msgstr ""
|
1180 |
|
1181 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1182 |
msgid "Description"
|
1183 |
msgstr ""
|
1184 |
|
1185 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1186 |
msgid "Short Description"
|
1187 |
msgstr ""
|
1188 |
|
1189 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1190 |
msgid "Full names for categories"
|
1191 |
msgstr ""
|
1192 |
|
1193 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1194 |
msgid "Summary Report Total Quantity"
|
1195 |
msgstr ""
|
1196 |
|
1197 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1198 |
msgid "Summary Report Total Amount"
|
1199 |
msgstr ""
|
1200 |
|
1201 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
|
|
|
|
|
|
|
|
1202 |
msgid "Coupon Code"
|
1203 |
msgstr ""
|
1204 |
|
1205 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1206 |
msgid "Discount Amount"
|
1207 |
msgstr ""
|
1208 |
|
1209 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1210 |
msgid "Discount Amount Tax"
|
1211 |
msgstr ""
|
1212 |
|
1213 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1214 |
msgid "Discount Amount + Tax"
|
1215 |
msgstr ""
|
1216 |
|
1217 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1218 |
msgid "Coupon Description"
|
1219 |
msgstr ""
|
1220 |
|
1221 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1222 |
msgid "Coupon Type"
|
1223 |
msgstr ""
|
1224 |
|
1225 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1226 |
msgid "Coupon Amount"
|
1227 |
msgstr ""
|
1228 |
|
1229 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1230 |
msgid "Line number"
|
1231 |
msgstr ""
|
1232 |
|
1233 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1234 |
msgid "Order Number"
|
1235 |
msgstr ""
|
1236 |
|
1237 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1238 |
msgid "Order Status"
|
1239 |
msgstr ""
|
1240 |
|
1241 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1242 |
msgid "Transaction ID"
|
1243 |
msgstr ""
|
1244 |
|
1245 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1246 |
msgid "Currency"
|
1247 |
msgstr ""
|
1248 |
|
1249 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1250 |
msgid "Date of first refund"
|
1251 |
msgstr ""
|
1252 |
|
1253 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1254 |
msgid "Customer Note"
|
1255 |
msgstr ""
|
1256 |
|
1257 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1258 |
msgid "Order Notes"
|
1259 |
msgstr ""
|
1260 |
|
1261 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
|
|
|
|
|
|
|
|
1262 |
msgid "Customer IP address"
|
1263 |
msgstr ""
|
1264 |
|
1265 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1266 |
msgid "Customer User ID"
|
1267 |
msgstr ""
|
1268 |
|
1269 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1270 |
msgid "Customer Username"
|
1271 |
msgstr ""
|
1272 |
|
1273 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1274 |
msgid "User Website"
|
1275 |
msgstr ""
|
1276 |
|
1277 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1278 |
msgid "Customer User Email"
|
1279 |
msgstr ""
|
1280 |
|
1281 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1282 |
msgid "Customer Role"
|
1283 |
msgstr ""
|
1284 |
|
1285 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1286 |
msgid "Customer Total Orders"
|
1287 |
msgstr ""
|
1288 |
|
1289 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1290 |
msgid "First Name (Billing)"
|
1291 |
msgstr ""
|
1292 |
|
1293 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1294 |
msgid "Last Name (Billing)"
|
1295 |
msgstr ""
|
1296 |
|
1297 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1298 |
msgid "Full Name (Billing)"
|
1299 |
msgstr ""
|
1300 |
|
1301 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1302 |
msgid "Company (Billing)"
|
1303 |
msgstr ""
|
1304 |
|
1305 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1306 |
msgid "Address 1&2 (Billing)"
|
1307 |
msgstr ""
|
1308 |
|
1309 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1310 |
msgid "Address 1 (Billing)"
|
1311 |
msgstr ""
|
1312 |
|
1313 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1314 |
msgid "Address 2 (Billing)"
|
1315 |
msgstr ""
|
1316 |
|
1317 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1318 |
msgid "City (Billing)"
|
1319 |
msgstr ""
|
1320 |
|
1321 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1322 |
msgid "State Code (Billing)"
|
1323 |
msgstr ""
|
1324 |
|
1325 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1326 |
msgid "City, State, Zip (Billing)"
|
1327 |
msgstr ""
|
1328 |
|
1329 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1330 |
msgid "City, State Zip (Billing)"
|
1331 |
msgstr ""
|
1332 |
|
1333 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1334 |
msgid "State Name (Billing)"
|
1335 |
msgstr ""
|
1336 |
|
1337 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1338 |
msgid "Postcode (Billing)"
|
1339 |
msgstr ""
|
1340 |
|
1341 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1342 |
msgid "Country Code (Billing)"
|
1343 |
msgstr ""
|
1344 |
|
1345 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1346 |
msgid "Country Name (Billing)"
|
1347 |
msgstr ""
|
1348 |
|
1349 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1350 |
msgid "Email (Billing)"
|
1351 |
msgstr ""
|
1352 |
|
1353 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1354 |
msgid "Phone (Billing)"
|
1355 |
msgstr ""
|
1356 |
|
1357 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1358 |
msgid "First Name (Shipping)"
|
1359 |
msgstr ""
|
1360 |
|
1361 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1362 |
msgid "Last Name (Shipping)"
|
1363 |
msgstr ""
|
1364 |
|
1365 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1366 |
msgid "Full Name (Shipping)"
|
1367 |
msgstr ""
|
1368 |
|
1369 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1370 |
msgid "Company (Shipping)"
|
1371 |
msgstr ""
|
1372 |
|
1373 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1374 |
msgid "Address 1&2 (Shipping)"
|
1375 |
msgstr ""
|
1376 |
|
1377 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1378 |
msgid "Address 1 (Shipping)"
|
1379 |
msgstr ""
|
1380 |
|
1381 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1382 |
msgid "Address 2 (Shipping)"
|
1383 |
msgstr ""
|
1384 |
|
1385 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1386 |
msgid "City (Shipping)"
|
1387 |
msgstr ""
|
1388 |
|
1389 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1390 |
msgid "State Code (Shipping)"
|
1391 |
msgstr ""
|
1392 |
|
1393 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1394 |
msgid "City, State, Zip (Shipping)"
|
1395 |
msgstr ""
|
1396 |
|
1397 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1398 |
msgid "City, State Zip (Shipping)"
|
1399 |
msgstr ""
|
1400 |
|
1401 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1402 |
msgid "State Name (Shipping)"
|
1403 |
msgstr ""
|
1404 |
|
1405 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1406 |
msgid "Postcode (Shipping)"
|
1407 |
msgstr ""
|
1408 |
|
1409 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1410 |
msgid "Country Code (Shipping)"
|
1411 |
msgstr ""
|
1412 |
|
1413 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1414 |
msgid "Country Name (Shipping)"
|
1415 |
msgstr ""
|
1416 |
|
1417 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1418 |
msgid "Shipping Method Title"
|
1419 |
msgstr ""
|
1420 |
|
1421 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1422 |
msgid "Shipping Method"
|
1423 |
msgstr ""
|
1424 |
|
1425 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
|
|
|
|
|
|
|
|
1426 |
msgid "Payment Method Title"
|
1427 |
msgstr ""
|
1428 |
|
1429 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1430 |
msgid "Payment Method"
|
1431 |
msgstr ""
|
1432 |
|
1433 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1434 |
msgid "Coupons Used"
|
1435 |
msgstr ""
|
1436 |
|
1437 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1438 |
msgid "Cart Discount Amount"
|
1439 |
msgstr ""
|
1440 |
|
1441 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1442 |
msgid "Cart Discount Amount Tax"
|
1443 |
msgstr ""
|
1444 |
|
1445 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1446 |
msgid "Order Subtotal Amount"
|
1447 |
msgstr ""
|
1448 |
|
1449 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1450 |
msgid "Order Subtotal - Cart Discount"
|
1451 |
msgstr ""
|
1452 |
|
1453 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1454 |
msgid "Order Subtotal Amount Refunded"
|
1455 |
msgstr ""
|
1456 |
|
1457 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1458 |
msgid "Order Subtotal Amount (- Refund)"
|
1459 |
msgstr ""
|
1460 |
|
1461 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1462 |
msgid "Order Tax Amount"
|
1463 |
msgstr ""
|
1464 |
|
1465 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1466 |
msgid "Order Shipping Amount"
|
1467 |
msgstr ""
|
1468 |
|
1469 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1470 |
msgid "Order Shipping + Tax Amount"
|
1471 |
msgstr ""
|
1472 |
|
1473 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1474 |
msgid "Order Shipping Amount Refunded"
|
1475 |
msgstr ""
|
1476 |
|
1477 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1478 |
msgid "Order Shipping Amount (- Refund)"
|
1479 |
msgstr ""
|
1480 |
|
1481 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1482 |
msgid "Order Shipping Tax Amount"
|
1483 |
msgstr ""
|
1484 |
|
1485 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1486 |
msgid "Order Shipping Tax Refunded"
|
1487 |
msgstr ""
|
1488 |
|
1489 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1490 |
msgid "Order Shipping Tax Amount (- Refund)"
|
1491 |
msgstr ""
|
1492 |
|
1493 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1494 |
msgid "Order Total Fee"
|
1495 |
msgstr ""
|
1496 |
|
1497 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1498 |
msgid "Order Refund Amount"
|
1499 |
msgstr ""
|
1500 |
|
1501 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1502 |
msgid "Order Total Amount (- Refund)"
|
1503 |
msgstr ""
|
1504 |
|
1505 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1506 |
msgid "Order Total Amount"
|
1507 |
msgstr ""
|
1508 |
|
1509 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1510 |
msgid "Order Total Amount without Tax"
|
1511 |
msgstr ""
|
1512 |
|
1513 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1514 |
msgid "Order Total Tax Amount"
|
1515 |
msgstr ""
|
1516 |
|
1517 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1518 |
msgid "Order Total Tax Amount Refunded"
|
1519 |
msgstr ""
|
1520 |
|
1521 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1522 |
msgid "Order Total Tax Amount (- Refund)"
|
1523 |
msgstr ""
|
1524 |
|
1525 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1526 |
msgid "Total weight"
|
1527 |
msgstr ""
|
1528 |
|
1529 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1530 |
msgid "Total items"
|
1531 |
msgstr ""
|
1532 |
|
1533 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1534 |
msgid "Exported items"
|
1535 |
msgstr ""
|
1536 |
|
1537 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1538 |
msgid "Total products"
|
1539 |
msgstr ""
|
1540 |
|
1541 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1542 |
msgid "Common"
|
1543 |
msgstr ""
|
1544 |
|
1545 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1546 |
msgid "User"
|
1547 |
msgstr ""
|
1548 |
|
1549 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1550 |
msgid "Billing Address"
|
1551 |
msgstr ""
|
1552 |
|
1553 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1554 |
msgid "Shipping Address"
|
1555 |
msgstr ""
|
1556 |
|
1557 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1558 |
msgid "Cart"
|
1559 |
msgstr ""
|
1560 |
|
1561 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1562 |
msgid "Shipping"
|
1563 |
msgstr ""
|
1564 |
|
1565 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1566 |
msgid "Totals"
|
1567 |
msgstr ""
|
1568 |
|
1569 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1570 |
msgid "Others"
|
1571 |
msgstr ""
|
1572 |
|
1573 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1574 |
msgid "String"
|
1575 |
msgstr ""
|
1576 |
|
1577 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1578 |
msgid "Money"
|
1579 |
msgstr ""
|
1580 |
|
1581 |
-
#: classes/core/class-wc-order-export-data-extractor-ui.php:
|
1582 |
msgid "Number"
|
1583 |
msgstr ""
|
1584 |
|
1585 |
-
#: classes/core/class-wc-order-export-data-extractor.php:
|
1586 |
-
msgid "
|
1587 |
-
msgstr ""
|
1588 |
-
|
1589 |
-
#: classes/core/class-wc-order-export-engine.php:19
|
1590 |
-
#: classes/core/class-wc-order-export-engine.php:63
|
1591 |
-
msgid "No destination selected"
|
1592 |
msgstr ""
|
1593 |
|
1594 |
-
#: classes/core/class-wc-order-export-
|
1595 |
-
msgid "
|
1596 |
msgstr ""
|
1597 |
|
1598 |
-
#: classes/core/class-wc-order-export-
|
1599 |
-
msgid "
|
1600 |
msgstr ""
|
1601 |
|
1602 |
-
#: classes/core/class-wc-order-export-engine.php:
|
1603 |
msgid "Don't Panic"
|
1604 |
msgstr ""
|
1605 |
|
1606 |
-
#: classes/core/class-wc-order-export-engine.php:
|
1607 |
#, php-format
|
1608 |
msgid "The code you are trying to save produced a fatal error on line %d:"
|
1609 |
msgstr ""
|
1610 |
|
1611 |
-
#: classes/core/class-wc-order-export-engine.php:
|
1612 |
msgid "Main SQL queries are listed below"
|
1613 |
msgstr ""
|
1614 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1615 |
#. Name of the plugin
|
1616 |
msgid "Advanced Order Export For WooCommerce"
|
1617 |
msgstr ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: Advanced Order Export For WooCommerce\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
+
"POT-Creation-Date: 2019-07-03 07:56+0000\n"
|
7 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
9 |
"Language-Team: \n"
|
12 |
"MIME-Version: 1.0\n"
|
13 |
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
+
"X-Generator: Loco https://localise.biz/\n"
|
16 |
+
"X-Loco-Version: 2.3.0; wp-5.2.2"
|
17 |
|
18 |
+
#: woo-order-export-lite.php:34
|
19 |
msgid ""
|
20 |
"Please, <a href=\"plugins.php\">deactivate</a> Free version of Advanced "
|
21 |
"Order Export For WooCommerce!"
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: view/settings-form.php:43
|
25 |
msgid "Field format"
|
26 |
msgstr ""
|
27 |
|
28 |
+
#: view/settings-form.php:46 view/settings-form.php:616
|
29 |
+
#: view/settings-form.php:642
|
30 |
msgid "-"
|
31 |
msgstr ""
|
32 |
|
33 |
+
#: view/settings-form.php:110
|
34 |
msgid "Filter orders by"
|
35 |
msgstr ""
|
36 |
|
37 |
+
#: view/settings-form.php:116 view/settings-form.php:660
|
38 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:657
|
39 |
msgid "Order Date"
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: view/settings-form.php:123 view/settings-form.php:661
|
43 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:662
|
44 |
msgid "Modification Date"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: view/settings-form.php:130
|
48 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:682
|
49 |
msgid "Paid Date"
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: view/settings-form.php:137
|
53 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:677
|
54 |
msgid "Completed Date"
|
55 |
msgstr ""
|
56 |
|
57 |
+
#: view/settings-form.php:142
|
58 |
msgid "This date range should not be saved in the scheduled task"
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: view/settings-form.php:145
|
62 |
msgid "Date range"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: view/settings-form.php:148
|
66 |
msgid "to"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: view/settings-form.php:153
|
70 |
msgid "Express export"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: view/settings-form.php:161
|
74 |
msgid "Summary Report By Products"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: view/settings-form.php:170
|
78 |
msgid "Export filename"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: view/settings-form.php:181
|
82 |
msgid "Format"
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: view/settings-form.php:194
|
86 |
msgid "XLS options"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: view/settings-form.php:204
|
90 |
msgid "Export as .xls (Binary File Format)"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: view/settings-form.php:206
|
94 |
msgid "Use sheet name"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: view/settings-form.php:212 view/settings-form.php:253
|
98 |
+
#: view/settings-form.php:331 view/settings-form.php:350
|
99 |
+
#: view/settings-form.php:524
|
100 |
msgid "Output column titles as first line"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: view/settings-form.php:216
|
104 |
msgid "Auto column width"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: view/settings-form.php:220
|
108 |
msgid "Right-to-Left direction"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: view/settings-form.php:224
|
112 |
msgid "Force general format for all cells"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: view/settings-form.php:227 view/settings-form.php:503
|
116 |
+
msgid "Images width"
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#: view/settings-form.php:234 view/settings-form.php:510
|
120 |
+
msgid "Images height"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#: view/settings-form.php:240
|
124 |
msgid "CSV options"
|
125 |
msgstr ""
|
126 |
|
127 |
+
#: view/settings-form.php:249 view/settings-form.php:327
|
128 |
msgid "Output UTF-8 BOM"
|
129 |
msgstr ""
|
130 |
|
131 |
+
#: view/settings-form.php:257
|
132 |
msgid "Convert line breaks to literals"
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: view/settings-form.php:261
|
136 |
+
msgid "Product rows start with a new line"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: view/settings-form.php:262
|
140 |
msgid "Enclosure"
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: view/settings-form.php:266
|
144 |
msgid "Field Delimiter"
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: view/settings-form.php:270 view/settings-form.php:332
|
148 |
msgid "Line Break"
|
149 |
msgstr ""
|
150 |
|
151 |
+
#: view/settings-form.php:275 view/settings-form.php:337
|
152 |
msgid "Character encoding"
|
153 |
msgstr ""
|
154 |
|
155 |
+
#: view/settings-form.php:281
|
156 |
msgid "XML options"
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: view/settings-form.php:284
|
160 |
msgid "Please, install/enable PHP XML Extension!"
|
161 |
msgstr ""
|
162 |
|
163 |
+
#: view/settings-form.php:287
|
164 |
msgid "Prepend XML"
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: view/settings-form.php:290
|
168 |
msgid "Root tag"
|
169 |
msgstr ""
|
170 |
|
171 |
+
#: view/settings-form.php:293
|
172 |
msgid "Order tag"
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: view/settings-form.php:296
|
176 |
msgid "Product tag"
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: view/settings-form.php:299
|
180 |
msgid "Coupon tag"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: view/settings-form.php:302
|
184 |
msgid "Append XML"
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: view/settings-form.php:305
|
188 |
msgid "Self closing tags"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: view/settings-form.php:311
|
192 |
msgid "JSON options"
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: view/settings-form.php:313
|
196 |
msgid "Start tag"
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: view/settings-form.php:316
|
200 |
msgid "End tag"
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: view/settings-form.php:320
|
204 |
msgid "TSV options"
|
205 |
msgstr ""
|
206 |
|
207 |
+
#: view/settings-form.php:344
|
208 |
msgid "PDF options"
|
209 |
msgstr ""
|
210 |
|
211 |
+
#: view/settings-form.php:357
|
212 |
msgid "repeat at each page"
|
213 |
msgstr ""
|
214 |
|
215 |
+
#: view/settings-form.php:361
|
216 |
msgid "Orientation"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: view/settings-form.php:370
|
220 |
msgid "Page size"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: view/settings-form.php:379 view/settings-form.php:534
|
224 |
msgid "Font size"
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: view/settings-form.php:385
|
228 |
msgid "Page numbers"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: view/settings-form.php:388
|
232 |
msgid "Left align"
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: view/settings-form.php:389
|
236 |
msgid "Center align"
|
237 |
msgstr ""
|
238 |
|
239 |
+
#: view/settings-form.php:390
|
240 |
msgid "Right align"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: view/settings-form.php:395
|
244 |
msgid "No page numbers"
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: view/settings-form.php:403
|
248 |
msgid "Page header text"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: view/settings-form.php:408
|
252 |
msgid "Columns width"
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: view/settings-form.php:409 view/settings-form.php:419
|
256 |
+
#: view/settings-form.php:541
|
257 |
msgid "comma separated list"
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: view/settings-form.php:413
|
261 |
msgid "Page footer text"
|
262 |
msgstr ""
|
263 |
|
264 |
+
#: view/settings-form.php:418 view/settings-form.php:540
|
265 |
msgid "Columns align"
|
266 |
msgstr ""
|
267 |
|
268 |
+
#: view/settings-form.php:424
|
269 |
msgid "Fit table to page width"
|
270 |
msgstr ""
|
271 |
|
272 |
+
#: view/settings-form.php:425
|
273 |
msgid "Yes"
|
274 |
msgstr ""
|
275 |
|
276 |
+
#: view/settings-form.php:426
|
277 |
msgid "No"
|
278 |
msgstr ""
|
279 |
|
280 |
+
#: view/settings-form.php:430 view/settings-form.php:555
|
281 |
msgid "Table header text color"
|
282 |
msgstr ""
|
283 |
|
284 |
+
#: view/settings-form.php:435 view/settings-form.php:560
|
285 |
msgid "Table header background color"
|
286 |
msgstr ""
|
287 |
|
288 |
+
#: view/settings-form.php:441 view/settings-form.php:566
|
289 |
msgid "Table row text color"
|
290 |
msgstr ""
|
291 |
|
292 |
+
#: view/settings-form.php:446 view/settings-form.php:571
|
293 |
msgid "Table row background color"
|
294 |
msgstr ""
|
295 |
|
296 |
+
#: view/settings-form.php:452
|
297 |
msgid "Page header text color"
|
298 |
msgstr ""
|
299 |
|
300 |
+
#: view/settings-form.php:457
|
301 |
msgid "Page footer text color"
|
302 |
msgstr ""
|
303 |
|
304 |
+
#: view/settings-form.php:466
|
305 |
+
msgid "Select logo"
|
306 |
+
msgstr ""
|
307 |
+
|
308 |
+
#: view/settings-form.php:478
|
309 |
+
msgid "Remove logo"
|
310 |
+
msgstr ""
|
311 |
+
|
312 |
+
#: view/settings-form.php:481
|
313 |
msgid "Logo align"
|
314 |
msgstr ""
|
315 |
|
316 |
+
#: view/settings-form.php:489
|
317 |
msgid "Logo height"
|
318 |
msgstr ""
|
319 |
|
320 |
+
#: view/settings-form.php:495
|
321 |
msgid "Logo width"
|
322 |
msgstr ""
|
323 |
|
324 |
+
#: view/settings-form.php:496
|
325 |
msgid "0 - auto scale"
|
326 |
msgstr ""
|
327 |
|
328 |
+
#: view/settings-form.php:518
|
329 |
+
msgid "Html options"
|
330 |
+
msgstr ""
|
331 |
+
|
332 |
+
#: view/settings-form.php:530
|
333 |
+
msgid "repeat header as last line"
|
334 |
+
msgstr ""
|
335 |
+
|
336 |
+
#: view/settings-form.php:545
|
337 |
+
msgid "Header text"
|
338 |
+
msgstr ""
|
339 |
+
|
340 |
+
#: view/settings-form.php:550
|
341 |
+
msgid "Footer text"
|
342 |
+
msgstr ""
|
343 |
+
|
344 |
+
#: view/settings-form.php:577
|
345 |
+
msgid "Header text color"
|
346 |
+
msgstr ""
|
347 |
+
|
348 |
+
#: view/settings-form.php:582
|
349 |
+
msgid "Footer text color"
|
350 |
+
msgstr ""
|
351 |
+
|
352 |
+
#: view/settings-form.php:591
|
353 |
+
msgid "Custom css"
|
354 |
+
msgstr ""
|
355 |
+
|
356 |
+
#: view/settings-form.php:593
|
357 |
+
msgid "This option cancels UI settings(above) and don't applied to Preview"
|
358 |
+
msgstr ""
|
359 |
+
|
360 |
+
#: view/settings-form.php:602
|
361 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1165
|
362 |
msgid "Date"
|
363 |
msgstr ""
|
364 |
|
365 |
+
#: view/settings-form.php:620 view/settings-form.php:646
|
366 |
msgid "custom"
|
367 |
msgstr ""
|
368 |
|
369 |
+
#: view/settings-form.php:629
|
370 |
msgid "Time"
|
371 |
msgstr ""
|
372 |
|
373 |
+
#: view/settings-form.php:659
|
374 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:642
|
375 |
msgid "Order ID"
|
376 |
msgstr ""
|
377 |
|
378 |
+
#: view/settings-form.php:662
|
379 |
+
msgid "Order status"
|
380 |
+
msgstr ""
|
381 |
+
|
382 |
+
#: view/settings-form.php:683
|
383 |
msgid "Descending"
|
384 |
msgstr ""
|
385 |
|
386 |
+
#: view/settings-form.php:685
|
387 |
msgid "Ascending"
|
388 |
msgstr ""
|
389 |
|
390 |
+
#: view/settings-form.php:690
|
391 |
#, php-format
|
392 |
msgid "Sort orders by %s in %s order"
|
393 |
msgstr ""
|
394 |
|
395 |
+
#: view/settings-form.php:696
|
396 |
msgid "Change order status to"
|
397 |
msgstr ""
|
398 |
|
399 |
+
#: view/settings-form.php:701
|
400 |
msgid "- don't modify -"
|
401 |
msgstr ""
|
402 |
|
403 |
+
#: view/settings-form.php:713
|
404 |
msgid "Misc settings"
|
405 |
msgstr ""
|
406 |
|
407 |
+
#: view/settings-form.php:719
|
408 |
msgid "Format numbers (use WC decimal separator)"
|
409 |
msgstr ""
|
410 |
|
411 |
+
#: view/settings-form.php:725
|
412 |
msgid "Export all order notes"
|
413 |
msgstr ""
|
414 |
|
415 |
+
#: view/settings-form.php:731
|
416 |
msgid "Export refund notes as Customer Note"
|
417 |
msgstr ""
|
418 |
|
419 |
+
#: view/settings-form.php:737
|
420 |
msgid "Strip tags from Product Description/Variation"
|
421 |
msgstr ""
|
422 |
|
423 |
+
#: view/settings-form.php:743
|
424 |
msgid "Cleanup phone (export only digits)"
|
425 |
msgstr ""
|
426 |
|
427 |
+
#: view/settings-form.php:749
|
428 |
msgid "Enable debug output"
|
429 |
msgstr ""
|
430 |
|
431 |
+
#: view/settings-form.php:755
|
432 |
msgid "Custom PHP code to modify output"
|
433 |
msgstr ""
|
434 |
|
435 |
+
#: view/settings-form.php:760
|
436 |
msgid ""
|
437 |
"Please check permissions for your role. You must have capability "
|
438 |
"“edit_themes” to use this box."
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: view/settings-form.php:765
|
442 |
+
msgid "Read how to fix it"
|
443 |
+
msgstr ""
|
444 |
+
|
445 |
+
#: view/settings-form.php:769
|
446 |
msgid "Use only unnamed functions!"
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: view/settings-form.php:781
|
450 |
msgid "Filter by order"
|
451 |
msgstr ""
|
452 |
|
453 |
+
#: view/settings-form.php:786
|
454 |
msgid "Don't export child orders"
|
455 |
msgstr ""
|
456 |
|
457 |
+
#: view/settings-form.php:790
|
458 |
msgid "Export refunds"
|
459 |
msgstr ""
|
460 |
|
461 |
+
#: view/settings-form.php:794
|
462 |
msgid "Mark exported orders"
|
463 |
msgstr ""
|
464 |
|
465 |
+
#: view/settings-form.php:798
|
466 |
msgid "Export unmarked orders only"
|
467 |
msgstr ""
|
468 |
|
469 |
+
#: view/settings-form.php:800
|
470 |
msgid "Order statuses"
|
471 |
msgstr ""
|
472 |
|
473 |
+
#: view/settings-form.php:812 view/settings-form.php:1089
|
474 |
msgid "Custom fields"
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: view/settings-form.php:855
|
478 |
msgid ""
|
479 |
"The filters won't work correctly.<br>Another plugin(or theme) has loaded "
|
480 |
"outdated Select2.js"
|
481 |
msgstr ""
|
482 |
|
483 |
+
#: view/settings-form.php:857
|
484 |
msgid "Filter by product"
|
485 |
msgstr ""
|
486 |
|
487 |
+
#: view/settings-form.php:862
|
488 |
msgid "Export all products from the order"
|
489 |
msgstr ""
|
490 |
|
491 |
+
#: view/settings-form.php:866
|
492 |
msgid "Skip fully refunded items"
|
493 |
msgstr ""
|
494 |
|
495 |
+
#: view/settings-form.php:868
|
496 |
msgid "Product categories"
|
497 |
msgstr ""
|
498 |
|
499 |
+
#: view/settings-form.php:886
|
500 |
msgid "Vendor/creator"
|
501 |
msgstr ""
|
502 |
|
503 |
+
#: view/settings-form.php:902
|
504 |
msgid "Product"
|
505 |
msgstr ""
|
506 |
|
507 |
+
#: view/settings-form.php:917
|
508 |
msgid "Product taxonomies"
|
509 |
msgstr ""
|
510 |
|
511 |
+
#: view/settings-form.php:949
|
512 |
msgid "Product custom fields"
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: view/settings-form.php:987
|
516 |
msgid "Variable product attributes"
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: view/settings-form.php:1019
|
520 |
msgid "Item meta data"
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: view/settings-form.php:1060
|
524 |
msgid "Filter by customers"
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: view/settings-form.php:1064
|
528 |
msgid "Usernames"
|
529 |
msgstr ""
|
530 |
|
531 |
+
#: view/settings-form.php:1078
|
532 |
msgid "User roles"
|
533 |
msgstr ""
|
534 |
|
535 |
+
#: view/settings-form.php:1130
|
536 |
msgid "Filter by coupons"
|
537 |
msgstr ""
|
538 |
|
539 |
+
#: view/settings-form.php:1136
|
540 |
msgid "Any coupon used"
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: view/settings-form.php:1139
|
544 |
+
#: classes/admin/class-wc-order-export-manage.php:654
|
545 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:945
|
546 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1152
|
547 |
msgid "Coupons"
|
548 |
msgstr ""
|
549 |
|
550 |
+
#: view/settings-form.php:1157
|
551 |
msgid "Filter by billing"
|
552 |
msgstr ""
|
553 |
|
554 |
+
#: view/settings-form.php:1160
|
555 |
msgid "Billing locations"
|
556 |
msgstr ""
|
557 |
|
558 |
+
#: view/settings-form.php:1188
|
559 |
msgid "Payment methods"
|
560 |
msgstr ""
|
561 |
|
562 |
+
#: view/settings-form.php:1204
|
563 |
msgid "Filter by shipping"
|
564 |
msgstr ""
|
565 |
|
566 |
+
#: view/settings-form.php:1207
|
567 |
msgid "Shipping locations"
|
568 |
msgstr ""
|
569 |
|
570 |
+
#: view/settings-form.php:1235
|
571 |
msgid "Shipping methods"
|
572 |
msgstr ""
|
573 |
|
574 |
+
#: view/settings-form.php:1251
|
575 |
msgid "Filter by item and metadata"
|
576 |
msgstr ""
|
577 |
|
578 |
+
#: view/settings-form.php:1254
|
579 |
msgid "Item names"
|
580 |
msgstr ""
|
581 |
|
582 |
+
#: view/settings-form.php:1284
|
583 |
msgid "Item metadata"
|
584 |
msgstr ""
|
585 |
|
586 |
+
#: view/settings-form.php:1324
|
587 |
msgid "Set up fields to export"
|
588 |
msgstr ""
|
589 |
|
590 |
+
#: view/settings-form.php:1337
|
591 |
+
msgid "Turn off mode Summary report to export order fields"
|
592 |
+
msgstr ""
|
593 |
+
|
594 |
+
#: view/settings-form.php:1344
|
595 |
msgid "Drag rows to reorder exported fields"
|
596 |
msgstr ""
|
597 |
|
598 |
+
#: view/settings-form.php:1350
|
599 |
msgid "Remove all fields"
|
600 |
msgstr ""
|
601 |
|
602 |
+
#: view/settings-form.php:1377
|
603 |
msgid "Actions"
|
604 |
msgstr ""
|
605 |
|
606 |
+
#: view/settings-form.php:1380
|
607 |
msgid "Add field"
|
608 |
msgstr ""
|
609 |
|
610 |
+
#: view/settings-form.php:1383
|
611 |
msgid "Add static field"
|
612 |
msgstr ""
|
613 |
|
614 |
+
#: view/settings-form.php:1388 view/settings-form.php:1482
|
615 |
+
msgid ""
|
616 |
+
"The plugin fetches meta keys from the existing orders. So you should create "
|
617 |
+
"fake order if you've added new field just now."
|
618 |
+
msgstr ""
|
619 |
+
|
620 |
+
#: view/settings-form.php:1390 view/settings-form.php:1447
|
621 |
+
#: view/settings-form.php:1548
|
622 |
msgid "Meta key"
|
623 |
msgstr ""
|
624 |
|
625 |
+
#: view/settings-form.php:1401 view/settings-form.php:1458
|
626 |
+
#: view/settings-form.php:1492 view/settings-form.php:1557
|
627 |
msgid "or type meta key here"
|
628 |
msgstr ""
|
629 |
|
630 |
+
#: view/settings-form.php:1406 view/settings-form.php:1463
|
631 |
+
#: view/settings-form.php:1497 view/settings-form.php:1551
|
632 |
msgid "Hide unused fields"
|
633 |
msgstr ""
|
634 |
|
635 |
+
#: view/settings-form.php:1410 view/settings-form.php:1426
|
636 |
+
#: view/settings-form.php:1467 view/settings-form.php:1513
|
637 |
+
#: view/settings-form.php:1527 view/settings-form.php:1560
|
638 |
+
#: view/settings-form.php:1575
|
639 |
msgid "Column name"
|
640 |
msgstr ""
|
641 |
|
642 |
+
#: view/settings-form.php:1418 view/settings-form.php:1439
|
643 |
+
#: view/settings-form.php:1475 view/settings-form.php:1519
|
644 |
+
#: view/settings-form.php:1541 view/settings-form.php:1567
|
645 |
+
#: view/settings-form.php:1589
|
646 |
msgid "Confirm"
|
647 |
msgstr ""
|
648 |
|
649 |
+
#: view/settings-form.php:1420 view/settings-form.php:1441
|
650 |
+
#: view/settings-form.php:1477 view/settings-form.php:1521
|
651 |
+
#: view/settings-form.php:1543 view/settings-form.php:1569
|
652 |
+
#: view/settings-form.php:1592
|
653 |
msgid "Cancel"
|
654 |
msgstr ""
|
655 |
|
656 |
+
#: view/settings-form.php:1431 view/settings-form.php:1532
|
657 |
+
#: view/settings-form.php:1580
|
658 |
msgid "Value"
|
659 |
msgstr ""
|
660 |
|
661 |
+
#: view/settings-form.php:1483
|
662 |
msgid "Product fields"
|
663 |
msgstr ""
|
664 |
|
665 |
+
#: view/settings-form.php:1487
|
666 |
msgid "Order item fields"
|
667 |
msgstr ""
|
668 |
|
669 |
+
#: view/settings-form.php:1500
|
670 |
msgid "OR"
|
671 |
msgstr ""
|
672 |
|
673 |
+
#: view/settings-form.php:1502
|
674 |
msgid "Taxonomy"
|
675 |
msgstr ""
|
676 |
|
677 |
+
#: view/settings-form.php:1620
|
678 |
#, php-format
|
679 |
msgid ""
|
680 |
"If you see this message after page load, user interface won't work correctly!"
|
682 |
"it). Probably, it's a conflict with another plugin or active theme."
|
683 |
msgstr ""
|
684 |
|
685 |
+
#: view/settings-form.php:1626
|
686 |
msgid "Preview"
|
687 |
msgstr ""
|
688 |
|
689 |
+
#: view/settings-form.php:1627
|
690 |
msgid "Might be different from actual export!"
|
691 |
msgstr ""
|
692 |
|
693 |
+
#: view/settings-form.php:1630 view/settings-form.php:1635
|
694 |
msgid "Save settings"
|
695 |
msgstr ""
|
696 |
|
697 |
+
#: view/settings-form.php:1633
|
698 |
msgid "Save & Exit"
|
699 |
msgstr ""
|
700 |
|
701 |
+
#: view/settings-form.php:1640
|
702 |
msgid "Export"
|
703 |
msgstr ""
|
704 |
|
705 |
+
#: view/settings-form.php:1644
|
706 |
msgid "Export [w/o progressbar]"
|
707 |
msgstr ""
|
708 |
|
709 |
+
#: view/settings-form.php:1645
|
710 |
msgid "It might not work for huge datasets!"
|
711 |
msgstr ""
|
712 |
|
713 |
+
#: view/settings-form.php:1652
|
|
|
|
|
|
|
|
|
714 |
msgid "Reset settings"
|
715 |
msgstr ""
|
716 |
|
717 |
+
#: view/settings-form.php:1656
|
718 |
#, php-format
|
719 |
msgid "Export total: %s orders"
|
720 |
msgstr ""
|
721 |
|
722 |
+
#: view/settings-form.php:1658
|
723 |
msgid "Preview size"
|
724 |
msgstr ""
|
725 |
|
726 |
+
#: view/settings-form.php:1665 view/tab/tools.php:86
|
727 |
msgid "Settings were successfully updated!"
|
728 |
msgstr ""
|
729 |
|
730 |
+
#: view/settings-form.php:1670
|
731 |
msgid "Press 'Esc' to cancel the export"
|
732 |
msgstr ""
|
733 |
|
734 |
+
#: view/settings-form.php:1671
|
735 |
msgid "Click here to download"
|
736 |
msgstr ""
|
737 |
|
739 |
msgid "Settings saved"
|
740 |
msgstr ""
|
741 |
|
742 |
+
#: classes/class-wc-order-export-admin.php:93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
743 |
msgid "Export Status"
|
744 |
msgstr ""
|
745 |
|
746 |
+
#: classes/class-wc-order-export-admin.php:128
|
747 |
msgid ""
|
748 |
"Advanced Order Export For WooCommerce is available <a href=\"admin.php?"
|
749 |
"page=wc-order-export\">on this page</a>."
|
750 |
msgstr ""
|
751 |
|
752 |
+
#: classes/class-wc-order-export-admin.php:137
|
753 |
msgid "Settings"
|
754 |
msgstr ""
|
755 |
|
756 |
+
#: classes/class-wc-order-export-admin.php:138
|
757 |
msgid "Docs"
|
758 |
msgstr ""
|
759 |
|
760 |
+
#: classes/class-wc-order-export-admin.php:140
|
761 |
msgid "Support"
|
762 |
msgstr ""
|
763 |
|
764 |
+
#: classes/class-wc-order-export-admin.php:155
|
765 |
+
#: classes/class-wc-order-export-admin.php:156
|
766 |
+
#: classes/class-wc-order-export-admin.php:160
|
767 |
+
#: classes/class-wc-order-export-admin.php:161
|
768 |
msgid "Export Orders"
|
769 |
msgstr ""
|
770 |
|
771 |
+
#: classes/class-wc-order-export-admin.php:211
|
|
|
|
|
|
|
|
|
772 |
#, php-format
|
773 |
msgid "Add %s fields"
|
774 |
msgstr ""
|
775 |
|
776 |
+
#: classes/class-wc-order-export-admin.php:213
|
777 |
msgid "rows"
|
778 |
msgstr ""
|
779 |
|
780 |
+
#: classes/class-wc-order-export-admin.php:214
|
781 |
msgid "columns"
|
782 |
msgstr ""
|
783 |
|
784 |
+
#: classes/class-wc-order-export-admin.php:215
|
785 |
msgid "one row"
|
786 |
msgstr ""
|
787 |
|
788 |
+
#: classes/class-wc-order-export-admin.php:218
|
789 |
msgid "Add"
|
790 |
msgstr ""
|
791 |
|
792 |
+
#: classes/class-wc-order-export-admin.php:219
|
793 |
msgid "as"
|
794 |
msgstr ""
|
795 |
|
796 |
+
#: classes/class-wc-order-export-admin.php:220
|
797 |
msgid "Split values by"
|
798 |
msgstr ""
|
799 |
|
800 |
+
#: classes/class-wc-order-export-admin.php:221
|
801 |
msgid "Fill order columns for"
|
802 |
msgstr ""
|
803 |
|
804 |
+
#: classes/class-wc-order-export-admin.php:222
|
805 |
msgid "all rows"
|
806 |
msgstr ""
|
807 |
|
808 |
+
#: classes/class-wc-order-export-admin.php:223
|
809 |
msgid "1st row only"
|
810 |
msgstr ""
|
811 |
|
812 |
+
#: classes/class-wc-order-export-admin.php:225
|
813 |
msgid "Grouping by product"
|
814 |
msgstr ""
|
815 |
|
816 |
+
#: classes/class-wc-order-export-admin.php:226
|
817 |
msgid "Grouping by coupon"
|
818 |
msgstr ""
|
819 |
|
820 |
+
#: classes/class-wc-order-export-admin.php:230
|
821 |
msgid "Set up product fields"
|
822 |
msgstr ""
|
823 |
|
824 |
+
#: classes/class-wc-order-export-admin.php:231
|
825 |
msgid "Set up coupon fields"
|
826 |
msgstr ""
|
827 |
|
828 |
+
#: classes/class-wc-order-export-admin.php:232
|
829 |
msgid "products"
|
830 |
msgstr ""
|
831 |
|
832 |
+
#: classes/class-wc-order-export-admin.php:233
|
833 |
msgid "coupons"
|
834 |
msgstr ""
|
835 |
|
836 |
+
#: classes/class-wc-order-export-admin.php:235
|
837 |
msgid "Remove all fields?"
|
838 |
msgstr ""
|
839 |
|
840 |
+
#: classes/class-wc-order-export-admin.php:236
|
841 |
msgid ""
|
842 |
"This action will reset filters, settings and fields to default state. Are "
|
843 |
"you sure?"
|
844 |
msgstr ""
|
845 |
|
846 |
+
#: classes/class-wc-order-export-admin.php:284
|
847 |
msgid "empty column name"
|
848 |
msgstr ""
|
849 |
|
850 |
+
#: classes/class-wc-order-export-admin.php:285
|
851 |
msgid "empty meta key"
|
852 |
msgstr ""
|
853 |
|
854 |
+
#: classes/class-wc-order-export-admin.php:286
|
855 |
msgid "select product field or item field or taxonomy"
|
856 |
msgstr ""
|
857 |
|
858 |
+
#: classes/class-wc-order-export-admin.php:288
|
859 |
msgid "empty value"
|
860 |
msgstr ""
|
861 |
|
862 |
+
#: classes/class-wc-order-export-admin.php:289
|
863 |
msgid "title is empty"
|
864 |
msgstr ""
|
865 |
|
866 |
+
#: classes/class-wc-order-export-admin.php:290
|
867 |
msgid "Date From is greater than Date To"
|
868 |
msgstr ""
|
869 |
|
870 |
+
#: classes/class-wc-order-export-admin.php:291
|
871 |
msgid "Please, set up fields to export"
|
872 |
msgstr ""
|
873 |
|
874 |
+
#: classes/class-wc-order-export-admin.php:292
|
875 |
+
#: classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php:98
|
|
|
|
|
876 |
msgid "Nothing to export. Please, adjust your filters"
|
877 |
msgstr ""
|
878 |
|
879 |
+
#: classes/class-wc-order-export-admin.php:294
|
880 |
+
#: classes/core/class-wc-order-export-data-extractor.php:235
|
881 |
msgid "empty"
|
882 |
msgstr ""
|
883 |
|
884 |
+
#: classes/class-wc-order-export-admin.php:390
|
885 |
+
msgid "You can not do it"
|
886 |
+
msgstr ""
|
887 |
+
|
888 |
+
#: classes/class-wc-order-export-admin.php:394
|
889 |
+
msgid "Empty method"
|
890 |
+
msgstr ""
|
891 |
+
|
892 |
+
#: classes/class-wc-order-export-admin.php:403
|
893 |
#, php-format
|
894 |
+
msgid "Unknown AJAX method %s"
|
895 |
msgstr ""
|
896 |
|
897 |
+
#: classes/class-wc-order-export-admin.php:411
|
898 |
+
#, php-format
|
899 |
+
msgid "Unknown tab method %s"
|
900 |
+
msgstr ""
|
901 |
+
|
902 |
+
#: classes/class-wc-order-export-admin.php:415
|
903 |
+
msgid "Wrong nonce"
|
904 |
+
msgstr ""
|
905 |
+
|
906 |
+
#: classes/class-wc-order-export-admin.php:442
|
907 |
#, php-format
|
908 |
msgid "Export as %s"
|
909 |
msgstr ""
|
910 |
|
911 |
+
#: classes/class-wc-order-export-admin.php:448
|
912 |
msgid "Mark exported"
|
913 |
msgstr ""
|
914 |
|
915 |
+
#: classes/class-wc-order-export-admin.php:449
|
916 |
msgid "Unmark exported"
|
917 |
msgstr ""
|
918 |
|
919 |
+
#: classes/class-wc-order-export-admin.php:497
|
|
|
|
|
|
|
|
|
|
|
920 |
#, php-format
|
921 |
msgid "%s order marked."
|
922 |
msgid_plural "%s orders marked."
|
923 |
msgstr[0] ""
|
924 |
msgstr[1] ""
|
925 |
|
926 |
+
#: classes/class-wc-order-export-admin.php:506
|
927 |
#, php-format
|
928 |
msgid "%s order unmarked."
|
929 |
msgid_plural "%s orders unmarked."
|
930 |
msgstr[0] ""
|
931 |
msgstr[1] ""
|
932 |
|
933 |
+
#: view/tab/tools.php:29
|
934 |
msgid "Export settings"
|
935 |
msgstr ""
|
936 |
|
937 |
+
#: view/tab/tools.php:32
|
938 |
msgid ""
|
939 |
"Copy these settings and use it to migrate plugin to another WordPress "
|
940 |
"install."
|
941 |
msgstr ""
|
942 |
|
943 |
+
#: view/tab/tools.php:38
|
944 |
msgid "All"
|
945 |
msgstr ""
|
946 |
|
947 |
+
#: view/tab/tools.php:42
|
948 |
+
#: classes/admin/tabs/class-wc-order-export-admin-tab-export-now.php:10
|
949 |
+
msgid "Export now"
|
950 |
+
msgstr ""
|
951 |
+
|
952 |
+
#: view/tab/tools.php:54
|
953 |
msgid "Just click inside the textarea and copy (Ctrl+C)"
|
954 |
msgstr ""
|
955 |
|
956 |
+
#: view/tab/tools.php:63
|
957 |
msgid "Import settings"
|
958 |
msgstr ""
|
959 |
|
960 |
+
#: view/tab/tools.php:66
|
961 |
msgid ""
|
962 |
"Paste text into this field to import settings into the current WordPress "
|
963 |
"install."
|
964 |
msgstr ""
|
965 |
|
966 |
+
#: view/tab/tools.php:72
|
967 |
msgid ""
|
968 |
"This process will overwrite your settings for \"Advanced Order Export For "
|
969 |
"WooCommerce\" !"
|
973 |
msgid "Import"
|
974 |
msgstr ""
|
975 |
|
976 |
+
#: view/tab/tools.php:132
|
977 |
msgid "Are you sure to continue?"
|
978 |
msgstr ""
|
979 |
|
1030 |
msgid "Buy %s to get access to Scheduled jobs"
|
1031 |
msgstr ""
|
1032 |
|
1033 |
+
#: classes/formats/abstract-class-woe-formatter-sv.php:102
|
1034 |
+
#: classes/formats/class-woe-formatter-html.php:120
|
1035 |
+
#: classes/formats/class-woe-formatter-xls.php:238
|
1036 |
+
msgid "No results"
|
1037 |
msgstr ""
|
1038 |
|
1039 |
#: classes/formats/abstract-class-woe-formatter.php:49
|
1040 |
msgid "can not open for output"
|
1041 |
msgstr ""
|
1042 |
|
1043 |
+
#: classes/formats/class-woe-formatter-xls.php:132
|
1044 |
+
#: classes/admin/class-wc-order-export-manage.php:205
|
1045 |
msgid "Orders"
|
1046 |
msgstr ""
|
1047 |
|
1073 |
msgid "Sat"
|
1074 |
msgstr ""
|
1075 |
|
1076 |
+
#: classes/admin/class-wc-order-export-manage.php:611
|
1077 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:933
|
1078 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1151
|
1079 |
msgid "Products"
|
1080 |
msgstr ""
|
1081 |
|
1082 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:330
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1083 |
msgid "Item ID"
|
1084 |
msgstr ""
|
1085 |
|
1086 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:335
|
1087 |
msgid "Item #"
|
1088 |
msgstr ""
|
1089 |
|
1090 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:340
|
1091 |
msgid "SKU"
|
1092 |
msgstr ""
|
1093 |
|
1094 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:345
|
1095 |
msgid "Item Name"
|
1096 |
msgstr ""
|
1097 |
|
1098 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:350
|
1099 |
msgid "Product Id"
|
1100 |
msgstr ""
|
1101 |
|
1102 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:355
|
1103 |
msgid "Product Name"
|
1104 |
msgstr ""
|
1105 |
|
1106 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:360
|
1107 |
msgid "Variation Id"
|
1108 |
msgstr ""
|
1109 |
|
1110 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:365
|
1111 |
msgid "Product Variation"
|
1112 |
msgstr ""
|
1113 |
|
1114 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:370
|
1115 |
msgid "Item Seller"
|
1116 |
msgstr ""
|
1117 |
|
1118 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:375
|
1119 |
msgid "Quantity"
|
1120 |
msgstr ""
|
1121 |
|
1122 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:380
|
1123 |
msgid "Quantity (- Refund)"
|
1124 |
msgstr ""
|
1125 |
|
1126 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:385
|
1127 |
msgid "Item Cost"
|
1128 |
msgstr ""
|
1129 |
|
1130 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:390
|
1131 |
msgid "Product Current Price"
|
1132 |
msgstr ""
|
1133 |
|
1134 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:395
|
1135 |
msgid "Order Line (w/o tax)"
|
1136 |
msgstr ""
|
1137 |
|
1138 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:400
|
1139 |
msgid "Order Line Tax"
|
1140 |
msgstr ""
|
1141 |
|
1142 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:405
|
1143 |
msgid "Order Line Tax Refunded"
|
1144 |
msgstr ""
|
1145 |
|
1146 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:410
|
1147 |
msgid "Order Line Tax (- Refund)"
|
1148 |
msgstr ""
|
1149 |
|
1150 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:415
|
1151 |
msgid "Order Line Subtotal"
|
1152 |
msgstr ""
|
1153 |
|
1154 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:420
|
1155 |
msgid "Order Line Subtotal Tax"
|
1156 |
msgstr ""
|
1157 |
|
1158 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:425
|
1159 |
msgid "Order Line Total"
|
1160 |
msgstr ""
|
1161 |
|
1162 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:430
|
1163 |
msgid "Order Line Total (include tax)"
|
1164 |
msgstr ""
|
1165 |
|
1166 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:435
|
1167 |
msgid "Order Line Total Refunded"
|
1168 |
msgstr ""
|
1169 |
|
1170 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:440
|
1171 |
msgid "Order Line Total (- Refund)"
|
1172 |
msgstr ""
|
1173 |
|
1174 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:445
|
1175 |
msgid "Item Discount Amount"
|
1176 |
msgstr ""
|
1177 |
|
1178 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:450
|
1179 |
msgid "Item Tax Rate"
|
1180 |
msgstr ""
|
1181 |
|
1182 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:455
|
1183 |
msgid "Type"
|
1184 |
msgstr ""
|
1185 |
|
1186 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:460
|
1187 |
msgid "Category"
|
1188 |
msgstr ""
|
1189 |
|
1190 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:465
|
1191 |
msgid "Tags"
|
1192 |
msgstr ""
|
1193 |
|
1194 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:470
|
1195 |
msgid "Width"
|
1196 |
msgstr ""
|
1197 |
|
1198 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:475
|
1199 |
msgid "Length"
|
1200 |
msgstr ""
|
1201 |
|
1202 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:480
|
1203 |
msgid "Height"
|
1204 |
msgstr ""
|
1205 |
|
1206 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:485
|
1207 |
msgid "Weight"
|
1208 |
msgstr ""
|
1209 |
|
1210 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:490
|
1211 |
msgid "Product URL"
|
1212 |
msgstr ""
|
1213 |
|
1214 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:495
|
1215 |
msgid "Download URL"
|
1216 |
msgstr ""
|
1217 |
|
1218 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:500
|
1219 |
+
msgid "Item download URL"
|
1220 |
+
msgstr ""
|
1221 |
+
|
1222 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:505
|
1223 |
msgid "Image URL"
|
1224 |
msgstr ""
|
1225 |
|
1226 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:510
|
1227 |
msgid "Product Shipping Class"
|
1228 |
msgstr ""
|
1229 |
|
1230 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:515
|
1231 |
msgid "Description"
|
1232 |
msgstr ""
|
1233 |
|
1234 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:520
|
1235 |
msgid "Short Description"
|
1236 |
msgstr ""
|
1237 |
|
1238 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:525
|
1239 |
msgid "Full names for categories"
|
1240 |
msgstr ""
|
1241 |
|
1242 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:530
|
1243 |
msgid "Summary Report Total Quantity"
|
1244 |
msgstr ""
|
1245 |
|
1246 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:535
|
1247 |
msgid "Summary Report Total Amount"
|
1248 |
msgstr ""
|
1249 |
|
1250 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:540
|
1251 |
+
msgid "Embedded Product Image"
|
1252 |
+
msgstr ""
|
1253 |
+
|
1254 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:557
|
1255 |
msgid "Coupon Code"
|
1256 |
msgstr ""
|
1257 |
|
1258 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:562
|
1259 |
msgid "Discount Amount"
|
1260 |
msgstr ""
|
1261 |
|
1262 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:567
|
1263 |
msgid "Discount Amount Tax"
|
1264 |
msgstr ""
|
1265 |
|
1266 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:572
|
1267 |
msgid "Discount Amount + Tax"
|
1268 |
msgstr ""
|
1269 |
|
1270 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:577
|
1271 |
msgid "Coupon Description"
|
1272 |
msgstr ""
|
1273 |
|
1274 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:581
|
1275 |
msgid "Coupon Type"
|
1276 |
msgstr ""
|
1277 |
|
1278 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:586
|
1279 |
msgid "Coupon Amount"
|
1280 |
msgstr ""
|
1281 |
|
1282 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:637
|
1283 |
msgid "Line number"
|
1284 |
msgstr ""
|
1285 |
|
1286 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:647
|
1287 |
msgid "Order Number"
|
1288 |
msgstr ""
|
1289 |
|
1290 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:652
|
1291 |
msgid "Order Status"
|
1292 |
msgstr ""
|
1293 |
|
1294 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:667
|
1295 |
msgid "Transaction ID"
|
1296 |
msgstr ""
|
1297 |
|
1298 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:672
|
1299 |
msgid "Currency"
|
1300 |
msgstr ""
|
1301 |
|
1302 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:687
|
1303 |
msgid "Date of first refund"
|
1304 |
msgstr ""
|
1305 |
|
1306 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:692
|
1307 |
msgid "Customer Note"
|
1308 |
msgstr ""
|
1309 |
|
1310 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:697
|
1311 |
msgid "Order Notes"
|
1312 |
msgstr ""
|
1313 |
|
1314 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:702
|
1315 |
+
msgid "Link to edit order"
|
1316 |
+
msgstr ""
|
1317 |
+
|
1318 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:712
|
1319 |
msgid "Customer IP address"
|
1320 |
msgstr ""
|
1321 |
|
1322 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:717
|
1323 |
msgid "Customer User ID"
|
1324 |
msgstr ""
|
1325 |
|
1326 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:722
|
1327 |
msgid "Customer Username"
|
1328 |
msgstr ""
|
1329 |
|
1330 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:727
|
1331 |
msgid "User Website"
|
1332 |
msgstr ""
|
1333 |
|
1334 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:732
|
1335 |
msgid "Customer User Email"
|
1336 |
msgstr ""
|
1337 |
|
1338 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:737
|
1339 |
msgid "Customer Role"
|
1340 |
msgstr ""
|
1341 |
|
1342 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:742
|
1343 |
msgid "Customer Total Orders"
|
1344 |
msgstr ""
|
1345 |
|
1346 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:747
|
1347 |
+
msgid "Customer first order date"
|
1348 |
+
msgstr ""
|
1349 |
+
|
1350 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:752
|
1351 |
+
msgid "Customer last order date"
|
1352 |
+
msgstr ""
|
1353 |
+
|
1354 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:762
|
1355 |
msgid "First Name (Billing)"
|
1356 |
msgstr ""
|
1357 |
|
1358 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:767
|
1359 |
msgid "Last Name (Billing)"
|
1360 |
msgstr ""
|
1361 |
|
1362 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:772
|
1363 |
msgid "Full Name (Billing)"
|
1364 |
msgstr ""
|
1365 |
|
1366 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:777
|
1367 |
msgid "Company (Billing)"
|
1368 |
msgstr ""
|
1369 |
|
1370 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:782
|
1371 |
msgid "Address 1&2 (Billing)"
|
1372 |
msgstr ""
|
1373 |
|
1374 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:787
|
1375 |
msgid "Address 1 (Billing)"
|
1376 |
msgstr ""
|
1377 |
|
1378 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:792
|
1379 |
msgid "Address 2 (Billing)"
|
1380 |
msgstr ""
|
1381 |
|
1382 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:797
|
1383 |
msgid "City (Billing)"
|
1384 |
msgstr ""
|
1385 |
|
1386 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:802
|
1387 |
msgid "State Code (Billing)"
|
1388 |
msgstr ""
|
1389 |
|
1390 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:807
|
1391 |
msgid "City, State, Zip (Billing)"
|
1392 |
msgstr ""
|
1393 |
|
1394 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:812
|
1395 |
msgid "City, State Zip (Billing)"
|
1396 |
msgstr ""
|
1397 |
|
1398 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:817
|
1399 |
msgid "State Name (Billing)"
|
1400 |
msgstr ""
|
1401 |
|
1402 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:822
|
1403 |
msgid "Postcode (Billing)"
|
1404 |
msgstr ""
|
1405 |
|
1406 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:827
|
1407 |
msgid "Country Code (Billing)"
|
1408 |
msgstr ""
|
1409 |
|
1410 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:832
|
1411 |
msgid "Country Name (Billing)"
|
1412 |
msgstr ""
|
1413 |
|
1414 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:837
|
1415 |
msgid "Email (Billing)"
|
1416 |
msgstr ""
|
1417 |
|
1418 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:842
|
1419 |
msgid "Phone (Billing)"
|
1420 |
msgstr ""
|
1421 |
|
1422 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:852
|
1423 |
msgid "First Name (Shipping)"
|
1424 |
msgstr ""
|
1425 |
|
1426 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:857
|
1427 |
msgid "Last Name (Shipping)"
|
1428 |
msgstr ""
|
1429 |
|
1430 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:862
|
1431 |
msgid "Full Name (Shipping)"
|
1432 |
msgstr ""
|
1433 |
|
1434 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:867
|
1435 |
msgid "Company (Shipping)"
|
1436 |
msgstr ""
|
1437 |
|
1438 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:872
|
1439 |
msgid "Address 1&2 (Shipping)"
|
1440 |
msgstr ""
|
1441 |
|
1442 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:877
|
1443 |
msgid "Address 1 (Shipping)"
|
1444 |
msgstr ""
|
1445 |
|
1446 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:882
|
1447 |
msgid "Address 2 (Shipping)"
|
1448 |
msgstr ""
|
1449 |
|
1450 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:887
|
1451 |
msgid "City (Shipping)"
|
1452 |
msgstr ""
|
1453 |
|
1454 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:892
|
1455 |
msgid "State Code (Shipping)"
|
1456 |
msgstr ""
|
1457 |
|
1458 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:897
|
1459 |
msgid "City, State, Zip (Shipping)"
|
1460 |
msgstr ""
|
1461 |
|
1462 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:902
|
1463 |
msgid "City, State Zip (Shipping)"
|
1464 |
msgstr ""
|
1465 |
|
1466 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:907
|
1467 |
msgid "State Name (Shipping)"
|
1468 |
msgstr ""
|
1469 |
|
1470 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:912
|
1471 |
msgid "Postcode (Shipping)"
|
1472 |
msgstr ""
|
1473 |
|
1474 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:917
|
1475 |
msgid "Country Code (Shipping)"
|
1476 |
msgstr ""
|
1477 |
|
1478 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:922
|
1479 |
msgid "Country Name (Shipping)"
|
1480 |
msgstr ""
|
1481 |
|
1482 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:956
|
1483 |
msgid "Shipping Method Title"
|
1484 |
msgstr ""
|
1485 |
|
1486 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:961
|
1487 |
msgid "Shipping Method"
|
1488 |
msgstr ""
|
1489 |
|
1490 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:966
|
1491 |
+
msgid "Shipping Method (no id)"
|
1492 |
+
msgstr ""
|
1493 |
+
|
1494 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:971
|
1495 |
msgid "Payment Method Title"
|
1496 |
msgstr ""
|
1497 |
|
1498 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:976
|
1499 |
msgid "Payment Method"
|
1500 |
msgstr ""
|
1501 |
|
1502 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:981
|
1503 |
msgid "Coupons Used"
|
1504 |
msgstr ""
|
1505 |
|
1506 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:986
|
1507 |
msgid "Cart Discount Amount"
|
1508 |
msgstr ""
|
1509 |
|
1510 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:991
|
1511 |
msgid "Cart Discount Amount Tax"
|
1512 |
msgstr ""
|
1513 |
|
1514 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:996
|
1515 |
msgid "Order Subtotal Amount"
|
1516 |
msgstr ""
|
1517 |
|
1518 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1001
|
1519 |
msgid "Order Subtotal - Cart Discount"
|
1520 |
msgstr ""
|
1521 |
|
1522 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1006
|
1523 |
msgid "Order Subtotal Amount Refunded"
|
1524 |
msgstr ""
|
1525 |
|
1526 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1011
|
1527 |
msgid "Order Subtotal Amount (- Refund)"
|
1528 |
msgstr ""
|
1529 |
|
1530 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1016
|
1531 |
msgid "Order Tax Amount"
|
1532 |
msgstr ""
|
1533 |
|
1534 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1026
|
1535 |
msgid "Order Shipping Amount"
|
1536 |
msgstr ""
|
1537 |
|
1538 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1031
|
1539 |
msgid "Order Shipping + Tax Amount"
|
1540 |
msgstr ""
|
1541 |
|
1542 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1036
|
1543 |
msgid "Order Shipping Amount Refunded"
|
1544 |
msgstr ""
|
1545 |
|
1546 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1041
|
1547 |
msgid "Order Shipping Amount (- Refund)"
|
1548 |
msgstr ""
|
1549 |
|
1550 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1046
|
1551 |
msgid "Order Shipping Tax Amount"
|
1552 |
msgstr ""
|
1553 |
|
1554 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1051
|
1555 |
msgid "Order Shipping Tax Refunded"
|
1556 |
msgstr ""
|
1557 |
|
1558 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1056
|
1559 |
msgid "Order Shipping Tax Amount (- Refund)"
|
1560 |
msgstr ""
|
1561 |
|
1562 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1066
|
1563 |
msgid "Order Total Fee"
|
1564 |
msgstr ""
|
1565 |
|
1566 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1071
|
1567 |
msgid "Order Refund Amount"
|
1568 |
msgstr ""
|
1569 |
|
1570 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1076
|
1571 |
msgid "Order Total Amount (- Refund)"
|
1572 |
msgstr ""
|
1573 |
|
1574 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1081
|
1575 |
msgid "Order Total Amount"
|
1576 |
msgstr ""
|
1577 |
|
1578 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1086
|
1579 |
msgid "Order Total Amount without Tax"
|
1580 |
msgstr ""
|
1581 |
|
1582 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1091
|
1583 |
msgid "Order Total Tax Amount"
|
1584 |
msgstr ""
|
1585 |
|
1586 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1096
|
1587 |
msgid "Order Total Tax Amount Refunded"
|
1588 |
msgstr ""
|
1589 |
|
1590 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1101
|
1591 |
msgid "Order Total Tax Amount (- Refund)"
|
1592 |
msgstr ""
|
1593 |
|
1594 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1111
|
1595 |
msgid "Total weight"
|
1596 |
msgstr ""
|
1597 |
|
1598 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1116
|
1599 |
msgid "Total items"
|
1600 |
msgstr ""
|
1601 |
|
1602 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1121
|
1603 |
msgid "Exported items"
|
1604 |
msgstr ""
|
1605 |
|
1606 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1126
|
1607 |
msgid "Total products"
|
1608 |
msgstr ""
|
1609 |
|
1610 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1147
|
1611 |
msgid "Common"
|
1612 |
msgstr ""
|
1613 |
|
1614 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1148
|
1615 |
msgid "User"
|
1616 |
msgstr ""
|
1617 |
|
1618 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1149
|
1619 |
msgid "Billing Address"
|
1620 |
msgstr ""
|
1621 |
|
1622 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1150
|
1623 |
msgid "Shipping Address"
|
1624 |
msgstr ""
|
1625 |
|
1626 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1153
|
1627 |
msgid "Cart"
|
1628 |
msgstr ""
|
1629 |
|
1630 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1154
|
1631 |
msgid "Shipping"
|
1632 |
msgstr ""
|
1633 |
|
1634 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1155
|
1635 |
msgid "Totals"
|
1636 |
msgstr ""
|
1637 |
|
1638 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1156
|
1639 |
msgid "Others"
|
1640 |
msgstr ""
|
1641 |
|
1642 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1162
|
1643 |
msgid "String"
|
1644 |
msgstr ""
|
1645 |
|
1646 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1163
|
1647 |
msgid "Money"
|
1648 |
msgstr ""
|
1649 |
|
1650 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1164
|
1651 |
msgid "Number"
|
1652 |
msgstr ""
|
1653 |
|
1654 |
+
#: classes/core/class-wc-order-export-data-extractor-ui.php:1166
|
1655 |
+
msgid "Image"
|
|
|
|
|
|
|
|
|
|
|
1656 |
msgstr ""
|
1657 |
|
1658 |
+
#: classes/core/class-wc-order-export-data-extractor.php:1957
|
1659 |
+
msgid "Edit order"
|
1660 |
msgstr ""
|
1661 |
|
1662 |
+
#: classes/core/class-wc-order-export-data-extractor.php:2139
|
1663 |
+
msgid "[Rest of the World]"
|
1664 |
msgstr ""
|
1665 |
|
1666 |
+
#: classes/core/class-wc-order-export-engine.php:340
|
1667 |
msgid "Don't Panic"
|
1668 |
msgstr ""
|
1669 |
|
1670 |
+
#: classes/core/class-wc-order-export-engine.php:341
|
1671 |
#, php-format
|
1672 |
msgid "The code you are trying to save produced a fatal error on line %d:"
|
1673 |
msgstr ""
|
1674 |
|
1675 |
+
#: classes/core/class-wc-order-export-engine.php:469
|
1676 |
msgid "Main SQL queries are listed below"
|
1677 |
msgstr ""
|
1678 |
|
1679 |
+
#: classes/admin/tabs/class-wc-order-export-admin-tab-help.php:10
|
1680 |
+
msgid "Help"
|
1681 |
+
msgstr ""
|
1682 |
+
|
1683 |
+
#: classes/admin/tabs/class-wc-order-export-admin-tab-status-change-jobs.php:10
|
1684 |
+
msgid "Status change jobs"
|
1685 |
+
msgstr ""
|
1686 |
+
|
1687 |
+
#: classes/admin/tabs/class-wc-order-export-admin-tab-schedule-jobs.php:10
|
1688 |
+
msgid "Scheduled jobs"
|
1689 |
+
msgstr ""
|
1690 |
+
|
1691 |
+
#: classes/admin/tabs/class-wc-order-export-admin-tab-profiles.php:10
|
1692 |
+
msgid "Profiles"
|
1693 |
+
msgstr ""
|
1694 |
+
|
1695 |
+
#: classes/admin/tabs/class-wc-order-export-admin-tab-tools.php:10
|
1696 |
+
msgid "Tools"
|
1697 |
+
msgstr ""
|
1698 |
+
|
1699 |
+
#: classes/admin/tabs/ajax/trait-wc-order-export-ajax-helpers.php:118
|
1700 |
+
msgid "Can't find exported file"
|
1701 |
+
msgstr ""
|
1702 |
+
|
1703 |
+
#: classes/admin/tabs/ajax/class-wc-order-export-ajax.php:20
|
1704 |
+
msgid "Profile required!"
|
1705 |
+
msgstr ""
|
1706 |
+
|
1707 |
+
#: classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php:36
|
1708 |
+
msgid "Can't create temporary file"
|
1709 |
+
msgstr ""
|
1710 |
+
|
1711 |
#. Name of the plugin
|
1712 |
msgid "Advanced Order Export For WooCommerce"
|
1713 |
msgstr ""
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link: https://algolplus.com/plugins/
|
|
4 |
Tags: woocommerce,export,order,xls,csv,xml,woo export lite,export orders,orders export,csv export,xml export,xls export,tsv
|
5 |
Requires PHP: 5.4.0
|
6 |
Requires at least: 4.7
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag:
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -32,7 +32,7 @@ Export any custom field assigned to orders/products/coupons is easy and you can
|
|
32 |
* customer details (both shipping and billing)
|
33 |
* product attributes
|
34 |
* coupon details
|
35 |
-
* XLS, CSV, TSV, XML and JSON formats
|
36 |
|
37 |
= Use this plugin to export orders for =
|
38 |
|
@@ -68,27 +68,30 @@ Check [some snippets](https://algolplus.com/plugins/snippets-plugins/) for popul
|
|
68 |
= I want to add a product attribute to the export =
|
69 |
Check screenshot #5! You should open section "Set up fields", open section "Products"(right column), click button "Add field", select field in 2nd dropdown, type column title and press button "Confirm".
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
= I can't filter/export custom attribute for Simple Product =
|
72 |
I'm sorry, but it's impossible. You should add this attribute to Products>Attributes at first and use "Filter by Product Taxonomies".
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
= Plugin produces unreadable XLS file =
|
75 |
The theme or another plugin outputs some lines. Usually, there are extra empty lines at the end of functions.php(in active theme).
|
76 |
|
77 |
= I can't export Excel file (blank message or error 500) =
|
78 |
Please, increase "memory_limit" upto 256M or ask hosting support to do it.
|
79 |
|
80 |
-
= How can I add a Gravity Forms field to export? =
|
81 |
-
Open order, look at items and remember meta name.
|
82 |
-
Visit WooCommerce>Export Orders,
|
83 |
-
open section "Set up fields", scroll down to "Products", click button "Set up fields" ( you will see popup)
|
84 |
-
select SAME name in second dropdown
|
85 |
-
|
86 |
= When exporting .csv containing european special characters , I want to open this csv in Excel without extra actions =
|
87 |
You should open tab "CSV" and set up ISO-8859-1 as codepage.
|
88 |
|
89 |
-
= Red text flashes at bottom during page loading =
|
90 |
-
It's a normal situation. The plugin hides this warning on successful load.
|
91 |
-
|
92 |
= Can I request any new feature ? =
|
93 |
Yes, you can email a request to aprokaev@gmail.com. We intensively develop this plugin.
|
94 |
|
@@ -103,6 +106,20 @@ Yes, you can email a request to aprokaev@gmail.com. We intensively develop this
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 2.1.1 - 2019-02-14 =
|
107 |
* Fixed critical bug - new version damages CSV and TSV parameters, so "Bulk action" doesn't work
|
108 |
|
@@ -113,7 +130,7 @@ Yes, you can email a request to aprokaev@gmail.com. We intensively develop this
|
|
113 |
* Section "Setup fields" works on phone/tablet
|
114 |
* New XLS option to avoid formatting - "Force general format for all cells"
|
115 |
* Fixed bug - fields "Summary Report Total xxxx" stayed at bottom
|
116 |
-
* Fixed bug -
|
117 |
* Fixed bug - fields reset when user switches between flat formats
|
118 |
* Fixed bug - field "full categories" was empty for variations
|
119 |
* Tested for jQuery 3.0+
|
4 |
Tags: woocommerce,export,order,xls,csv,xml,woo export lite,export orders,orders export,csv export,xml export,xls export,tsv
|
5 |
Requires PHP: 5.4.0
|
6 |
Requires at least: 4.7
|
7 |
+
Tested up to: 5.2
|
8 |
+
Stable tag: 3.0.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
32 |
* customer details (both shipping and billing)
|
33 |
* product attributes
|
34 |
* coupon details
|
35 |
+
* XLS, CSV, TSV, PDF, HTML, XML and JSON formats
|
36 |
|
37 |
= Use this plugin to export orders for =
|
38 |
|
68 |
= I want to add a product attribute to the export =
|
69 |
Check screenshot #5! You should open section "Set up fields", open section "Products"(right column), click button "Add field", select field in 2nd dropdown, type column title and press button "Confirm".
|
70 |
|
71 |
+
= I see only GREEN fields in section "Set up fields" =
|
72 |
+
Please, unmark checkbox "Summary Report By Products" (it's below date range)
|
73 |
+
|
74 |
+
= Red text flashes at bottom during page loading =
|
75 |
+
It's a normal situation. The plugin hides this warning on successful load.
|
76 |
+
|
77 |
= I can't filter/export custom attribute for Simple Product =
|
78 |
I'm sorry, but it's impossible. You should add this attribute to Products>Attributes at first and use "Filter by Product Taxonomies".
|
79 |
|
80 |
+
= How can I add a Gravity Forms field to export? =
|
81 |
+
Open order, look at items and remember meta name.
|
82 |
+
Visit WooCommerce>Export Orders,
|
83 |
+
open section "Set up fields", open section "Products"(at right), click button "Add field",
|
84 |
+
select SAME name in second dropdown (screenshot #5)
|
85 |
+
|
86 |
= Plugin produces unreadable XLS file =
|
87 |
The theme or another plugin outputs some lines. Usually, there are extra empty lines at the end of functions.php(in active theme).
|
88 |
|
89 |
= I can't export Excel file (blank message or error 500) =
|
90 |
Please, increase "memory_limit" upto 256M or ask hosting support to do it.
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
= When exporting .csv containing european special characters , I want to open this csv in Excel without extra actions =
|
93 |
You should open tab "CSV" and set up ISO-8859-1 as codepage.
|
94 |
|
|
|
|
|
|
|
95 |
= Can I request any new feature ? =
|
96 |
Yes, you can email a request to aprokaev@gmail.com. We intensively develop this plugin.
|
97 |
|
106 |
|
107 |
== Changelog ==
|
108 |
|
109 |
+
= 3.0.0 - 2019-07-03 =
|
110 |
+
* New format - **HTML**
|
111 |
+
* Added order field "Link to edit order" (useful for HTML format)
|
112 |
+
* Added product field "Embedded Product Image" (works for XLS and PDF formats only!)
|
113 |
+
* Added order fields (for customer) - "First Order Date", "Last Order Date"
|
114 |
+
* Added 'Hide unused' for order/product/coupon fields (dropdowns filtered by matching orders)
|
115 |
+
* Allow to sort orders by any custom field
|
116 |
+
* Fixed bug - fields with prefix "USER_" were shown for all tabs in section "Setup fields"
|
117 |
+
* Fixed bug - the plugin exported all orders by default (including cancelled and refunded)
|
118 |
+
* Fixed bug - bulk export didn't sort orders
|
119 |
+
* Fixed bug - incompatibility with some coupon plugins
|
120 |
+
* Fixed bug - tab "Tools" didn't show error if JSON is not valid
|
121 |
+
* Removed a lot of outdated code
|
122 |
+
|
123 |
= 2.1.1 - 2019-02-14 =
|
124 |
* Fixed critical bug - new version damages CSV and TSV parameters, so "Bulk action" doesn't work
|
125 |
|
130 |
* Section "Setup fields" works on phone/tablet
|
131 |
* New XLS option to avoid formatting - "Force general format for all cells"
|
132 |
* Fixed bug - fields "Summary Report Total xxxx" stayed at bottom
|
133 |
+
* Fixed bug - "Summary report" was not sorted by item name
|
134 |
* Fixed bug - fields reset when user switches between flat formats
|
135 |
* Fixed bug - field "full categories" was empty for variations
|
136 |
* Tested for jQuery 3.0+
|
view/main.php
CHANGED
@@ -1,22 +1,24 @@
|
|
1 |
<?php
|
2 |
-
if ( !defined( 'ABSPATH' ) ) {
|
3 |
exit; // Exit if accessed directly
|
4 |
}
|
5 |
-
$active_tab = isset( $_REQUEST[ 'tab' ] ) ? $_REQUEST[ 'tab' ] : 'export';
|
6 |
?>
|
7 |
<?php if ( isset( $_REQUEST['save'] ) ): ?>
|
8 |
-
<div class="update-nag"
|
|
|
|
|
9 |
<?php endif; ?>
|
10 |
<h2 class="nav-tab-wrapper" id="tabs">
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
</h2>
|
18 |
|
19 |
<script>
|
20 |
var ajaxurl = "<?php echo $ajaxurl ?>"
|
21 |
var woe_nonce = "<?php echo wp_create_nonce( 'woe_nonce' ) ?>"
|
|
|
22 |
</script>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
exit; // Exit if accessed directly
|
4 |
}
|
|
|
5 |
?>
|
6 |
<?php if ( isset( $_REQUEST['save'] ) ): ?>
|
7 |
+
<div class="update-nag"
|
8 |
+
style="color: #008000; border-left: 4px solid green; display: block; width: 70%;"><?php _e( 'Settings saved',
|
9 |
+
'woo-order-export-lite' ) ?></div>
|
10 |
<?php endif; ?>
|
11 |
<h2 class="nav-tab-wrapper" id="tabs">
|
12 |
+
<?php foreach ( $tabs as $tab_key => $tab ): ?>
|
13 |
+
<a class="nav-tab <?php echo $active_tab == $tab_key ? 'nav-tab-active' : '' ?>"
|
14 |
+
href="<?php echo admin_url( 'admin.php?page=wc-order-export&tab=' . $tab_key ) ?>">
|
15 |
+
<?php echo $tab->get_title() ?>
|
16 |
+
</a>
|
17 |
+
<?php endforeach; ?>
|
18 |
</h2>
|
19 |
|
20 |
<script>
|
21 |
var ajaxurl = "<?php echo $ajaxurl ?>"
|
22 |
var woe_nonce = "<?php echo wp_create_nonce( 'woe_nonce' ) ?>"
|
23 |
+
var woe_active_tab = "<?php echo $active_tab ?>"
|
24 |
</script>
|
view/settings-form.php
CHANGED
@@ -14,6 +14,7 @@ $settings = WC_Order_Export_Manage::get( $mode, $id );
|
|
14 |
$settings = apply_filters( 'woe_settings_page_prepare', $settings );
|
15 |
$order_custom_meta_fields = WC_Order_Export_Data_Extractor_UI::get_all_order_custom_meta_fields();
|
16 |
$readonly_php = WC_Order_Export_Admin::user_can_add_custom_php() ? '' : 'readonly';
|
|
|
17 |
|
18 |
$pdf_format_available_options = array(
|
19 |
'orientation' => array(
|
@@ -52,12 +53,27 @@ function print_formats_field( $type, $segment = "" ) {
|
|
52 |
return $formats_fields_html;
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
?>
|
57 |
|
58 |
<script>
|
59 |
var mode = '<?php echo $mode ?>';
|
60 |
-
var job_id = '<?php echo esc_js($id) ?>';
|
61 |
var output_format = '<?php echo $settings['format'] ?>';
|
62 |
var selected_order_fields = <?php echo json_encode( $settings['order_fields'] ) ?>;
|
63 |
var selected_order_products_fields = <?php echo json_encode( $settings['order_product_fields'] ) ?>;
|
@@ -84,16 +100,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
84 |
<?php endif; ?>
|
85 |
|
86 |
<div id="my-left" style="float: left; width: 49%; max-width: 500px;">
|
87 |
-
<?php
|
88 |
-
if ( $mode === WC_Order_Export_Manage::EXPORT_PROFILE ):
|
89 |
-
include 'pro-version/top-profile.php';
|
90 |
-
elseif ( $mode === WC_Order_Export_Manage::EXPORT_ORDER_ACTION ):
|
91 |
-
include 'pro-version/top-order-actions.php';
|
92 |
-
elseif ( $mode === WC_Order_Export_Manage::EXPORT_SCHEDULE ):
|
93 |
-
include 'pro-version/top-scheduled-jobs.php';
|
94 |
-
endif;
|
95 |
-
?>
|
96 |
-
|
97 |
<input type="hidden" name="settings[version]"
|
98 |
value="<?php echo isset( $settings['version'] ) ? $settings['version'] : '2.0' ?>">
|
99 |
|
@@ -137,14 +144,15 @@ function print_formats_field( $type, $segment = "" ) {
|
|
137 |
<div style="display: inline;">
|
138 |
<span class="wc-oe-header"><?php _e( 'Date range', 'woo-order-export-lite' ) ?></span>
|
139 |
<input type=text class='date' name="settings[from_date]" id="from_date"
|
140 |
-
value='<?php echo $settings['from_date'] ?>'>
|
141 |
<?php _e( 'to', 'woo-order-export-lite' ) ?>
|
142 |
<input type=text class='date' name="settings[to_date]" id="to_date"
|
143 |
-
value='<?php echo $settings['to_date'] ?>'>
|
144 |
</div>
|
145 |
|
146 |
<button id="my-quick-export-btn" class="button-primary"><?php _e( 'Express export',
|
147 |
'woo-order-export-lite' ) ?></button>
|
|
|
148 |
<div id="summary_report_by_products" style="display:inline-block"><input type="hidden"
|
149 |
name="settings[summary_report_by_products]"
|
150 |
value="0"/><label><input
|
@@ -214,6 +222,20 @@ function print_formats_field( $type, $segment = "" ) {
|
|
214 |
value=1 <?php if ( @$settings['format_xls_force_general_format'] ) {
|
215 |
echo 'checked';
|
216 |
} ?> > <?php _e( 'Force general format for all cells', 'woo-order-export-lite' ) ?><br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
</div>
|
218 |
<div id='CSV_options' style='display:none'><strong><?php _e( 'CSV options',
|
219 |
'woo-order-export-lite' ) ?></strong><br>
|
@@ -236,7 +258,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
236 |
<input type=checkbox name="settings[format_csv_item_rows_start_from_new_line]"
|
237 |
value=1 <?php if ( @$settings['format_csv_item_rows_start_from_new_line'] ) {
|
238 |
echo 'checked';
|
239 |
-
} ?> > <?php _e( '
|
240 |
<?php _e( 'Enclosure', 'woo-order-export-lite' ) ?> <input type=text
|
241 |
name="settings[format_csv_enclosure]"
|
242 |
value='<?php echo $settings['format_csv_enclosure'] ?>'
|
@@ -258,8 +280,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
258 |
</div>
|
259 |
<div id='XML_options' style='display:none'><strong><?php _e( 'XML options',
|
260 |
'woo-order-export-lite' ) ?></strong><br>
|
261 |
-
<?php if( !class_exists("XMLWriter") ): ?>
|
262 |
-
|
263 |
<?php endif ?>
|
264 |
<input type=hidden name="settings[format_xml_self_closing_tags]" value=0>
|
265 |
<span class="xml-title"><?php _e( 'Prepend XML', 'woo-order-export-lite' ) ?></span><input type=text
|
@@ -320,143 +342,256 @@ function print_formats_field( $type, $segment = "" ) {
|
|
320 |
</div>
|
321 |
|
322 |
<div id='PDF_options' style='display:none'><strong><?php _e( 'PDF options',
|
323 |
-
|
324 |
<input type=hidden name="settings[format_pdf_display_column_names]" value=0>
|
325 |
<input type=checkbox name="settings[format_pdf_display_column_names]"
|
326 |
value=1 <?php if ( @$settings['format_pdf_display_column_names'] ) {
|
327 |
-
|
328 |
-
|
329 |
|
330 |
-
|
331 |
<input type=hidden name="settings[format_pdf_repeat_header]" value=0>
|
332 |
<input type=checkbox name="settings[format_pdf_repeat_header]"
|
333 |
value=1 <?php if ( @$settings['format_pdf_repeat_header'] ) {
|
334 |
-
|
335 |
-
|
336 |
|
337 |
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
<
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
<
|
405 |
-
|
406 |
-
|
407 |
-
<
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
<
|
430 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
|
432 |
<hr>
|
433 |
|
434 |
<div class="pdf_two_col_block">
|
435 |
-
<input type="button" class="button button-primary image-upload-button"
|
436 |
-
|
|
|
|
|
|
|
|
|
437 |
<br>
|
438 |
-
|
439 |
-
<img src="<?php echo $source; ?>" height="100" width="100"
|
|
|
440 |
<br>
|
441 |
-
<input type="button"
|
|
|
|
|
442 |
</div>
|
443 |
<div class="pdf_two_col_block">
|
444 |
-
|
445 |
<select name="settings[format_pdf_logo_align]">
|
446 |
-
|
447 |
-
<option value="<?php echo $align; ?>" <?php echo selected($align == $settings['format_pdf_logo_align']); ?> ><?php echo $label; ?></option>
|
448 |
-
|
449 |
</select>
|
450 |
</div>
|
451 |
<div class="pdf_two_col_block">
|
452 |
-
|
453 |
<br>
|
454 |
-
<input type="number" name="settings[format_pdf_logo_height]"
|
|
|
455 |
</div>
|
456 |
<div class="pdf_two_col_block">
|
457 |
-
|
|
|
458 |
<br>
|
459 |
-
<input type="number" name="settings[format_pdf_logo_width]"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
</div>
|
461 |
|
462 |
</div>
|
@@ -516,7 +651,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
516 |
</div>
|
517 |
</div>
|
518 |
</div>
|
519 |
-
|
520 |
<br/>
|
521 |
<div id="my-sort" class="my-block">
|
522 |
<?php
|
@@ -524,7 +659,12 @@ function print_formats_field( $type, $segment = "" ) {
|
|
524 |
'order_id' => __( 'Order ID', 'woo-order-export-lite' ),
|
525 |
'post_date' => __( 'Order Date', 'woo-order-export-lite' ),
|
526 |
'post_modified' => __( 'Modification Date', 'woo-order-export-lite' ),
|
|
|
527 |
);
|
|
|
|
|
|
|
|
|
528 |
ob_start();
|
529 |
?>
|
530 |
<select name="settings[sort]">
|
@@ -620,6 +760,11 @@ function print_formats_field( $type, $segment = "" ) {
|
|
620 |
<?php _e( 'Please check permissions for your role. You must have capability “edit_themes” to use this box.',
|
621 |
'woo-order-export-lite' ); ?>
|
622 |
</strong>
|
|
|
|
|
|
|
|
|
|
|
623 |
<?php endif; ?>
|
624 |
<textarea placeholder="<?php _e( 'Use only unnamed functions!', 'woo-order-export-lite' ) ?>"
|
625 |
name="settings[custom_php_code]" <?php echo $readonly_php ?> class="width-100"
|
@@ -631,12 +776,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
631 |
</div>
|
632 |
|
633 |
<div id="my-right" style="float: left; width: 48%; margin: 0px 10px; max-width: 500px;">
|
634 |
-
<?php
|
635 |
-
if ( in_array( $mode,
|
636 |
-
array( WC_Order_Export_Manage::EXPORT_SCHEDULE, WC_Order_Export_Manage::EXPORT_ORDER_ACTION ) ) ):
|
637 |
-
include "pro-version/destinations.php";
|
638 |
-
endif; ?>
|
639 |
-
|
640 |
<div class="my-block">
|
641 |
<span class="my-hide-next "><?php _e( 'Filter by order', 'woo-order-export-lite' ) ?>
|
642 |
<span class="ui-icon ui-icon-triangle-1-s my-icon-triangle"></span></span>
|
@@ -658,7 +798,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
658 |
value="1" <?php checked( $settings['export_unmarked_orders'] ) ?> /> <?php _e( "Export unmarked orders only",
|
659 |
'woo-order-export-lite' ) ?></label></div>
|
660 |
<span class="wc-oe-header"><?php _e( 'Order statuses', 'woo-order-export-lite' ) ?></span>
|
661 |
-
<select id="statuses" name="settings[statuses][]" multiple="multiple"
|
662 |
style="width: 100%; max-width: 25%;">
|
663 |
<?php foreach (
|
664 |
apply_filters( 'woe_settings_order_statuses', wc_get_order_statuses() ) as $i => $status
|
@@ -671,7 +811,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
671 |
|
672 |
<span class="wc-oe-header"><?php _e( 'Custom fields', 'woo-order-export-lite' ) ?></span>
|
673 |
<br>
|
674 |
-
<select id="custom_fields" style="width: auto;">
|
675 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_order_custom_fields() as $cf_name ) { ?>
|
676 |
<option><?php echo $cf_name; ?></option>
|
677 |
<?php } ?>
|
@@ -694,7 +834,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
694 |
<button id="add_custom_fields" class="button-secondary"><span
|
695 |
class="dashicons dashicons-plus-alt"></span></button>
|
696 |
<br>
|
697 |
-
<select id="custom_fields_check" multiple name="settings[order_custom_fields][]"
|
698 |
style="width: 100%; max-width: 25%;">
|
699 |
<?php
|
700 |
if ( $settings['order_custom_fields'] ) {
|
@@ -726,7 +866,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
726 |
value="1" <?php checked( $settings['skip_refunded_items'] ) ?> /> <?php _e( 'Skip fully refunded items',
|
727 |
'woo-order-export-lite' ) ?></label></div>
|
728 |
<span class="wc-oe-header"><?php _e( 'Product categories', 'woo-order-export-lite' ) ?></span>
|
729 |
-
<select id="product_categories"
|
|
|
730 |
style="width: 100%; max-width: 25%;">
|
731 |
<?php
|
732 |
if ( $settings['product_categories'] ) {
|
@@ -743,7 +884,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
743 |
} ?>
|
744 |
</select>
|
745 |
<span class="wc-oe-header"><?php _e( 'Vendor/creator', 'woo-order-export-lite' ) ?></span>
|
746 |
-
<select id="product_vendors"
|
|
|
747 |
style="width: 100%; max-width: 25%;">
|
748 |
<?php
|
749 |
if ( $settings['product_vendors'] ) {
|
@@ -759,7 +901,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
759 |
|
760 |
<span class="wc-oe-header"><?php _e( 'Product', 'woo-order-export-lite' ) ?></span>
|
761 |
|
762 |
-
<select id="products"
|
|
|
763 |
style="width: 100%; max-width: 25%;">
|
764 |
<?php
|
765 |
if ( $settings['products'] ) {
|
@@ -773,7 +916,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
773 |
|
774 |
<span class="wc-oe-header"><?php _e( 'Product taxonomies', 'woo-order-export-lite' ) ?></span>
|
775 |
<br>
|
776 |
-
<select id="taxonomies" style="width: auto;">
|
777 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_product_taxonomies() as $attr_id => $attr_name ) { ?>
|
778 |
<option><?php echo $attr_name; ?></option>
|
779 |
<?php } ?>
|
@@ -782,6 +925,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
782 |
<select id="taxonomies_compare" class="select_compare">
|
783 |
<option>=</option>
|
784 |
<option><></option>
|
|
|
|
|
785 |
</select>
|
786 |
|
787 |
<input type="text" id="text_taxonomies" disabled style="display: none;">
|
@@ -789,7 +934,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
789 |
<button id="add_taxonomies" class="button-secondary"><span class="dashicons dashicons-plus-alt"></span>
|
790 |
</button>
|
791 |
<br>
|
792 |
-
<select id="taxonomies_check"
|
|
|
793 |
style="width: 100%; max-width: 25%;">
|
794 |
<?php
|
795 |
if ( $settings['product_taxonomies'] ) {
|
@@ -802,7 +948,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
802 |
|
803 |
<span class="wc-oe-header"><?php _e( 'Product custom fields', 'woo-order-export-lite' ) ?></span>
|
804 |
<br>
|
805 |
-
<select id="product_custom_fields"
|
|
|
806 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_product_custom_fields() as $cf_name ) { ?>
|
807 |
<option><?php echo $cf_name; ?></option>
|
808 |
<?php } ?>
|
@@ -816,6 +963,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
816 |
<option>>=</option>
|
817 |
<option><</option>
|
818 |
<option><=</option>
|
|
|
|
|
819 |
</select>
|
820 |
|
821 |
<input type="text" id="text_product_custom_fields" disabled class="like-input" style="display: none;">
|
@@ -823,7 +972,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
823 |
<button id="add_product_custom_fields" class="button-secondary"><span
|
824 |
class="dashicons dashicons-plus-alt"></span></button>
|
825 |
<br>
|
826 |
-
<select id="product_custom_fields_check"
|
|
|
827 |
style="width: 100%; max-width: 25%;">
|
828 |
<?php
|
829 |
if ( $settings['product_custom_fields'] ) {
|
@@ -837,7 +987,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
837 |
<span class="wc-oe-header"><?php _e( 'Variable product attributes',
|
838 |
'woo-order-export-lite' ) ?></span>
|
839 |
<br>
|
840 |
-
<select id="attributes" style="width: auto;">
|
841 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_product_attributes() as $attr_id => $attr_name ) { ?>
|
842 |
<option><?php echo $attr_name; ?></option>
|
843 |
<?php } ?>
|
@@ -854,7 +1004,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
854 |
<button id="add_attributes" class="button-secondary"><span class="dashicons dashicons-plus-alt"></span>
|
855 |
</button>
|
856 |
<br>
|
857 |
-
<select id="attributes_check"
|
|
|
858 |
style="width: 100%; max-width: 25%;">
|
859 |
<?php
|
860 |
if ( $settings['product_attributes'] ) {
|
@@ -867,7 +1018,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
867 |
|
868 |
<span class="wc-oe-header"><?php _e( 'Item meta data', 'woo-order-export-lite' ) ?></span>
|
869 |
<br>
|
870 |
-
<select id="itemmeta" style="width: auto;">
|
871 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_product_itemmeta() as $attr_name ) { ?>
|
872 |
<option data-base64="<?php echo base64_encode( $attr_name ); ?>"><?php echo $attr_name; ?></option>
|
873 |
<?php } ?>
|
@@ -888,7 +1039,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
888 |
<button id="add_itemmeta" class="button-secondary"><span class="dashicons dashicons-plus-alt"></span>
|
889 |
</button>
|
890 |
<br>
|
891 |
-
<select id="itemmeta_check"
|
|
|
892 |
style="width: 100%; max-width: 25%;">
|
893 |
<?php
|
894 |
if ( $settings['product_itemmeta'] ) {
|
@@ -910,7 +1062,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
910 |
<div id="my-users" hidden="hidden">
|
911 |
|
912 |
<span class="wc-oe-header"><?php _e( 'Usernames', 'woo-order-export-lite' ) ?></span>
|
913 |
-
<select id="user_names"
|
|
|
914 |
style="width: 100%; max-width: 25%;">
|
915 |
<?php
|
916 |
if ( $settings['user_names'] ) {
|
@@ -923,7 +1076,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
923 |
</select>
|
924 |
|
925 |
<span class="wc-oe-header"><?php _e( 'User roles', 'woo-order-export-lite' ) ?></span>
|
926 |
-
<select id="user_roles" name="settings[user_roles][]" multiple="multiple"
|
927 |
style="width: 100%; max-width: 25%;">
|
928 |
<?php
|
929 |
global $wp_roles;
|
@@ -935,7 +1088,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
935 |
|
936 |
<span class="wc-oe-header"><?php _e( 'Custom fields', 'woo-order-export-lite' ) ?></span>
|
937 |
<br>
|
938 |
-
<select id="user_custom_fields" style="width: auto;">
|
939 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_user_custom_fields() as $cf_name ) { ?>
|
940 |
<option><?php echo $cf_name; ?></option>
|
941 |
<?php } ?>
|
@@ -957,7 +1110,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
957 |
<button id="add_user_custom_fields" class="button-secondary"><span
|
958 |
class="dashicons dashicons-plus-alt"></span></button>
|
959 |
<br>
|
960 |
-
<select id="user_custom_fields_check"
|
|
|
961 |
style="width: 100%; max-width: 25%;">
|
962 |
<?php
|
963 |
if ( ! empty( $settings['user_custom_fields'] ) ) {
|
@@ -983,7 +1137,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
983 |
'woo-order-export-lite' ) ?></label>
|
984 |
</div>
|
985 |
<span class="wc-oe-header"><?php _e( 'Coupons', 'woo-order-export-lite' ) ?></span>
|
986 |
-
<select id="coupons"
|
|
|
987 |
style="width: 100%; max-width: 25%;">
|
988 |
<?php
|
989 |
if ( $settings['coupons'] ) {
|
@@ -1004,7 +1159,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1004 |
<div id="my-billing" hidden="hidden">
|
1005 |
<span class="wc-oe-header"><?php _e( 'Billing locations', 'woo-order-export-lite' ) ?></span>
|
1006 |
<br>
|
1007 |
-
<select id="billing_locations">
|
1008 |
<option>City</option>
|
1009 |
<option>State</option>
|
1010 |
<option>Postcode</option>
|
@@ -1018,7 +1173,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1018 |
<button id="add_billing_locations" class="button-secondary"><span
|
1019 |
class="dashicons dashicons-plus-alt"></span></button>
|
1020 |
<br>
|
1021 |
-
<select id="billing_locations_check"
|
|
|
1022 |
style="width: 100%; max-width: 25%;">
|
1023 |
<?php
|
1024 |
if ( $settings['billing_locations'] ) {
|
@@ -1030,7 +1186,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1030 |
</select>
|
1031 |
|
1032 |
<span class="wc-oe-header"><?php _e( 'Payment methods', 'woo-order-export-lite' ) ?></span>
|
1033 |
-
<select id="payment_methods" name="settings[payment_methods][]" multiple="multiple"
|
1034 |
style="width: 100%; max-width: 25%;">
|
1035 |
<?php foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) { ?>
|
1036 |
<option value="<?php echo $gateway->id ?>" <?php if ( in_array( $gateway->id,
|
@@ -1050,7 +1206,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1050 |
<div id="my-shipping" hidden="hidden">
|
1051 |
<span class="wc-oe-header"><?php _e( 'Shipping locations', 'woo-order-export-lite' ) ?></span>
|
1052 |
<br>
|
1053 |
-
<select id="shipping_locations">
|
1054 |
<option>City</option>
|
1055 |
<option>State</option>
|
1056 |
<option>Postcode</option>
|
@@ -1064,7 +1220,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1064 |
<button id="add_shipping_locations" class="button-secondary"><span
|
1065 |
class="dashicons dashicons-plus-alt"></span></button>
|
1066 |
<br>
|
1067 |
-
<select id="shipping_locations_check"
|
|
|
1068 |
style="width: 100%; max-width: 25%;">
|
1069 |
<?php
|
1070 |
if ( $settings['shipping_locations'] ) {
|
@@ -1076,7 +1233,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1076 |
</select>
|
1077 |
|
1078 |
<span class="wc-oe-header"><?php _e( 'Shipping methods', 'woo-order-export-lite' ) ?></span>
|
1079 |
-
<select id="shipping_methods" name="settings[shipping_methods][]"
|
|
|
1080 |
style="width: 100%; max-width: 25%;">
|
1081 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_shipping_methods() as $i => $title ) { ?>
|
1082 |
<option value="<?php echo $i ?>" <?php if ( in_array( $i, $settings['shipping_methods'] ) ) {
|
@@ -1095,7 +1253,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1095 |
<div id="my-items-meta" hidden="hidden">
|
1096 |
<span class="wc-oe-header"><?php _e( 'Item names', 'woo-order-export-lite' ) ?></span>
|
1097 |
<br>
|
1098 |
-
<select id="item_names">
|
1099 |
<option>coupon</option>
|
1100 |
<option>fee</option>
|
1101 |
<option>line_item</option>
|
@@ -1105,11 +1263,14 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1105 |
<select id="item_name_compare" class="select_compare">
|
1106 |
<option>=</option>
|
1107 |
<option><></option>
|
|
|
1108 |
</select>
|
|
|
1109 |
<button id="add_item_names" class="button-secondary"><span class="dashicons dashicons-plus-alt"></span>
|
1110 |
</button>
|
1111 |
<br>
|
1112 |
-
<select id="item_names_check"
|
|
|
1113 |
style="width: 100%; max-width: 25%;">
|
1114 |
<?php
|
1115 |
if ( $settings['item_names'] ) {
|
@@ -1122,7 +1283,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1122 |
|
1123 |
<span class="wc-oe-header"><?php _e( 'Item metadata', 'woo-order-export-lite' ) ?></span>
|
1124 |
<br>
|
1125 |
-
<select id="item_metadata">
|
1126 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_item_meta_keys() as $type => $meta_keys ) { ?>
|
1127 |
<optgroup label="<?php echo ucwords( $type ); ?>">
|
1128 |
<?php foreach ( $meta_keys as $item_meta_key ) { ?>
|
@@ -1134,11 +1295,14 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1134 |
<select id="item_metadata_compare" class="select_compare">
|
1135 |
<option>=</option>
|
1136 |
<option><></option>
|
|
|
1137 |
</select>
|
|
|
1138 |
<button id="add_item_metadata" class="button-secondary"><span
|
1139 |
class="dashicons dashicons-plus-alt"></span></button>
|
1140 |
<br>
|
1141 |
-
<select id="item_metadata_check"
|
|
|
1142 |
style="width: 100%; max-width: 25%;">
|
1143 |
<?php
|
1144 |
if ( $settings['item_metadata'] ) {
|
@@ -1168,6 +1332,10 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1168 |
<br class="clear"/>
|
1169 |
</div>
|
1170 |
<div id='fields' style='display:none;'>
|
|
|
|
|
|
|
|
|
1171 |
<div class="fields-control-block"></div>
|
1172 |
<br>
|
1173 |
<div class="fields-control">
|
@@ -1217,12 +1385,13 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1217 |
</div>
|
1218 |
<div class="tab-actions-forms">
|
1219 |
<div class='div_meta segment-form all-segments'>
|
|
|
1220 |
<label for="select_custom_meta_order">
|
1221 |
<?php _e( 'Meta key', 'woo-order-export-lite' ) ?>:
|
1222 |
</label><br/>
|
1223 |
<select id='select_custom_meta_order'>
|
1224 |
<?php
|
1225 |
-
foreach ( $order_custom_meta_fields as $meta_id => $meta_name ) {
|
1226 |
echo "<option value='$meta_name' >$meta_name</option>";
|
1227 |
};
|
1228 |
?>
|
@@ -1273,13 +1442,44 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1273 |
'woo-order-export-lite' ) ?></button>
|
1274 |
</div>
|
1275 |
</div>
|
1276 |
-
<div class='div_meta
|
1277 |
-
<
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1282 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1283 |
<label for="select_custom_meta_products"><?php _e( 'Product fields',
|
1284 |
'woo-order-export-lite' ) ?>:</label><select
|
1285 |
id='select_custom_meta_products'></select>
|
@@ -1290,7 +1490,13 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1290 |
<label> </label><input style="width: 80%;" type='text'
|
1291 |
id='text_custom_meta_order_items'
|
1292 |
placeholder="<?php _e( 'or type meta key here',
|
1293 |
-
'woo-order-export-lite' ) ?>"
|
|
|
|
|
|
|
|
|
|
|
|
|
1294 |
<div style="width: 80%; text-align: center;"><?php _e( 'OR',
|
1295 |
'woo-order-export-lite' ) ?></div>
|
1296 |
<label><?php _e( 'Taxonomy', 'woo-order-export-lite' ) ?>:</label><select
|
@@ -1343,7 +1549,7 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1343 |
<div id="custom_meta_coupons_mode" style="display: none;">
|
1344 |
<input id="custom_meta_coupons_mode" type="checkbox"
|
1345 |
name="custom_meta_coupons_mode" value="used"> <?php _e( 'Hide unused fields',
|
1346 |
-
|
1347 |
</div>
|
1348 |
<br>
|
1349 |
<select id='select_custom_meta_coupons'></select>
|
@@ -1438,16 +1644,14 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1438 |
value="<?php _e( 'Export [w/o progressbar]', 'woo-order-export-lite' ) ?>"
|
1439 |
title="<?php _e( 'It might not work for huge datasets!', 'woo-order-export-lite' ) ?>"/>
|
1440 |
<?php } ?>
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
<?php endif; ?>
|
1445 |
-
|
1446 |
<?php if ( $mode === WC_Order_Export_Manage::EXPORT_NOW ): ?>
|
1447 |
<input type="submit" id='reset-profile' class="button-secondary"
|
1448 |
value="<?php _e( 'Reset settings', 'woo-order-export-lite' ) ?>"/>
|
1449 |
<?php endif; ?>
|
1450 |
-
|
1451 |
<span id="preview_actions" class="hide">
|
1452 |
<strong id="output_preview_total"><?php echo sprintf( __( 'Export total: %s orders',
|
1453 |
'woo-order-export-lite' ), '<span></span>' ) ?></strong>
|
@@ -1482,7 +1686,8 @@ function print_formats_field( $type, $segment = "" ) {
|
|
1482 |
<form id='export_wo_pb_form' method='post' target='export_wo_pb_window'>
|
1483 |
<input name="action" type="hidden" value="order_exporter">
|
1484 |
<input name="method" type="hidden" value="plain_export">
|
1485 |
-
<?php
|
|
|
1486 |
<input name="mode" type="hidden" value="<?php echo $mode ?>">
|
1487 |
<input name="id" type="hidden" value="<?php echo $id ?>">
|
1488 |
<input name="json" type="hidden">
|
14 |
$settings = apply_filters( 'woe_settings_page_prepare', $settings );
|
15 |
$order_custom_meta_fields = WC_Order_Export_Data_Extractor_UI::get_all_order_custom_meta_fields();
|
16 |
$readonly_php = WC_Order_Export_Admin::user_can_add_custom_php() ? '' : 'readonly';
|
17 |
+
$options = WC_Order_Export_Main_Settings::get_settings();
|
18 |
|
19 |
$pdf_format_available_options = array(
|
20 |
'orientation' => array(
|
53 |
return $formats_fields_html;
|
54 |
}
|
55 |
|
56 |
+
function remove_time_from_date( $datetime ) {
|
57 |
+
if ( ! $datetime ) {
|
58 |
+
return "";
|
59 |
+
}
|
60 |
+
|
61 |
+
$timestamp = strtotime( $datetime );
|
62 |
+
if ( ! $timestamp ) {
|
63 |
+
return "";
|
64 |
+
}
|
65 |
+
|
66 |
+
$date = date( 'Y-m-d', $timestamp );
|
67 |
+
|
68 |
+
return $date ? $date : "";
|
69 |
+
}
|
70 |
+
|
71 |
|
72 |
?>
|
73 |
|
74 |
<script>
|
75 |
var mode = '<?php echo $mode ?>';
|
76 |
+
var job_id = '<?php echo esc_js( $id ) ?>';
|
77 |
var output_format = '<?php echo $settings['format'] ?>';
|
78 |
var selected_order_fields = <?php echo json_encode( $settings['order_fields'] ) ?>;
|
79 |
var selected_order_products_fields = <?php echo json_encode( $settings['order_product_fields'] ) ?>;
|
100 |
<?php endif; ?>
|
101 |
|
102 |
<div id="my-left" style="float: left; width: 49%; max-width: 500px;">
|
103 |
+
<?php do_action( 'woe_settings_form_view_top', $settings ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
<input type="hidden" name="settings[version]"
|
105 |
value="<?php echo isset( $settings['version'] ) ? $settings['version'] : '2.0' ?>">
|
106 |
|
144 |
<div style="display: inline;">
|
145 |
<span class="wc-oe-header"><?php _e( 'Date range', 'woo-order-export-lite' ) ?></span>
|
146 |
<input type=text class='date' name="settings[from_date]" id="from_date"
|
147 |
+
value='<?php echo ! empty($options['show_date_time_picker_for_date_range']) ? $settings['from_date']: remove_time_from_date($settings['from_date']) ?>'>
|
148 |
<?php _e( 'to', 'woo-order-export-lite' ) ?>
|
149 |
<input type=text class='date' name="settings[to_date]" id="to_date"
|
150 |
+
value='<?php echo ! empty($options['show_date_time_picker_for_date_range']) ? $settings['to_date']: remove_time_from_date($settings['to_date']) ?>'>
|
151 |
</div>
|
152 |
|
153 |
<button id="my-quick-export-btn" class="button-primary"><?php _e( 'Express export',
|
154 |
'woo-order-export-lite' ) ?></button>
|
155 |
+
<br>
|
156 |
<div id="summary_report_by_products" style="display:inline-block"><input type="hidden"
|
157 |
name="settings[summary_report_by_products]"
|
158 |
value="0"/><label><input
|
222 |
value=1 <?php if ( @$settings['format_xls_force_general_format'] ) {
|
223 |
echo 'checked';
|
224 |
} ?> > <?php _e( 'Force general format for all cells', 'woo-order-export-lite' ) ?><br>
|
225 |
+
|
226 |
+
<div class="pdf_two_col_block">
|
227 |
+
<?php _e( 'Images width', 'woo-order-export-lite' ) ?>
|
228 |
+
<br>
|
229 |
+
<input type="number" name="settings[format_xls_row_images_width]"
|
230 |
+
value='<?php echo $settings['format_xls_row_images_width'] ?>' min="0">
|
231 |
+
</div>
|
232 |
+
|
233 |
+
<div class="pdf_two_col_block">
|
234 |
+
<?php _e( 'Images height', 'woo-order-export-lite' ) ?>
|
235 |
+
<br>
|
236 |
+
<input type="number" name="settings[format_xls_row_images_height]"
|
237 |
+
value='<?php echo $settings['format_xls_row_images_height'] ?>' min="0">
|
238 |
+
</div>
|
239 |
</div>
|
240 |
<div id='CSV_options' style='display:none'><strong><?php _e( 'CSV options',
|
241 |
'woo-order-export-lite' ) ?></strong><br>
|
258 |
<input type=checkbox name="settings[format_csv_item_rows_start_from_new_line]"
|
259 |
value=1 <?php if ( @$settings['format_csv_item_rows_start_from_new_line'] ) {
|
260 |
echo 'checked';
|
261 |
+
} ?> > <?php _e( 'Product rows start with a new line', 'woo-order-export-lite' ) ?><br>
|
262 |
<?php _e( 'Enclosure', 'woo-order-export-lite' ) ?> <input type=text
|
263 |
name="settings[format_csv_enclosure]"
|
264 |
value='<?php echo $settings['format_csv_enclosure'] ?>'
|
280 |
</div>
|
281 |
<div id='XML_options' style='display:none'><strong><?php _e( 'XML options',
|
282 |
'woo-order-export-lite' ) ?></strong><br>
|
283 |
+
<?php if ( ! class_exists( "XMLWriter" ) ): ?>
|
284 |
+
<div style="color:red"><?php _e( 'Please, install/enable PHP XML Extension!', 'woo-order-export-lite' ) ?></div>
|
285 |
<?php endif ?>
|
286 |
<input type=hidden name="settings[format_xml_self_closing_tags]" value=0>
|
287 |
<span class="xml-title"><?php _e( 'Prepend XML', 'woo-order-export-lite' ) ?></span><input type=text
|
342 |
</div>
|
343 |
|
344 |
<div id='PDF_options' style='display:none'><strong><?php _e( 'PDF options',
|
345 |
+
'woo-order-export-lite' ) ?></strong><br>
|
346 |
<input type=hidden name="settings[format_pdf_display_column_names]" value=0>
|
347 |
<input type=checkbox name="settings[format_pdf_display_column_names]"
|
348 |
value=1 <?php if ( @$settings['format_pdf_display_column_names'] ) {
|
349 |
+
echo 'checked';
|
350 |
+
} ?> > <?php _e( 'Output column titles as first line', 'woo-order-export-lite' ) ?>
|
351 |
|
352 |
+
(
|
353 |
<input type=hidden name="settings[format_pdf_repeat_header]" value=0>
|
354 |
<input type=checkbox name="settings[format_pdf_repeat_header]"
|
355 |
value=1 <?php if ( @$settings['format_pdf_repeat_header'] ) {
|
356 |
+
echo 'checked';
|
357 |
+
} ?> > <?php _e( 'repeat at each page', 'woo-order-export-lite' ) ?>)<br>
|
358 |
|
359 |
|
360 |
+
<div class="pdf_two_col_block">
|
361 |
+
<?php _e( 'Orientation', 'woo-order-export-lite' ) ?><br>
|
362 |
+
<select name="settings[format_pdf_orientation]">
|
363 |
+
<?php foreach ( $pdf_format_available_options['orientation'] as $orientation => $label ): ?>
|
364 |
+
<option value="<?php echo $orientation; ?>" <?php echo selected( $orientation == $settings['format_pdf_orientation'] ); ?> ><?php echo $label; ?></option>
|
365 |
+
<?php endforeach; ?>
|
366 |
+
</select>
|
367 |
+
</div>
|
368 |
+
|
369 |
+
<div class="pdf_two_col_block">
|
370 |
+
<?php _e( 'Page size', 'woo-order-export-lite' ) ?><br>
|
371 |
+
<select name="settings[format_pdf_page_size]">
|
372 |
+
<?php foreach ( $pdf_format_available_options['page_size'] as $size => $label ): ?>
|
373 |
+
<option value="<?php echo $size; ?>" <?php echo selected( $size == $settings['format_pdf_page_size'] ); ?> ><?php echo $label; ?></option>
|
374 |
+
<?php endforeach; ?>
|
375 |
+
</select>
|
376 |
+
</div>
|
377 |
+
|
378 |
+
<div class="pdf_two_col_block">
|
379 |
+
<?php _e( 'Font size', 'woo-order-export-lite' ) ?><br>
|
380 |
+
<input type=number name="settings[format_pdf_font_size]"
|
381 |
+
value='<?php echo $settings['format_pdf_font_size'] ?>' min=1 size=3><br>
|
382 |
+
</div>
|
383 |
+
|
384 |
+
<div class="pdf_two_col_block">
|
385 |
+
<?php _e( 'Page numbers', 'woo-order-export-lite' );
|
386 |
+
|
387 |
+
$align_types = array(
|
388 |
+
'L' => __( 'Left align', 'woo-order-export-lite' ),
|
389 |
+
'C' => __( 'Center align', 'woo-order-export-lite' ),
|
390 |
+
'R' => __( 'Right align', 'woo-order-export-lite' ),
|
391 |
+
);
|
392 |
+
|
393 |
+
?><br>
|
394 |
+
<select name="settings[format_pdf_pagination]">
|
395 |
+
<?php foreach ( array_merge( $align_types, array( 'disable' => __( 'No page numbers', 'woo-order-export-lite' ) ) ) as $align => $label ): ?>
|
396 |
+
<option value="<?php echo $align; ?>" <?php echo selected( $align == $settings['format_pdf_pagination'] ); ?> ><?php echo $label; ?></option>
|
397 |
+
<?php endforeach; ?>
|
398 |
+
</select>
|
399 |
+
</div>
|
400 |
+
|
401 |
+
|
402 |
+
<div class="pdf_two_col_block">
|
403 |
+
<?php _e( 'Page header text', 'woo-order-export-lite' ) ?><br>
|
404 |
+
<input type=text name="settings[format_pdf_header_text]"
|
405 |
+
value='<?php echo $settings['format_pdf_header_text'] ?>'>
|
406 |
+
</div>
|
407 |
+
<div class="pdf_two_col_block">
|
408 |
+
<?php _e( 'Columns width', 'woo-order-export-lite' ) ?>
|
409 |
+
<input title="<?php _e( 'comma separated list', 'woo-order-export-lite' ) ?>" type=text name="settings[format_pdf_cols_width]" value='<?php echo $settings['format_pdf_cols_width'] ?>'>
|
410 |
+
</div>
|
411 |
+
|
412 |
+
<div class="pdf_two_col_block">
|
413 |
+
<?php _e( 'Page footer text', 'woo-order-export-lite' ) ?><br>
|
414 |
+
<input type=text name="settings[format_pdf_footer_text]"
|
415 |
+
value='<?php echo $settings['format_pdf_footer_text'] ?>'>
|
416 |
+
</div>
|
417 |
+
<div class="pdf_two_col_block">
|
418 |
+
<?php _e( 'Columns align', 'woo-order-export-lite' ) ?>
|
419 |
+
<input title="<?php _e( 'comma separated list', 'woo-order-export-lite' ) ?>" type=text name="settings[format_pdf_cols_align]" value='<?php echo $settings['format_pdf_cols_align'] ?>'>
|
420 |
+
</div>
|
421 |
+
|
422 |
+
|
423 |
+
<div class="pdf_two_col_block">
|
424 |
+
<?php _e( 'Fit table to page width', 'woo-order-export-lite' ) ?><br>
|
425 |
+
<input type="radio" name="settings[format_pdf_fit_page_width]" value=1 <?php checked( @$settings['format_pdf_fit_page_width'] ); ?> ><?php _e( 'Yes', 'woo-order-export-lite' ); ?>
|
426 |
+
<input type="radio" name="settings[format_pdf_fit_page_width]" value=0 <?php checked( !@$settings['format_pdf_fit_page_width'] ); ?> ><?php _e( 'No', 'woo-order-export-lite' ); ?>
|
427 |
+
</div>
|
428 |
+
<hr>
|
429 |
+
<div class="pdf_two_col_block">
|
430 |
+
<?php _e( 'Table header text color', 'woo-order-export-lite' ) ?>
|
431 |
+
<input type=text class="color_pick" name="settings[format_pdf_table_header_text_color]"
|
432 |
+
value='<?php echo $settings['format_pdf_table_header_text_color'] ?>'>
|
433 |
+
</div>
|
434 |
+
<div class="pdf_two_col_block">
|
435 |
+
<?php _e( 'Table header background color', 'woo-order-export-lite' ) ?>
|
436 |
+
<input type=text class="color_pick" name="settings[format_pdf_table_header_background_color]"
|
437 |
+
value='<?php echo $settings['format_pdf_table_header_background_color'] ?>'>
|
438 |
+
</div>
|
439 |
+
|
440 |
+
<div class="pdf_two_col_block">
|
441 |
+
<?php _e( 'Table row text color', 'woo-order-export-lite' ) ?>
|
442 |
+
<input type=text class="color_pick" name="settings[format_pdf_table_row_text_color]"
|
443 |
+
value='<?php echo $settings['format_pdf_table_row_text_color'] ?>'>
|
444 |
+
</div>
|
445 |
+
<div class="pdf_two_col_block">
|
446 |
+
<?php _e( 'Table row background color', 'woo-order-export-lite' ) ?>
|
447 |
+
<input type=text class="color_pick" name="settings[format_pdf_table_row_background_color]"
|
448 |
+
value='<?php echo $settings['format_pdf_table_row_background_color'] ?>'>
|
449 |
+
</div>
|
450 |
+
|
451 |
+
<div class="pdf_two_col_block">
|
452 |
+
<?php _e( 'Page header text color', 'woo-order-export-lite' ) ?>
|
453 |
+
<input type=text class="color_pick" name="settings[format_pdf_page_header_text_color]"
|
454 |
+
value='<?php echo $settings['format_pdf_page_header_text_color'] ?>'>
|
455 |
+
</div>
|
456 |
+
<div class="pdf_two_col_block">
|
457 |
+
<?php _e( 'Page footer text color', 'woo-order-export-lite' ) ?>
|
458 |
+
<input type=text class="color_pick" name="settings[format_pdf_page_footer_text_color]"
|
459 |
+
value='<?php echo $settings['format_pdf_page_footer_text_color'] ?>'>
|
460 |
+
</div>
|
461 |
|
462 |
<hr>
|
463 |
|
464 |
<div class="pdf_two_col_block">
|
465 |
+
<input type="button" class="button button-primary image-upload-button"
|
466 |
+
value="<?php _e( 'Select logo', 'woo-order-export-lite' ) ?>">
|
467 |
+
<input type="hidden" class="source_id" name="settings[format_pdf_logo_source_id]"
|
468 |
+
value='<?php echo $settings['format_pdf_logo_source_id'] ?>'>
|
469 |
+
<input type="hidden" class="source_url" name="settings[format_pdf_logo_source]"
|
470 |
+
value='<?php echo $settings['format_pdf_logo_source'] ?>'>
|
471 |
<br>
|
472 |
+
<?php $source = $settings['format_pdf_logo_source'] ? $settings['format_pdf_logo_source'] : ''; ?>
|
473 |
+
<img src="<?php echo $source; ?>" height="100" width="100"
|
474 |
+
class="<?php echo ! $source ? 'hidden' : ''; ?>">
|
475 |
<br>
|
476 |
+
<input type="button"
|
477 |
+
class="button button-warning image-clear-button <?php echo ! $source ? 'hidden' : ''; ?>"
|
478 |
+
value="<?php _e( 'Remove logo', 'woo-order-export-lite' ) ?>">
|
479 |
</div>
|
480 |
<div class="pdf_two_col_block">
|
481 |
+
<?php _e( 'Logo align', 'woo-order-export-lite' ) ?>
|
482 |
<select name="settings[format_pdf_logo_align]">
|
483 |
+
<?php foreach ( $align_types as $align => $label ): ?>
|
484 |
+
<option value="<?php echo $align; ?>" <?php echo selected( $align == $settings['format_pdf_logo_align'] ); ?> ><?php echo $label; ?></option>
|
485 |
+
<?php endforeach; ?>
|
486 |
</select>
|
487 |
</div>
|
488 |
<div class="pdf_two_col_block">
|
489 |
+
<?php _e( 'Logo height', 'woo-order-export-lite' ) ?>
|
490 |
<br>
|
491 |
+
<input type="number" name="settings[format_pdf_logo_height]"
|
492 |
+
value='<?php echo $settings['format_pdf_logo_height'] ?>' min="0">
|
493 |
</div>
|
494 |
<div class="pdf_two_col_block">
|
495 |
+
<?php _e( 'Logo width', 'woo-order-export-lite' ) ?>
|
496 |
+
( <?php _e( '0 - auto scale', 'woo-order-export-lite' ) ?> )
|
497 |
<br>
|
498 |
+
<input type="number" name="settings[format_pdf_logo_width]"
|
499 |
+
value='<?php echo $settings['format_pdf_logo_width'] ?>' min="0">
|
500 |
+
</div>
|
501 |
+
|
502 |
+
<div class="pdf_two_col_block">
|
503 |
+
<?php _e( 'Images width', 'woo-order-export-lite' ) ?>
|
504 |
+
<br>
|
505 |
+
<input type="number" name="settings[format_pdf_row_images_width]"
|
506 |
+
value='<?php echo $settings['format_pdf_row_images_width'] ?>' min="0">
|
507 |
+
</div>
|
508 |
+
|
509 |
+
<div class="pdf_two_col_block">
|
510 |
+
<?php _e( 'Images height', 'woo-order-export-lite' ) ?>
|
511 |
+
<br>
|
512 |
+
<input type="number" name="settings[format_pdf_row_images_height]"
|
513 |
+
value='<?php echo $settings['format_pdf_row_images_height'] ?>' min="0">
|
514 |
+
</div>
|
515 |
+
|
516 |
+
</div>
|
517 |
+
|
518 |
+
<div id='HTML_options' style='display:none'><strong><?php _e( 'Html options',
|
519 |
+
'woo-order-export-lite' ) ?></strong><br>
|
520 |
+
<input type=hidden name="settings[format_html_display_column_names]" value=0>
|
521 |
+
<input type=checkbox name="settings[format_html_display_column_names]"
|
522 |
+
value=1 <?php if ( @$settings['format_html_display_column_names'] ) {
|
523 |
+
echo 'checked';
|
524 |
+
} ?> > <?php _e( 'Output column titles as first line', 'woo-order-export-lite' ) ?>
|
525 |
+
(
|
526 |
+
<input type=hidden name="settings[format_html_repeat_header_last_line]" value=0>
|
527 |
+
<input type=checkbox name="settings[format_html_repeat_header_last_line]"
|
528 |
+
value=1 <?php if ( $settings['format_html_repeat_header_last_line'] ) {
|
529 |
+
echo 'checked';
|
530 |
+
} ?> > <?php _e( 'repeat header as last line', 'woo-order-export-lite' ) ?>)
|
531 |
+
<br>
|
532 |
+
|
533 |
+
<div class="pdf_two_col_block">
|
534 |
+
<?php _e( 'Font size', 'woo-order-export-lite' ) ?><br>
|
535 |
+
<input type=number name="settings[format_html_font_size]"
|
536 |
+
value='<?php echo @$settings['format_html_font_size'] ?>' min=1 size=3><br>
|
537 |
+
</div>
|
538 |
+
|
539 |
+
<div class="pdf_two_col_block">
|
540 |
+
<?php _e( 'Columns align', 'woo-order-export-lite' ) ?>
|
541 |
+
<input title="<?php _e( 'comma separated list', 'woo-order-export-lite' ) ?>" type=text name="settings[format_html_cols_align]" value='<?php echo $settings['format_html_cols_align'] ?>'>
|
542 |
+
</div>
|
543 |
+
|
544 |
+
<div class="pdf_two_col_block">
|
545 |
+
<?php _e( 'Header text', 'woo-order-export-lite' ) ?><br>
|
546 |
+
<textarea type=text name="settings[format_html_header_text]"><?php echo $settings['format_html_header_text'] ?></textarea>
|
547 |
+
</div>
|
548 |
+
|
549 |
+
<div class="pdf_two_col_block">
|
550 |
+
<?php _e( 'Footer text', 'woo-order-export-lite' ) ?><br>
|
551 |
+
<textarea type=text name="settings[format_html_footer_text]"><?php echo $settings['format_html_footer_text'] ?></textarea>
|
552 |
+
</div>
|
553 |
+
|
554 |
+
<div class="pdf_two_col_block">
|
555 |
+
<?php _e( 'Table header text color', 'woo-order-export-lite' ) ?>
|
556 |
+
<input type=text class="color_pick" name="settings[format_html_table_header_text_color]"
|
557 |
+
value='<?php echo $settings['format_html_table_header_text_color'] ?>'>
|
558 |
+
</div>
|
559 |
+
<div class="pdf_two_col_block">
|
560 |
+
<?php _e( 'Table header background color', 'woo-order-export-lite' ) ?>
|
561 |
+
<input type=text class="color_pick" name="settings[format_html_table_header_background_color]"
|
562 |
+
value='<?php echo $settings['format_html_table_header_background_color'] ?>'>
|
563 |
+
</div>
|
564 |
+
|
565 |
+
<div class="pdf_two_col_block">
|
566 |
+
<?php _e( 'Table row text color', 'woo-order-export-lite' ) ?>
|
567 |
+
<input type=text class="color_pick" name="settings[format_html_table_row_text_color]"
|
568 |
+
value='<?php echo $settings['format_html_table_row_text_color'] ?>'>
|
569 |
+
</div>
|
570 |
+
<div class="pdf_two_col_block">
|
571 |
+
<?php _e( 'Table row background color', 'woo-order-export-lite' ) ?>
|
572 |
+
<input type=text class="color_pick" name="settings[format_html_table_row_background_color]"
|
573 |
+
value='<?php echo $settings['format_html_table_row_background_color'] ?>'>
|
574 |
+
</div>
|
575 |
+
|
576 |
+
<div class="pdf_two_col_block">
|
577 |
+
<?php _e( 'Header text color', 'woo-order-export-lite' ) ?>
|
578 |
+
<input type=text class="color_pick" name="settings[format_html_header_text_color]"
|
579 |
+
value='<?php echo $settings['format_html_header_text_color'] ?>'>
|
580 |
+
</div>
|
581 |
+
<div class="pdf_two_col_block">
|
582 |
+
<?php _e( 'Footer text color', 'woo-order-export-lite' ) ?>
|
583 |
+
<input type=text class="color_pick" name="settings[format_html_footer_text_color]"
|
584 |
+
value='<?php echo $settings['format_html_footer_text_color'] ?>'>
|
585 |
+
</div>
|
586 |
+
<br/>
|
587 |
+
<div>
|
588 |
+
|
589 |
+
</div>
|
590 |
+
<div>
|
591 |
+
<?php _e( 'Custom css', 'woo-order-export-lite' ) ?><br>
|
592 |
+
<textarea style="width: 100%" type=text name="settings[format_html_custom_css]"><?php echo $settings['format_html_custom_css'] ?></textarea>
|
593 |
+
<div><i><?php _e( "This option cancels UI settings(above) and don't applied to Preview", 'woo-order-export-lite' ) ?></i></div>
|
594 |
+
</div>
|
595 |
</div>
|
596 |
|
597 |
</div>
|
651 |
</div>
|
652 |
</div>
|
653 |
</div>
|
654 |
+
|
655 |
<br/>
|
656 |
<div id="my-sort" class="my-block">
|
657 |
<?php
|
659 |
'order_id' => __( 'Order ID', 'woo-order-export-lite' ),
|
660 |
'post_date' => __( 'Order Date', 'woo-order-export-lite' ),
|
661 |
'post_modified' => __( 'Modification Date', 'woo-order-export-lite' ),
|
662 |
+
'post_status' => __( 'Order status', 'woo-order-export-lite' ),
|
663 |
);
|
664 |
+
foreach ( WC_Order_Export_Data_Extractor_UI::get_order_custom_fields() as $field ) {
|
665 |
+
$sort[$field] = $field;
|
666 |
+
}
|
667 |
+
|
668 |
ob_start();
|
669 |
?>
|
670 |
<select name="settings[sort]">
|
760 |
<?php _e( 'Please check permissions for your role. You must have capability “edit_themes” to use this box.',
|
761 |
'woo-order-export-lite' ); ?>
|
762 |
</strong>
|
763 |
+
<?php echo sprintf( '<a href="%s" target=_blank>%s</a>',
|
764 |
+
"https://algolplus.freshdesk.com/support/solutions/articles/25000018208-grey-textarea-for-custom-code-in-section-misc-settings-",
|
765 |
+
__( 'Read how to fix it','woo-order-export-lite' )
|
766 |
+
); ?>
|
767 |
+
|
768 |
<?php endif; ?>
|
769 |
<textarea placeholder="<?php _e( 'Use only unnamed functions!', 'woo-order-export-lite' ) ?>"
|
770 |
name="settings[custom_php_code]" <?php echo $readonly_php ?> class="width-100"
|
776 |
</div>
|
777 |
|
778 |
<div id="my-right" style="float: left; width: 48%; margin: 0px 10px; max-width: 500px;">
|
779 |
+
<?php do_action( 'woe_settings_form_view_destinations', $settings ); ?>
|
|
|
|
|
|
|
|
|
|
|
780 |
<div class="my-block">
|
781 |
<span class="my-hide-next "><?php _e( 'Filter by order', 'woo-order-export-lite' ) ?>
|
782 |
<span class="ui-icon ui-icon-triangle-1-s my-icon-triangle"></span></span>
|
798 |
value="1" <?php checked( $settings['export_unmarked_orders'] ) ?> /> <?php _e( "Export unmarked orders only",
|
799 |
'woo-order-export-lite' ) ?></label></div>
|
800 |
<span class="wc-oe-header"><?php _e( 'Order statuses', 'woo-order-export-lite' ) ?></span>
|
801 |
+
<select id="statuses" class="select2-i18n" name="settings[statuses][]" multiple="multiple"
|
802 |
style="width: 100%; max-width: 25%;">
|
803 |
<?php foreach (
|
804 |
apply_filters( 'woe_settings_order_statuses', wc_get_order_statuses() ) as $i => $status
|
811 |
|
812 |
<span class="wc-oe-header"><?php _e( 'Custom fields', 'woo-order-export-lite' ) ?></span>
|
813 |
<br>
|
814 |
+
<select id="custom_fields" class="select2-i18n" data-select2-i18n-width="150" style="width: auto;">
|
815 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_order_custom_fields() as $cf_name ) { ?>
|
816 |
<option><?php echo $cf_name; ?></option>
|
817 |
<?php } ?>
|
834 |
<button id="add_custom_fields" class="button-secondary"><span
|
835 |
class="dashicons dashicons-plus-alt"></span></button>
|
836 |
<br>
|
837 |
+
<select id="custom_fields_check" class="select2-i18n" multiple name="settings[order_custom_fields][]"
|
838 |
style="width: 100%; max-width: 25%;">
|
839 |
<?php
|
840 |
if ( $settings['order_custom_fields'] ) {
|
866 |
value="1" <?php checked( $settings['skip_refunded_items'] ) ?> /> <?php _e( 'Skip fully refunded items',
|
867 |
'woo-order-export-lite' ) ?></label></div>
|
868 |
<span class="wc-oe-header"><?php _e( 'Product categories', 'woo-order-export-lite' ) ?></span>
|
869 |
+
<select id="product_categories" class="select2-i18n" data-select2-i18n-ajax-method="get_categories"
|
870 |
+
name="settings[product_categories][]" multiple="multiple"
|
871 |
style="width: 100%; max-width: 25%;">
|
872 |
<?php
|
873 |
if ( $settings['product_categories'] ) {
|
884 |
} ?>
|
885 |
</select>
|
886 |
<span class="wc-oe-header"><?php _e( 'Vendor/creator', 'woo-order-export-lite' ) ?></span>
|
887 |
+
<select id="product_vendors" class="select2-i18n" data-select2-i18n-ajax-method="get_vendors"
|
888 |
+
name="settings[product_vendors][]" multiple="multiple"
|
889 |
style="width: 100%; max-width: 25%;">
|
890 |
<?php
|
891 |
if ( $settings['product_vendors'] ) {
|
901 |
|
902 |
<span class="wc-oe-header"><?php _e( 'Product', 'woo-order-export-lite' ) ?></span>
|
903 |
|
904 |
+
<select id="products" class="select2-i18n" data-select2-i18n-ajax-method="get_products"
|
905 |
+
name="settings[products][]" multiple="multiple"
|
906 |
style="width: 100%; max-width: 25%;">
|
907 |
<?php
|
908 |
if ( $settings['products'] ) {
|
916 |
|
917 |
<span class="wc-oe-header"><?php _e( 'Product taxonomies', 'woo-order-export-lite' ) ?></span>
|
918 |
<br>
|
919 |
+
<select id="taxonomies" class="select2-i18n" data-select2-i18n-width="150" style="width: auto;">
|
920 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_product_taxonomies() as $attr_id => $attr_name ) { ?>
|
921 |
<option><?php echo $attr_name; ?></option>
|
922 |
<?php } ?>
|
925 |
<select id="taxonomies_compare" class="select_compare">
|
926 |
<option>=</option>
|
927 |
<option><></option>
|
928 |
+
<option>NOT SET</option>
|
929 |
+
<option>IS SET</option>
|
930 |
</select>
|
931 |
|
932 |
<input type="text" id="text_taxonomies" disabled style="display: none;">
|
934 |
<button id="add_taxonomies" class="button-secondary"><span class="dashicons dashicons-plus-alt"></span>
|
935 |
</button>
|
936 |
<br>
|
937 |
+
<select id="taxonomies_check" class="select2-i18n" data-select2-i18n-default="1" multiple
|
938 |
+
name="settings[product_taxonomies][]"
|
939 |
style="width: 100%; max-width: 25%;">
|
940 |
<?php
|
941 |
if ( $settings['product_taxonomies'] ) {
|
948 |
|
949 |
<span class="wc-oe-header"><?php _e( 'Product custom fields', 'woo-order-export-lite' ) ?></span>
|
950 |
<br>
|
951 |
+
<select id="product_custom_fields" class="select2-i18n" data-select2-i18n-width="150"
|
952 |
+
style="width: auto;">
|
953 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_product_custom_fields() as $cf_name ) { ?>
|
954 |
<option><?php echo $cf_name; ?></option>
|
955 |
<?php } ?>
|
963 |
<option>>=</option>
|
964 |
<option><</option>
|
965 |
<option><=</option>
|
966 |
+
<option>NOT SET</option>
|
967 |
+
<option>IS SET</option>
|
968 |
</select>
|
969 |
|
970 |
<input type="text" id="text_product_custom_fields" disabled class="like-input" style="display: none;">
|
972 |
<button id="add_product_custom_fields" class="button-secondary"><span
|
973 |
class="dashicons dashicons-plus-alt"></span></button>
|
974 |
<br>
|
975 |
+
<select id="product_custom_fields_check" class="select2-i18n" data-select2-i18n-default="1" multiple
|
976 |
+
name="settings[product_custom_fields][]"
|
977 |
style="width: 100%; max-width: 25%;">
|
978 |
<?php
|
979 |
if ( $settings['product_custom_fields'] ) {
|
987 |
<span class="wc-oe-header"><?php _e( 'Variable product attributes',
|
988 |
'woo-order-export-lite' ) ?></span>
|
989 |
<br>
|
990 |
+
<select id="attributes" class="select2-i18n" data-select2-i18n-width="150" style="width: auto;">
|
991 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_product_attributes() as $attr_id => $attr_name ) { ?>
|
992 |
<option><?php echo $attr_name; ?></option>
|
993 |
<?php } ?>
|
1004 |
<button id="add_attributes" class="button-secondary"><span class="dashicons dashicons-plus-alt"></span>
|
1005 |
</button>
|
1006 |
<br>
|
1007 |
+
<select id="attributes_check" class="select2-i18n" data-select2-i18n-default="1" multiple
|
1008 |
+
name="settings[product_attributes][]"
|
1009 |
style="width: 100%; max-width: 25%;">
|
1010 |
<?php
|
1011 |
if ( $settings['product_attributes'] ) {
|
1018 |
|
1019 |
<span class="wc-oe-header"><?php _e( 'Item meta data', 'woo-order-export-lite' ) ?></span>
|
1020 |
<br>
|
1021 |
+
<select id="itemmeta" class="select2-i18n" data-select2-i18n-width="220" style="width: auto;">
|
1022 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_product_itemmeta() as $attr_name ) { ?>
|
1023 |
<option data-base64="<?php echo base64_encode( $attr_name ); ?>"><?php echo $attr_name; ?></option>
|
1024 |
<?php } ?>
|
1039 |
<button id="add_itemmeta" class="button-secondary"><span class="dashicons dashicons-plus-alt"></span>
|
1040 |
</button>
|
1041 |
<br>
|
1042 |
+
<select id="itemmeta_check" class="select2-i18n" data-select2-i18n-default="1" multiple
|
1043 |
+
name="settings[product_itemmeta][]"
|
1044 |
style="width: 100%; max-width: 25%;">
|
1045 |
<?php
|
1046 |
if ( $settings['product_itemmeta'] ) {
|
1062 |
<div id="my-users" hidden="hidden">
|
1063 |
|
1064 |
<span class="wc-oe-header"><?php _e( 'Usernames', 'woo-order-export-lite' ) ?></span>
|
1065 |
+
<select id="user_names" class="select2-i18n" data-select2-i18n-ajax-method="get_users"
|
1066 |
+
name="settings[user_names][]" multiple="multiple"
|
1067 |
style="width: 100%; max-width: 25%;">
|
1068 |
<?php
|
1069 |
if ( $settings['user_names'] ) {
|
1076 |
</select>
|
1077 |
|
1078 |
<span class="wc-oe-header"><?php _e( 'User roles', 'woo-order-export-lite' ) ?></span>
|
1079 |
+
<select id="user_roles" class="select2-i18n" name="settings[user_roles][]" multiple="multiple"
|
1080 |
style="width: 100%; max-width: 25%;">
|
1081 |
<?php
|
1082 |
global $wp_roles;
|
1088 |
|
1089 |
<span class="wc-oe-header"><?php _e( 'Custom fields', 'woo-order-export-lite' ) ?></span>
|
1090 |
<br>
|
1091 |
+
<select id="user_custom_fields" class="select2-i18n" data-select2-i18n-width="150" style="width: auto;">
|
1092 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_user_custom_fields() as $cf_name ) { ?>
|
1093 |
<option><?php echo $cf_name; ?></option>
|
1094 |
<?php } ?>
|
1110 |
<button id="add_user_custom_fields" class="button-secondary"><span
|
1111 |
class="dashicons dashicons-plus-alt"></span></button>
|
1112 |
<br>
|
1113 |
+
<select id="user_custom_fields_check" class="select2-i18n" multiple
|
1114 |
+
name="settings[user_custom_fields][]"
|
1115 |
style="width: 100%; max-width: 25%;">
|
1116 |
<?php
|
1117 |
if ( ! empty( $settings['user_custom_fields'] ) ) {
|
1137 |
'woo-order-export-lite' ) ?></label>
|
1138 |
</div>
|
1139 |
<span class="wc-oe-header"><?php _e( 'Coupons', 'woo-order-export-lite' ) ?></span>
|
1140 |
+
<select id="coupons" class="select2-i18n" data-select2-i18n-ajax-method="get_coupons"
|
1141 |
+
name="settings[coupons][]" multiple="multiple"
|
1142 |
style="width: 100%; max-width: 25%;">
|
1143 |
<?php
|
1144 |
if ( $settings['coupons'] ) {
|
1159 |
<div id="my-billing" hidden="hidden">
|
1160 |
<span class="wc-oe-header"><?php _e( 'Billing locations', 'woo-order-export-lite' ) ?></span>
|
1161 |
<br>
|
1162 |
+
<select id="billing_locations" class="select2-i18n" data-select2-i18n-width="150">
|
1163 |
<option>City</option>
|
1164 |
<option>State</option>
|
1165 |
<option>Postcode</option>
|
1173 |
<button id="add_billing_locations" class="button-secondary"><span
|
1174 |
class="dashicons dashicons-plus-alt"></span></button>
|
1175 |
<br>
|
1176 |
+
<select id="billing_locations_check" class="select2-i18n" data-select2-i18n-default="1" multiple
|
1177 |
+
name="settings[billing_locations][]"
|
1178 |
style="width: 100%; max-width: 25%;">
|
1179 |
<?php
|
1180 |
if ( $settings['billing_locations'] ) {
|
1186 |
</select>
|
1187 |
|
1188 |
<span class="wc-oe-header"><?php _e( 'Payment methods', 'woo-order-export-lite' ) ?></span>
|
1189 |
+
<select id="payment_methods" class="select2-i18n" name="settings[payment_methods][]" multiple="multiple"
|
1190 |
style="width: 100%; max-width: 25%;">
|
1191 |
<?php foreach ( WC()->payment_gateways->payment_gateways() as $gateway ) { ?>
|
1192 |
<option value="<?php echo $gateway->id ?>" <?php if ( in_array( $gateway->id,
|
1206 |
<div id="my-shipping" hidden="hidden">
|
1207 |
<span class="wc-oe-header"><?php _e( 'Shipping locations', 'woo-order-export-lite' ) ?></span>
|
1208 |
<br>
|
1209 |
+
<select id="shipping_locations" class="select2-i18n" data-select2-i18n-width="150">
|
1210 |
<option>City</option>
|
1211 |
<option>State</option>
|
1212 |
<option>Postcode</option>
|
1220 |
<button id="add_shipping_locations" class="button-secondary"><span
|
1221 |
class="dashicons dashicons-plus-alt"></span></button>
|
1222 |
<br>
|
1223 |
+
<select id="shipping_locations_check" class="select2-i18n" data-select2-i18n-default="1" multiple
|
1224 |
+
name="settings[shipping_locations][]"
|
1225 |
style="width: 100%; max-width: 25%;">
|
1226 |
<?php
|
1227 |
if ( $settings['shipping_locations'] ) {
|
1233 |
</select>
|
1234 |
|
1235 |
<span class="wc-oe-header"><?php _e( 'Shipping methods', 'woo-order-export-lite' ) ?></span>
|
1236 |
+
<select id="shipping_methods" class="select2-i18n" name="settings[shipping_methods][]"
|
1237 |
+
multiple="multiple"
|
1238 |
style="width: 100%; max-width: 25%;">
|
1239 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_shipping_methods() as $i => $title ) { ?>
|
1240 |
<option value="<?php echo $i ?>" <?php if ( in_array( $i, $settings['shipping_methods'] ) ) {
|
1253 |
<div id="my-items-meta" hidden="hidden">
|
1254 |
<span class="wc-oe-header"><?php _e( 'Item names', 'woo-order-export-lite' ) ?></span>
|
1255 |
<br>
|
1256 |
+
<select id="item_names" class="select2-i18n" data-select2-i18n-width="150">
|
1257 |
<option>coupon</option>
|
1258 |
<option>fee</option>
|
1259 |
<option>line_item</option>
|
1263 |
<select id="item_name_compare" class="select_compare">
|
1264 |
<option>=</option>
|
1265 |
<option><></option>
|
1266 |
+
<option>LIKE</option>
|
1267 |
</select>
|
1268 |
+
<input type="text" id="text_order_item_name" disabled class="like-input" style="display: none;">
|
1269 |
<button id="add_item_names" class="button-secondary"><span class="dashicons dashicons-plus-alt"></span>
|
1270 |
</button>
|
1271 |
<br>
|
1272 |
+
<select id="item_names_check" class="select2-i18n" data-select2-i18n-default="1" multiple
|
1273 |
+
name="settings[item_names][]"
|
1274 |
style="width: 100%; max-width: 25%;">
|
1275 |
<?php
|
1276 |
if ( $settings['item_names'] ) {
|
1283 |
|
1284 |
<span class="wc-oe-header"><?php _e( 'Item metadata', 'woo-order-export-lite' ) ?></span>
|
1285 |
<br>
|
1286 |
+
<select id="item_metadata" class="select2-i18n" data-select2-i18n-width="150">
|
1287 |
<?php foreach ( WC_Order_Export_Data_Extractor_UI::get_item_meta_keys() as $type => $meta_keys ) { ?>
|
1288 |
<optgroup label="<?php echo ucwords( $type ); ?>">
|
1289 |
<?php foreach ( $meta_keys as $item_meta_key ) { ?>
|
1295 |
<select id="item_metadata_compare" class="select_compare">
|
1296 |
<option>=</option>
|
1297 |
<option><></option>
|
1298 |
+
<option>LIKE</option>
|
1299 |
</select>
|
1300 |
+
<input type="text" id="text_order_itemmetadata" disabled class="like-input" style="display: none;">
|
1301 |
<button id="add_item_metadata" class="button-secondary"><span
|
1302 |
class="dashicons dashicons-plus-alt"></span></button>
|
1303 |
<br>
|
1304 |
+
<select id="item_metadata_check" class="select2-i18n" data-select2-i18n-default="1" multiple
|
1305 |
+
name="settings[item_metadata][]"
|
1306 |
style="width: 100%; max-width: 25%;">
|
1307 |
<?php
|
1308 |
if ( $settings['item_metadata'] ) {
|
1332 |
<br class="clear"/>
|
1333 |
</div>
|
1334 |
<div id='fields' style='display:none;'>
|
1335 |
+
|
1336 |
+
<div class="summary-products-mode-tip">
|
1337 |
+
<?php _e( 'Turn off mode Summary report to export order fields', 'woo-order-export-lite' ) ?>
|
1338 |
+
</div>
|
1339 |
<div class="fields-control-block"></div>
|
1340 |
<br>
|
1341 |
<div class="fields-control">
|
1385 |
</div>
|
1386 |
<div class="tab-actions-forms">
|
1387 |
<div class='div_meta segment-form all-segments'>
|
1388 |
+
<div class='add_form_tip'><?php _e( "The plugin fetches meta keys from the existing orders. So you should create fake order if you've added new field just now.", 'woo-order-export-lite' )?></div>
|
1389 |
<label for="select_custom_meta_order">
|
1390 |
<?php _e( 'Meta key', 'woo-order-export-lite' ) ?>:
|
1391 |
</label><br/>
|
1392 |
<select id='select_custom_meta_order'>
|
1393 |
<?php
|
1394 |
+
foreach ( $order_custom_meta_fields['order'] as $meta_id => $meta_name ) {
|
1395 |
echo "<option value='$meta_name' >$meta_name</option>";
|
1396 |
};
|
1397 |
?>
|
1442 |
'woo-order-export-lite' ) ?></button>
|
1443 |
</div>
|
1444 |
</div>
|
1445 |
+
<div class='div_meta segment-form user-segment user-add-field'>
|
1446 |
+
<label for="select_custom_meta_user">
|
1447 |
+
<?php _e( 'Meta key', 'woo-order-export-lite' ) ?>:
|
1448 |
+
</label><br/>
|
1449 |
+
<select id='select_custom_meta_user'>
|
1450 |
+
<?php
|
1451 |
+
foreach ( $order_custom_meta_fields['user'] as $meta_id => $meta_name ) {
|
1452 |
+
echo "<option value='$meta_name' >$meta_name</option>";
|
1453 |
+
};
|
1454 |
+
?>
|
1455 |
+
</select>
|
1456 |
+
<div id="custom_meta_order_mode" style="margin-bottom: 10px;">
|
1457 |
+
<input style="width: 80%;" type='text' id='text_custom_meta_order'
|
1458 |
+
placeholder="<?php _e( 'or type meta key here',
|
1459 |
+
'woo-order-export-lite' ) ?>"/><br>
|
1460 |
+
</div>
|
1461 |
+
<div style="margin-bottom: 8px;">
|
1462 |
+
<input id="custom_meta_order_mode_used" type="checkbox"
|
1463 |
+
name="custom_meta_order_mode" value="used"> <?php _e( 'Hide unused fields',
|
1464 |
+
'woo-order-export-lite' ) ?>
|
1465 |
+
</div>
|
1466 |
+
<hr>
|
1467 |
+
<div style="margin-top: 20px;"><label for="colname_custom_meta"><?php _e( 'Column name',
|
1468 |
+
'woo-order-export-lite' ) ?>:</label><input type='text'
|
1469 |
+
id='colname_custom_meta'/>
|
1470 |
</div>
|
1471 |
+
<div style="margin-top: 20px;">
|
1472 |
+
<?php echo print_formats_field( 'meta' ); ?>
|
1473 |
+
</div>
|
1474 |
+
<div style="text-align: right;">
|
1475 |
+
<button id='button_custom_meta' class='button-secondary'><?php _e( 'Confirm',
|
1476 |
+
'woo-order-export-lite' ) ?></button>
|
1477 |
+
<button class='button-secondary button-cancel'><?php _e( 'Cancel',
|
1478 |
+
'woo-order-export-lite' ) ?></button>
|
1479 |
+
</div>
|
1480 |
+
</div>
|
1481 |
+
<div class='div_meta products-segment segment-form products-add-field'>
|
1482 |
+
<div class='add_form_tip'><?php _e( "The plugin fetches meta keys from the existing orders. So you should create fake order if you've added new field just now.", 'woo-order-export-lite' )?></div>
|
1483 |
<label for="select_custom_meta_products"><?php _e( 'Product fields',
|
1484 |
'woo-order-export-lite' ) ?>:</label><select
|
1485 |
id='select_custom_meta_products'></select>
|
1490 |
<label> </label><input style="width: 80%;" type='text'
|
1491 |
id='text_custom_meta_order_items'
|
1492 |
placeholder="<?php _e( 'or type meta key here',
|
1493 |
+
'woo-order-export-lite' ) ?>"/>
|
1494 |
+
<div id="custom_meta_products_mode">
|
1495 |
+
<label><input id="custom_meta_products_mode_used" type="checkbox"
|
1496 |
+
name="custom_meta_products_mode"
|
1497 |
+
value="used"> <?php _e( 'Hide unused fields',
|
1498 |
+
'woo-order-export-lite' ) ?></label>
|
1499 |
+
</div>
|
1500 |
<div style="width: 80%; text-align: center;"><?php _e( 'OR',
|
1501 |
'woo-order-export-lite' ) ?></div>
|
1502 |
<label><?php _e( 'Taxonomy', 'woo-order-export-lite' ) ?>:</label><select
|
1549 |
<div id="custom_meta_coupons_mode" style="display: none;">
|
1550 |
<input id="custom_meta_coupons_mode" type="checkbox"
|
1551 |
name="custom_meta_coupons_mode" value="used"> <?php _e( 'Hide unused fields',
|
1552 |
+
'woo-order-export-lite' ) ?>
|
1553 |
</div>
|
1554 |
<br>
|
1555 |
<select id='select_custom_meta_coupons'></select>
|
1644 |
value="<?php _e( 'Export [w/o progressbar]', 'woo-order-export-lite' ) ?>"
|
1645 |
title="<?php _e( 'It might not work for huge datasets!', 'woo-order-export-lite' ) ?>"/>
|
1646 |
<?php } ?>
|
1647 |
+
|
1648 |
+
<?php do_action( 'woe_settings_form_view_save_as_profile', $settings ) ?>
|
1649 |
+
|
|
|
|
|
1650 |
<?php if ( $mode === WC_Order_Export_Manage::EXPORT_NOW ): ?>
|
1651 |
<input type="submit" id='reset-profile' class="button-secondary"
|
1652 |
value="<?php _e( 'Reset settings', 'woo-order-export-lite' ) ?>"/>
|
1653 |
<?php endif; ?>
|
1654 |
+
|
1655 |
<span id="preview_actions" class="hide">
|
1656 |
<strong id="output_preview_total"><?php echo sprintf( __( 'Export total: %s orders',
|
1657 |
'woo-order-export-lite' ), '<span></span>' ) ?></strong>
|
1686 |
<form id='export_wo_pb_form' method='post' target='export_wo_pb_window'>
|
1687 |
<input name="action" type="hidden" value="order_exporter">
|
1688 |
<input name="method" type="hidden" value="plain_export">
|
1689 |
+
<input name="tab" type="hidden" value="<?php echo $active_tab ?>">
|
1690 |
+
<?php wp_nonce_field( 'woe_nonce', 'woe_nonce' ); ?>
|
1691 |
<input name="mode" type="hidden" value="<?php echo $mode ?>">
|
1692 |
<input name="id" type="hidden" value="<?php echo $id ?>">
|
1693 |
<input name="json" type="hidden">
|
view/tab/export.php
CHANGED
@@ -11,15 +11,12 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
11 |
'date_filter' => true,
|
12 |
'export_button' => true,
|
13 |
'export_button_plain' => true,
|
14 |
-
'destinations' => false,
|
15 |
-
'schedule' => false,
|
16 |
);
|
17 |
-
$
|
18 |
-
'mode'
|
19 |
-
'id'
|
20 |
-
'
|
21 |
-
'
|
22 |
-
'show' => $show,
|
23 |
) );
|
24 |
?>
|
25 |
</div>
|
11 |
'date_filter' => true,
|
12 |
'export_button' => true,
|
13 |
'export_button_plain' => true,
|
|
|
|
|
14 |
);
|
15 |
+
$tab->render_template( 'settings-form', array(
|
16 |
+
'mode' => WC_Order_Export_Manage::EXPORT_NOW,
|
17 |
+
'id' => 0,
|
18 |
+
'ajaxurl' => $ajaxurl,
|
19 |
+
'show' => $show,
|
|
|
20 |
) );
|
21 |
?>
|
22 |
</div>
|
view/tab/order-actions.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
-
if ( !defined( 'ABSPATH' ) ) {
|
3 |
exit; // Exit if accessed directly
|
4 |
}
|
5 |
-
$pro_link = '<a href="https://algolplus.com/plugins/downloads/advanced-order-export-for-woocommerce-pro/" target=_blank>'
|
6 |
?>
|
7 |
-
<div class="tabs-content"
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
exit; // Exit if accessed directly
|
4 |
}
|
5 |
+
$pro_link = '<a href="https://algolplus.com/plugins/downloads/advanced-order-export-for-woocommerce-pro/" target=_blank>' . __( 'Pro version', 'woo-order-export-lite' ) . '</a>';
|
6 |
?>
|
7 |
+
<div class="tabs-content"><?php echo sprintf( __( 'Buy %s to get access to Status change jobs', 'woo-order-export-lite' ), $pro_link ) ?></div>
|
view/tab/profiles.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
-
if ( !defined( 'ABSPATH' ) ) {
|
3 |
exit; // Exit if accessed directly
|
4 |
}
|
5 |
-
$pro_link = '<a href="https://algolplus.com/plugins/downloads/advanced-order-export-for-woocommerce-pro/" target=_blank>'
|
6 |
?>
|
7 |
-
<div class="tabs-content"
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
exit; // Exit if accessed directly
|
4 |
}
|
5 |
+
$pro_link = '<a href="https://algolplus.com/plugins/downloads/advanced-order-export-for-woocommerce-pro/" target=_blank>' . __( 'Pro version', 'woo-order-export-lite' ) . '</a>';
|
6 |
?>
|
7 |
+
<div class="tabs-content"><?php echo sprintf( __( 'Buy %s to get access to profiles', 'woo-order-export-lite' ), $pro_link ) ?></div>
|
view/tab/schedules.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
-
if ( !defined( 'ABSPATH' ) ) {
|
3 |
exit; // Exit if accessed directly
|
4 |
}
|
5 |
-
$pro_link = '<a href="https://algolplus.com/plugins/downloads/advanced-order-export-for-woocommerce-pro/" target=_blank>'
|
6 |
?>
|
7 |
-
<div class="tabs-content"
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
exit; // Exit if accessed directly
|
4 |
}
|
5 |
+
$pro_link = '<a href="https://algolplus.com/plugins/downloads/advanced-order-export-for-woocommerce-pro/" target=_blank>' . __( 'Pro version', 'woo-order-export-lite' ) . '</a>';
|
6 |
?>
|
7 |
+
<div class="tabs-content"><?php echo sprintf( __( 'Buy %s to get access to Scheduled jobs', 'woo-order-export-lite' ), $pro_link ) ?></div>
|
view/tab/tools.php
CHANGED
@@ -18,16 +18,12 @@ foreach ( $modes as $mode ) {
|
|
18 |
$settings_export[ $mode ] = WC_Order_Export_Manage::get( $mode );
|
19 |
}
|
20 |
|
21 |
-
$type_labels =
|
22 |
-
WC_Order_Export_Manage::EXPORT_PROFILE => __( 'Profiles', 'woo-order-export-lite' ),
|
23 |
-
WC_Order_Export_Manage::EXPORT_ORDER_ACTION => __( 'Status change jobs', 'woo-order-export-lite' ),
|
24 |
-
WC_Order_Export_Manage::EXPORT_SCHEDULE => __( 'Scheduled jobs', 'woo-order-export-lite' ),
|
25 |
-
);
|
26 |
?>
|
27 |
<div class="clearfix"></div>
|
28 |
<div id="woe-admin" class="container-fluid wpcontent">
|
29 |
<form>
|
30 |
-
|
31 |
<div class="woe-tab" id="woe-tab-general">
|
32 |
<div class="woe-box woe-box-main">
|
33 |
<h3 class="woe-box-title"><?php _e( 'Export settings', 'woo-order-export-lite' ) ?></h3>
|
@@ -78,13 +74,17 @@ $type_labels = ! $WC_Order_Export::is_full_version() ? array() : array(
|
|
78 |
</div>
|
79 |
<div class="row">
|
80 |
<div class="col-sm-2 form-group col-md-offset-7">
|
|
|
|
|
|
|
|
|
81 |
<input disabled type="submit" class="woe-btn-tools"
|
82 |
value="<?php _e( 'Import', 'woo-order-export-lite' ) ?>" name="woe-tools-import"
|
83 |
id="submit-import">
|
84 |
|
85 |
<div id=Settings_updated
|
86 |
-
|
87 |
-
|
88 |
</div>
|
89 |
</div>
|
90 |
</div>
|
@@ -94,6 +94,20 @@ $type_labels = ! $WC_Order_Export::is_full_version() ? array() : array(
|
|
94 |
|
95 |
<script>
|
96 |
jQuery( function ( $ ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
jQuery( '#wpbody .tools-textarea' ).click( function () {
|
98 |
jQuery( this ).select();
|
99 |
} );
|
@@ -107,16 +121,24 @@ $type_labels = ! $WC_Order_Export::is_full_version() ? array() : array(
|
|
107 |
} );
|
108 |
|
109 |
jQuery( '#submit-import' ).on( 'click', function ( e ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
if ( ! confirm( '<?php esc_attr_e( 'Are you sure to continue?', 'woo-order-export-lite' ) ?>' ) ) {
|
111 |
e.preventDefault();
|
112 |
$( document.activeElement ).blur();
|
113 |
} else {
|
114 |
-
|
115 |
var data = $( '#woe-admin form' ).serialize();
|
116 |
-
data = data + "&action=order_exporter&method=save_tools";
|
117 |
$.post( ajaxurl, data, function ( response ) {
|
118 |
-
|
119 |
-
|
120 |
}, "json" );
|
121 |
return false;
|
122 |
}
|
18 |
$settings_export[ $mode ] = WC_Order_Export_Manage::get( $mode );
|
19 |
}
|
20 |
|
21 |
+
$type_labels = apply_filters( 'woe_tools_page_get_type_labels', array() );
|
|
|
|
|
|
|
|
|
22 |
?>
|
23 |
<div class="clearfix"></div>
|
24 |
<div id="woe-admin" class="container-fluid wpcontent">
|
25 |
<form>
|
26 |
+
<?php wp_nonce_field( 'woe_nonce', 'woe_nonce' ); ?>
|
27 |
<div class="woe-tab" id="woe-tab-general">
|
28 |
<div class="woe-box woe-box-main">
|
29 |
<h3 class="woe-box-title"><?php _e( 'Export settings', 'woo-order-export-lite' ) ?></h3>
|
74 |
</div>
|
75 |
<div class="row">
|
76 |
<div class="col-sm-2 form-group col-md-offset-7">
|
77 |
+
<div id="import-error" style='display:none;color:red;font-size: 120%;padding-bottom: 10px;'>
|
78 |
+
<label class="error-message"></label>
|
79 |
+
</div>
|
80 |
+
|
81 |
<input disabled type="submit" class="woe-btn-tools"
|
82 |
value="<?php _e( 'Import', 'woo-order-export-lite' ) ?>" name="woe-tools-import"
|
83 |
id="submit-import">
|
84 |
|
85 |
<div id=Settings_updated
|
86 |
+
style='display:none;color:green;font-size: 120%;padding-bottom: 10px;'><?php _e( "Settings were successfully updated!",
|
87 |
+
'woo-order-export-lite' ) ?></div>
|
88 |
</div>
|
89 |
</div>
|
90 |
</div>
|
94 |
|
95 |
<script>
|
96 |
jQuery( function ( $ ) {
|
97 |
+
function showError($e) {
|
98 |
+
var message = '';
|
99 |
+
if ( $e instanceof Error) {
|
100 |
+
message = $e.message;
|
101 |
+
} else if ( $e instanceof String) {
|
102 |
+
message = $e;
|
103 |
+
} else {
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
$('#import-error .error-message').text(message);
|
108 |
+
$('#import-error').show().delay( 5000 ).fadeOut();
|
109 |
+
}
|
110 |
+
|
111 |
jQuery( '#wpbody .tools-textarea' ).click( function () {
|
112 |
jQuery( this ).select();
|
113 |
} );
|
121 |
} );
|
122 |
|
123 |
jQuery( '#submit-import' ).on( 'click', function ( e ) {
|
124 |
+
try {
|
125 |
+
JSON.parse($('#tools-import-text').val());
|
126 |
+
} catch ($e) {
|
127 |
+
showError($e);
|
128 |
+
e.preventDefault();
|
129 |
+
return;
|
130 |
+
}
|
131 |
+
|
132 |
if ( ! confirm( '<?php esc_attr_e( 'Are you sure to continue?', 'woo-order-export-lite' ) ?>' ) ) {
|
133 |
e.preventDefault();
|
134 |
$( document.activeElement ).blur();
|
135 |
} else {
|
136 |
+
$( '#Settings_updated' ).hide();
|
137 |
var data = $( '#woe-admin form' ).serialize();
|
138 |
+
data = data + "&action=order_exporter&method=save_tools&tab=tools";
|
139 |
$.post( ajaxurl, data, function ( response ) {
|
140 |
+
$( '#tools-import-text' ).val( '' );
|
141 |
+
$( '#Settings_updated' ).show().delay( 5000 ).fadeOut();
|
142 |
}, "json" );
|
143 |
return false;
|
144 |
}
|
woo-order-export-lite.php
CHANGED
@@ -5,11 +5,11 @@
|
|
5 |
* Description: Export orders from WooCommerce with ease (Excel/CSV/XML/JSON supported)
|
6 |
* Author: AlgolPlus
|
7 |
* Author URI: https://algolplus.com/
|
8 |
-
* Version:
|
9 |
* Text Domain: woo-order-export-lite
|
10 |
* Domain Path: /i18n/languages/
|
11 |
* WC requires at least: 2.6.0
|
12 |
-
* WC tested up to: 3.
|
13 |
*
|
14 |
* Copyright: (c) 2015 AlgolPlus LLC. (algol.plus@gmail.com)
|
15 |
*
|
@@ -23,55 +23,69 @@
|
|
23 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
24 |
*/
|
25 |
if ( ! defined( 'ABSPATH' ) ) {
|
26 |
-
|
27 |
} // Exit if accessed directly
|
28 |
|
29 |
-
// a small function to check startup conditions
|
30 |
-
if ( ! function_exists( "woe_check_running_options" ) ) {
|
31 |
-
function woe_check_running_options() {
|
32 |
-
|
33 |
-
$is_backend = is_admin();
|
34 |
-
return $is_backend;
|
35 |
-
}
|
36 |
-
}
|
37 |
-
|
38 |
-
if ( ! woe_check_running_options() ) {
|
39 |
-
return;
|
40 |
-
} //don't load for frontend !
|
41 |
-
|
42 |
//Stop if another version is active!
|
43 |
if ( class_exists( 'WC_Order_Export_Admin' ) ) {
|
44 |
-
|
45 |
-
function woe_warn_free_admin() {
|
46 |
?>
|
47 |
<div class="notice notice-warning is-dismissible">
|
48 |
<p><?php _e( 'Please, <a href="plugins.php">deactivate</a> Free version of Advanced Order Export For WooCommerce!',
|
49 |
'woo-order-export-lite' ); ?></p>
|
50 |
</div>
|
51 |
<?php
|
52 |
-
|
53 |
-
}
|
54 |
-
add_action( 'admin_notices', 'woe_warn_free_admin' );
|
55 |
-
|
56 |
return;
|
57 |
}
|
58 |
|
|
|
|
|
|
|
59 |
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
include 'classes/admin/class-wc-order-export-manage.php';
|
63 |
include 'classes/admin/class-wc-order-export-labels.php';
|
64 |
include 'classes/core/class-wc-order-export-engine.php';
|
65 |
include 'classes/core/class-wc-order-export-data-extractor.php';
|
66 |
include 'classes/core/class-wc-order-export-data-extractor-ui.php';
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
-
define( 'WOE_VERSION', '2.1.1' );
|
69 |
-
define( 'WOE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
70 |
-
define( 'WOE_PLUGIN_BASEPATH', dirname( __FILE__ ) );
|
71 |
$wc_order_export = new WC_Order_Export_Admin();
|
72 |
-
register_activation_hook( __FILE__, array( $wc_order_export, 'install' ) );
|
73 |
register_deactivation_hook( __FILE__, array( $wc_order_export, 'deactivate' ) );
|
74 |
-
register_uninstall_hook( __FILE__, array( 'WC_Order_Export_Admin', 'uninstall' ) );
|
75 |
|
76 |
// fight with ugly themes which add empty lines
|
77 |
if ( $wc_order_export->must_run_ajax_methods() AND ! ob_get_level() ) {
|
5 |
* Description: Export orders from WooCommerce with ease (Excel/CSV/XML/JSON supported)
|
6 |
* Author: AlgolPlus
|
7 |
* Author URI: https://algolplus.com/
|
8 |
+
* Version: 3.0.0
|
9 |
* Text Domain: woo-order-export-lite
|
10 |
* Domain Path: /i18n/languages/
|
11 |
* WC requires at least: 2.6.0
|
12 |
+
* WC tested up to: 3.6
|
13 |
*
|
14 |
* Copyright: (c) 2015 AlgolPlus LLC. (algol.plus@gmail.com)
|
15 |
*
|
23 |
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
|
24 |
*/
|
25 |
if ( ! defined( 'ABSPATH' ) ) {
|
26 |
+
exit;
|
27 |
} // Exit if accessed directly
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
//Stop if another version is active!
|
30 |
if ( class_exists( 'WC_Order_Export_Admin' ) ) {
|
31 |
+
add_action( 'admin_notices', function () {
|
|
|
32 |
?>
|
33 |
<div class="notice notice-warning is-dismissible">
|
34 |
<p><?php _e( 'Please, <a href="plugins.php">deactivate</a> Free version of Advanced Order Export For WooCommerce!',
|
35 |
'woo-order-export-lite' ); ?></p>
|
36 |
</div>
|
37 |
<?php
|
38 |
+
});
|
|
|
|
|
|
|
39 |
return;
|
40 |
}
|
41 |
|
42 |
+
define( 'WOE_VERSION', '3.0.0' );
|
43 |
+
define( 'WOE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
44 |
+
define( 'WOE_PLUGIN_BASEPATH', dirname( __FILE__ ) );
|
45 |
|
46 |
+
$extension_file = WOE_PLUGIN_BASEPATH.'/pro_version/pre-loader.php';
|
47 |
+
if ( file_exists( $extension_file ) ) {
|
48 |
+
include_once $extension_file;
|
49 |
+
}
|
50 |
+
|
51 |
+
// a small function to check startup conditions
|
52 |
+
if ( ! function_exists( "woe_check_running_options" ) ) {
|
53 |
+
function woe_check_running_options() {
|
54 |
+
$is_backend = is_admin();
|
55 |
+
return apply_filters('woe_check_running_options', $is_backend);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
if ( ! woe_check_running_options() ) {
|
60 |
+
return;
|
61 |
+
} //don't load for frontend !
|
62 |
+
|
63 |
+
include 'classes/admin/tabs/ajax/trait-wc-order-export-ajax-helpers.php';
|
64 |
+
include 'classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-filters.php';
|
65 |
+
include 'classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax-export.php';
|
66 |
+
include 'classes/admin/tabs/ajax/trait-wc-order-export-admin-tab-abstract-ajax.php';
|
67 |
+
include 'classes/admin/tabs/ajax/class-wc-order-export-ajax.php';
|
68 |
+
include 'classes/admin/tabs/class-wc-order-export-admin-tab-abstract.php';
|
69 |
+
include 'classes/admin/tabs/class-wc-order-export-admin-tab-export-now.php';
|
70 |
+
include 'classes/admin/tabs/class-wc-order-export-admin-tab-help.php';
|
71 |
+
include 'classes/admin/tabs/class-wc-order-export-admin-tab-profiles.php';
|
72 |
+
include 'classes/admin/tabs/class-wc-order-export-admin-tab-schedule-jobs.php';
|
73 |
+
include 'classes/admin/tabs/class-wc-order-export-admin-tab-status-change-jobs.php';
|
74 |
+
include 'classes/admin/tabs/class-wc-order-export-admin-tab-tools.php';
|
75 |
+
include 'classes/admin/class-wc-order-export-settings.php';
|
76 |
include 'classes/admin/class-wc-order-export-manage.php';
|
77 |
include 'classes/admin/class-wc-order-export-labels.php';
|
78 |
include 'classes/core/class-wc-order-export-engine.php';
|
79 |
include 'classes/core/class-wc-order-export-data-extractor.php';
|
80 |
include 'classes/core/class-wc-order-export-data-extractor-ui.php';
|
81 |
+
include 'classes/class-wc-order-export-admin.php';
|
82 |
+
$extension_file = WOE_PLUGIN_BASEPATH.'/pro_version/loader.php';
|
83 |
+
if ( file_exists( $extension_file ) ) {
|
84 |
+
include_once $extension_file;
|
85 |
+
}
|
86 |
|
|
|
|
|
|
|
87 |
$wc_order_export = new WC_Order_Export_Admin();
|
|
|
88 |
register_deactivation_hook( __FILE__, array( $wc_order_export, 'deactivate' ) );
|
|
|
89 |
|
90 |
// fight with ugly themes which add empty lines
|
91 |
if ( $wc_order_export->must_run_ajax_methods() AND ! ob_get_level() ) {
|