Subversion Repositories munaweb

Rev

Rev 5 | Rev 7 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
<!DOCTYPE html>
2
<html lang="en">
3
 
4
<head>
5
    <title>Export eBay Listings to Shopify</title>
6
    <meta charset="UTF-8">
7
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
9
    <link rel="icon" href="favicon.ico" type="image/x-icon">
10
 
11
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
12
    <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
13
    <link rel="stylesheet" href="css/style.css">
14
    <link rel="stylesheet" href="css/tablesorter.theme.blue.css">
15
    <script src="js/XMLWriter.js"></script>
16
    <script src="js/lodash.min.js"></script>
17
    <script src="js/XMLparse.js"></script>
18
    <script src="js/muna-tools.js"></script>
19
    <script src="js/jquery.js"></script>
20
    <script src="js/jquery.tablesorter.min.js"></script>
21
    <script src="js/jquery.tablesorter.widgets.js"></script>
22
    <script src="js/jquery.parser-input-select.js"></script>
23
</head>
24
 
25
<body onload="return initConfig();">
26
    <div class="w3-main">
27
        <div class="w3-container w3-padding w3-margin w3-card-4">
28
            <div class="w3-container w3-gray" style="height:100px">
29
                <img class="w3-image" src="images/MUNA%20-%20Logo%20100x100.png" alt="MUNA Trading Logo" style="height:100px">
30
                <p id="connected" class="w3-xxlarge w3-right">Export eBay Listings to Shopify
31
                    <input id="login" type="button" class="w3-btn w3-large w3-green w3-margin w3-round-large w3-ripple w3-right w3-hide" onclick="eBayLogin();" value="Login" />
6 - 32
                </p>
2 - 33
            </div>
34
 
35
            <div class="w3-row">
36
                <div>
37
                    <form id="searchForm" class="w3-container w3-light-grey w3-padding w3-small" onsubmit="return getListings();">
38
                        <div id="form1div" class="w3-container w3-card-2 w3-cell w3-padding w3-hide">
39
                            <p>
40
                                <input id="completedList" class="w3-radio" type="radio" style="height:1em" name="rptType" value="completedList" checked>
41
                                <label for="completedList">Completed Listings</label>
42
                            </p>
43
                            <p>
44
                                <input id="liveList" class="w3-radio" type="radio" style="height:1em" name="rptType" value="liveList">
45
                                <label for="liveList">Live Listings</label>
46
                            </p>
47
                            <input id="startButton" type="button" class="w3-btn w3-large w3-red w3-margin w3-round-large w3-ripple" onclick="getListings();" value="Start" />
6 - 48
                        </div>
2 - 49
                        <div id="form2div" class="w3-container w3-card-2 w3-cell w3-padding w3-hide">
50
                            <input id="downloadButton" type="button" class="w3-btn w3-large w3-black w3-margin w3-round-large w3-ripple" onclick="downloadListings()" value="Download CSV" />
6 - 51
                        </div>
2 - 52
                    </form>
53
                </div>
54
                <div id="progressBarDiv" class="w3-container w3-padding w3-margin w3-card-4 w3-hide">
6 - 55
                    <h2 id="progressBarHeader"></h2>
2 - 56
                    <div class="w3-light-grey">
57
                        <div id="progressBar" class="w3-container w3-green w3-center" style="width:0%">0%</div>
58
                    </div>
59
                </div>
60
                <div id="results" class="w3-container w3-padding w3-card-4 w3-hide"></div>
61
                <div id="csv" class="w3-container w3-padding w3-card-4 w3-hide"></div>
62
                <div id="logging" class="w3-container w3-padding"></div>
63
            </div>
64
        </div>
65
 
66
        <footer class="w3-container w3-center w3-border-top w3-margin">
67
            Copyright &#169; 2018 MUNA Trading. All rights reserved.
68
        </footer>
69
 
70
    </div>
71
 
72
    <script>
73
 
74
// Globals
75
var tableName = 'exportTable';
76
var tableSorterName = 'selectTable';
77
var liveListing;
78
var maxPagesToProcess = 0;
79
var pagesToProcess = 0;
80
var pagesProcessed = 0;
81
var maxNotesToAdd = 0;
82
var notesToAdd = 0;
83
var notesAdded = 0;
84
var html = [];
85
 
86
// Initialize Configuration Variables
87
function initConfig() {
88
    var x = document.getElementById("form1div");
89
    if (x.className.indexOf("w3-show") == -1) {
90
        x.className += " w3-show";
91
    }
92
 
93
    eBayAuthToken = readCookie();
94
    if (eBayAuthToken.length > 0) {
95
        connected();
96
    }
97
 
98
    if (eBayAuthTokenFlag === false) {
99
        x = document.getElementById("login");
100
        if (x.className.indexOf("w3-show") == -1) {
101
            x.className += " w3-show";
102
        }
103
    }
104
}
105
 
106
function connected() {
107
    var x;
108
 
109
    eBayAuthTokenFlag = true;
110
    document.getElementById("connected").innerHTML += " (Connected)";
111
 
112
    x = document.getElementById("startButton");
113
    x.className = x.className.replace(" w3-red", " w3-black");
114
 
115
    x = document.getElementById("login");
116
    x.className = x.className.replace(" w3-show", "");
117
 
118
    x = document.getElementById("results");
119
    x.innerHTML = "";
120
    x.className = x.className.replace(" w3-show", "");
121
    x.className = x.className.replace(" process-errors", "");
122
}
123
 
124
function requireNewLogin() {
125
    var x = document.getElementById("startButton");
126
    x.className = x.className.replace(" w3-black", " w3-red ");
127
}
128
 
129
function downloadListings() {
130
    var noteList = [];
131
    var table = document.getElementById(tableSorterName);
132
 
133
    maxPagesToProcess = 0;
134
    pagesToProcess = 0;
135
    pagesProcessed = 0;
136
 
137
    initProgressBar("Downloading Selected Items");
138
 
139
    var x = document.getElementById("results");
140
    x.innerHTML = '';
141
    x.className = x.className.replace("process-errors", "");
142
    if (x.className.indexOf("w3-show") == -1) {
143
        x.className += " w3-show";
144
    }
145
    x.innerHTML = '<p><strong>Downloading Listings...</strong></p>';
146
 
147
    document.getElementById("csv").innerHTML = '';
148
 
149
    tableStart();
150
    for (var i = 2; i < table.rows.length; i++) {
151
        if (table.rows[i].cells[0].children[0].checked) {
152
            ++maxPagesToProcess;
153
            ++pagesToProcess;
154
            noteList.push(table.rows[i].cells[3].innerHTML);
155
            eBaySearch(table.rows[i].cells[3].innerHTML);
156
 
157
            table.deleteRow(i--);
158
        }
159
    }
160
 
161
    function checkpagesToProcess() {
162
        if (pagesToProcess > 0) {
163
            window.setTimeout(checkpagesToProcess, 100); // wait 100 milliseconds
164
        } else {
165
            tableEnd();
6 - 166
            $("#" + tableSorterName).trigger("update").trigger("appendCache").trigger("applyWidgets");
2 - 167
            $('#selected-rows').html('0');
168
            $("#" + tableSorterName).find('thead input[type=checkbox]').prop('checked', false);
169
            $("#" + tableSorterName).find('thead input[type=checkbox]').prop('indeterminate', false);
170
            endProgressBar();
171
            exportTableToCSV(tableName, 'import.csv');
172
            addNotes(noteList);
173
        }
174
    }
175
 
176
    checkpagesToProcess();
177
}
178
 
179
function addNotes(noteList) {
180
    var i, x;
181
 
182
    maxNotesToAdd = 0;
183
    notesToAdd = 0;
184
    notesAdded = 0;
185
 
186
    if (!liveListing) {
187
        initProgressBar('Adding Notes to Ended Listings');
188
 
189
        for (i = 0; i < noteList.length; i++) {
190
            ++maxNotesToAdd;
191
            ++notesToAdd;
192
            addNote(noteList[i]);
193
        }
194
    }
195
 
196
    function checkNotesToAdd() {
197
        if (notesToAdd > 0) {
198
            window.setTimeout(checkNotesToAdd, 100); // wait 100 milliseconds
199
        } else {
200
            endProgressBar();
201
 
202
            x = document.getElementById("results");
203
            x.innerHTML += '<p><strong>Report Finished!</strong></p>';
204
            if (!x.className.includes("process-errors")) {
205
                setTimeout(function() {
206
                    x.className = x.className.replace(" w3-show", "");
207
                }, 3000);
208
            }
209
        }
210
    }
211
 
212
    checkNotesToAdd();
213
}
214
 
215
function tableStart() {
216
    document.getElementById("csv").innerHTML = '';
217
    html = [];
218
 
219
    html.push('<h3>Shopify Import</h3>');
220
    html.push('<div class="w3-responsive">');
221
    html.push('<table id="' + tableName + '">');
222
    html.push('<thead>');
223
    html.push('<tr>');
224
 
225
    html.push(tableHeader('Handle'));
226
    html.push(tableHeader('Title'));
227
    html.push(tableHeader('Body (HTML)'));
228
    html.push(tableHeader('Vendor'));
229
    html.push(tableHeader('Type'));
230
    html.push(tableHeader('Tags'));
231
    html.push(tableHeader('Published'));
232
    html.push(tableHeader('Variant SKU'));
233
    html.push(tableHeader('Variant Inventory Tracker'));
234
    html.push(tableHeader('Variant Inventory Quantity'));
235
    html.push(tableHeader('Variant Inventory Policy'));
236
    html.push(tableHeader('Variant Fulfillment Service'));
237
    html.push(tableHeader('Variant Price'));
238
    html.push(tableHeader('Variant Requires Shipping'));
239
    html.push(tableHeader('Variant Taxable'));
240
    html.push(tableHeader('Variant Barcode'));
241
    html.push(tableHeader('Image Src'));
242
    html.push(tableHeader('Image Position'));
243
    html.push(tableHeader('Image Alt Text'));
244
    html.push(tableHeader('Variant Grams'));
245
    html.push(tableHeader('Variant Weight Unit'));
246
 
247
    html.push('</tr>');
248
    html.push('</thead>');
249
    html.push('<tbody>');
250
}
251
 
252
function tableEntry(JsonObj) {
253
    var i, n, barcode, handle;
254
    var tags = [];
255
    var ConditionDescription = JsonObj.ConditionDescription;
256
    var ConditionID = JsonObj.ConditionID;
257
    var CurrentPrice = JsonObj.SellingStatus.CurrentPrice;
258
    var CurrentPriceValue = CurrentPrice === undefined ? 0.00 : Number(CurrentPrice.text);
259
    var price = CurrentPriceValue;
260
    var Description = JsonObj.Description;
261
    var userDescription;
262
    var ItemID = JsonObj.ItemID;
263
    var ItemSpecifics = JsonObj.ItemSpecifics;
6 - 264
    var PictureURL = getJsonArray(JsonObj.PictureDetails.PictureURL);
2 - 265
    var PrimaryCategoryName = JsonObj.PrimaryCategory.CategoryName;
266
    var Quantity = JsonObj.Quantity;
267
    var SKU = JsonObj.SKU;
268
    var ProductListingDetails = JsonObj.ProductListingDetails;
269
    var weightInGrams = 0;
270
    var categoryName = PrimaryCategoryName;
271
 
272
    var Title = JsonObj.Title;
273
 
274
    if (Number(ConditionID) === 1000) {
275
        tags.push("Condition: Brand New");
276
    } else {
277
        tags.push("Condition: Preowned");
278
    }
279
 
280
    n = (SKU === undefined ? 0 : SKU.indexOf(" - "));
281
    if (n > 0) {
282
        barcode = SKU.substr(n + 3);
283
        barcode = barcode.substr(barcode.indexOf(" ") + 1);
284
        handle = 'B' + barcode;
285
        barcode = '\'' + barcode;
286
        SKU = SKU.substr(0, n);
287
    } else {
288
        if (categoryName.indexOf("Books") != -1 && ProductListingDetails && ProductListingDetails.ISBN && isNumeric(ProductListingDetails.ISBN)) {
289
            barcode = '\'' + ProductListingDetails.ISBN;
290
            handle = 'B' + ProductListingDetails.ISBN;
291
        } else if (ProductListingDetails && ProductListingDetails.UPC && isNumeric(ProductListingDetails.UPC)) {
292
            barcode = '\'' + ProductListingDetails.UPC;
293
            handle = 'B' + ProductListingDetails.UPC;
294
        } else if (ProductListingDetails && ProductListingDetails.ProductReferenceID && isNumeric(ProductListingDetails.ProductReferenceID)) {
295
            barcode = 'R' + ProductListingDetails.ProductReferenceID;
296
            handle = barcode;
297
        } else {
298
            barcode = 'H' + Title.hashCode();
299
            handle = barcode;
300
        }
301
    }
302
 
303
    userDescription = extractDescription(Description);
304
    if (ItemSpecifics && PrimaryCategoryName.indexOf('DVD') < 0) {
305
        userDescription += '<p>';
306
        var first = true;
307
        for (i = 0; i < ItemSpecifics.length; i++) {
308
            if (ItemSpecifics[i].Name != 'All returns accepted' &&
309
                ItemSpecifics[i].Name != 'Item must be returned within' &&
310
                ItemSpecifics[i].Name != 'Refund will be given as' &&
311
                ItemSpecifics[i].Name != 'Return policy details' &&
312
                ItemSpecifics[i].Name != 'Restocking Fee' &&
313
                ItemSpecifics[i].Name != 'Return shipping will be paid by') {
314
                userDescription += (first ? '' : '<br/>') + ItemSpecifics[i].Name + ': ' + ItemSpecifics[i].Value;
315
                first = false;
316
            }
317
        }
318
        userDescription += '</p>';
319
    }
320
 
321
    if (ConditionDescription &&
322
        (userDescription.indexOf('Please view all actual images.') < 0 && userDescription.indexOf('mint condition') < 0)) {
323
        userDescription += '<p>' + ConditionDescription + '</p>';
324
    }
325
 
326
    if (categoryName.indexOf("CDs") != -1) {
327
        categoryName = 'Music CDs';
328
        price = 4.95;
329
    } else if (categoryName.indexOf("Movies") != -1) {
330
        categoryName = 'Movies';
331
        price = 4.95;
332
    } else if (categoryName.indexOf("Books") != -1) {
333
        categoryName = 'Books';
334
        price = 5.95;
335
    } else if (categoryName.indexOf("Trading Cards") != -1) {
336
        if (categoryName.indexOf("Baseball") != -1) {
337
            tags.push('Trading Cards: Baseball');
338
        } else if (categoryName.indexOf("Football") != -1) {
339
            tags.push('Trading Cards: Football');
340
        } else if (categoryName.indexOf("Basketball") != -1) {
341
            tags.push('Trading Cards: Basketball');
342
        } else if (categoryName.indexOf("Soccer") != -1) {
343
            tags.push('Trading Cards: Soccer');
344
        } else if (categoryName.indexOf("Ice Hockey") != -1) {
345
            tags.push('Trading Cards: Ice Hockey');
346
        } else if (categoryName.indexOf("Auto Racing") != -1) {
347
            tags.push('Trading Cards: Auto Racing');
348
        }
349
        categoryName = 'Trading Cards';
350
        price = 1.99;
351
    }
352
    tags.push(categoryName);
353
 
354
    if (liveListing) {
355
        tags.push('_eBay Live');
356
 
357
        price = round((CurrentPriceValue * 0.80), 1) + 0.05; // always end with 5
358
        if (categoryName.indexOf("CDs") != -1 && price < 4.95) {
359
            price = 4.95;
360
        } else if (categoryName.indexOf("Movies") != -1 && price < 4.95) {
361
            price = 4.95;
362
        } else if (categoryName.indexOf("Books") != -1 && price < 5.95) {
363
            price = 5.95;
364
        } else if (categoryName.indexOf("Trading Cards") != -1 && price < 1.99) {
365
            price = 1.99;
366
        }
367
    }
368
 
369
    if (JsonObj.ShippingPackageDetails !== undefined) {
370
        if (JsonObj.ShippingPackageDetails.WeightMajor !== undefined) {
371
            weightInGrams += (Number(JsonObj.ShippingPackageDetails.WeightMajor.text) * 453.5);
372
        }
373
 
374
        if (JsonObj.ShippingPackageDetails.WeightMinor !== undefined) {
375
            weightInGrams += (Number(JsonObj.ShippingPackageDetails.WeightMinor.text) * 28.3);
376
        }
377
    }
378
 
379
    html.push('<tr>');
380
 
381
    html.push(tableCell(handle));
382
    html.push(tableCell(Title));
383
    html.push(tableCell(escapeHtml(userDescription)));
384
    html.push(tableCell("MUNA Trading"));
385
    html.push(tableCell(categoryName));
386
    html.push(tableCell(tags.join(',')));
387
    html.push(tableCell("TRUE"));
388
    html.push(tableCell((SKU !== undefined ? SKU : "")));
389
    html.push(tableCell("shopify"));
390
    html.push(tableCell(Quantity));
391
    html.push(tableCell("deny"));
392
    html.push(tableCell("manual"));
393
    html.push(tableCell(price));
394
    html.push(tableCell("TRUE"));
395
    html.push(tableCell("TRUE"));
396
    html.push(tableCell(barcode));
6 - 397
    html.push(tableCell(PictureURL[0].substr(0, PictureURL[0].lastIndexOf('/') + 1) + '$_57.JPG'));
2 - 398
    html.push(tableCell(1));
399
    html.push(tableCell(Title + " Image 1"));
400
    html.push(tableCellHidden(ItemID));
401
    html.push(tableCell(Math.floor(weightInGrams)));
402
    html.push(tableCell("oz"));
403
    html.push(tableCellHidden(ItemID));
404
 
405
    html.push('</tr>');
406
 
6 - 407
    for (i = 1; i < PictureURL.length; i++) {
408
        html.push('<tr>');
2 - 409
 
6 - 410
        html.push(tableCell(handle));
411
        html.push(tableCell(""));
412
        html.push(tableCell(""));
413
        html.push(tableCell(""));
414
        html.push(tableCell(""));
415
        html.push(tableCell(""));
416
        html.push(tableCell(""));
417
        html.push(tableCell(""));
418
        html.push(tableCell(""));
419
        html.push(tableCell(""));
420
        html.push(tableCell(""));
421
        html.push(tableCell(""));
422
        html.push(tableCell(""));
423
        html.push(tableCell(""));
424
        html.push(tableCell(""));
425
        html.push(tableCell(""));
426
        html.push(tableCell(PictureURL[i].substr(0, PictureURL[i].lastIndexOf('/') + 1) + '$_57.JPG'));
427
        html.push(tableCell(i + 1));
428
        html.push(tableCell(Title + " Image " + (i + 1)));
429
        html.push(tableCell(""));
430
        html.push(tableCell(""));
431
        html.push(tableCellHidden(ItemID));
2 - 432
 
6 - 433
        html.push('</tr>');
2 - 434
    }
435
}
436
 
437
function extractDescription(str) {
438
    var startText = "<!-- *************** Place description here ****************** -->";
439
    var startPos = str.indexOf(startText) + startText.length;
440
    var endPos = str.lastIndexOf("<!-- *************** Place description here ****************** -->");
441
    var userDescription = str.substr(startPos, endPos - startPos);
442
    var parser = new DOMParser();
443
    var htmlDoc = parser.parseFromString(userDescription, "text/html");
444
 
445
    return ((htmlDoc.getElementsByTagName('div')[0] !== undefined ? htmlDoc.getElementsByTagName('div')[0].innerHTML : userDescription));
446
}
447
 
448
function tableEnd() {
449
    html.push('</tbody>');
450
    html.push('</table>');
451
    html.push('</div>');
452
 
453
    document.getElementById("csv").innerHTML = html.join('');
454
}
455
 
456
function addNote(itemId) {
457
    var i;
458
    var xml;
459
 
460
    var xw = new XMLWriter('UTF-8', '1.0');
461
    var xhr = new XMLHttpRequest();
462
 
463
    if (!createAddXMLNote(xw, xhr, 'SetUserNotesRequest', 'SetUserNotes', itemId)) {
464
        return;
465
    }
466
 
467
    xml = xw.flush();
468
    xw.close();
469
 
470
    xhr.onload = function() {
471
        var obj = XMLparse(xhr.responseXML);
472
 
473
        var returnCode = obj.Ack;
474
 
475
        var x = document.getElementById("results");
476
        if (x.className.indexOf("w3-show") == -1) {
477
            x.className += " w3-show";
478
        }
479
 
480
        if (returnCode == 'Success' || (returnCode == 'Warning' && obj.Errors.ErrorCode == '21917108')) {
481
            x.innerHTML += '<p>' + itemId + ': <strong>' + returnCode + '</strong></p>';
482
 
483
            if (returnCode == 'Warning') {
484
                x.innerHTML += "<p>" + obj.Errors.SeverityCode + " (" + obj.Errors.ErrorCode + "): " + escapeHtml(obj.Errors.LongMessage) + "</p>";
485
            }
486
        } else {
487
            x.className += " process-errors";
488
            x.innerHTML += '<p class="w3-red">' + itemId + ': <strong>' + returnCode + ':</strong></p>';
489
 
6 - 490
            var errors = getJsonArray(obj.Errors);
2 - 491
            x.innerHTML += "<p>";
6 - 492
            for (i = 0; i < errors.length; i++) {
493
                x.innerHTML += errors[i].SeverityCode + " (" + errors[i].ErrorCode + "): " + escapeHtml(errors[i].LongMessage) + "<br/>";
2 - 494
            }
6 - 495
 
2 - 496
            x.innerHTML += "</p>";
497
        }
498
 
499
        if (obj.Message) {
500
            x.innerHTML += obj.Message;
501
        }
502
 
503
        --notesToAdd;
504
        ++notesAdded;
505
 
506
        updateProgressBar(maxNotesToAdd, notesAdded);
507
    };
508
 
509
    xhr.send(xml);
510
}
511
 
512
function createAddXMLNote(xw, xhr, xmlrequest, callname, itemId) {
513
    var today = new Date();
514
    var todayYYYYMMDD = today.toISOString().slice(0, 10);
515
 
516
    xw.writeStartDocument();
517
    xw.writeStartElement(xmlrequest);
518
    xw.writeAttributeString('xmlns', 'urn:ebay:apis:eBLBaseComponents');
519
 
520
    xw.writeStartElement('RequesterCredentials');
521
    xw.writeElementString('eBayAuthToken', eBayAuthToken);
522
    xw.writeEndElement(); /* RequesterCredentials */
523
 
524
    xw.writeElementString('ItemID', itemId);
525
    xw.writeElementString('Action', 'AddOrUpdate');
526
    xw.writeElementString('NoteText', 'Exported to Shopify on ' + todayYYYYMMDD);
527
 
528
    xw.writeElementString('ErrorLanguage', 'en_US');
529
    xw.writeElementString('Version', configeBayTradingVersion);
530
    xw.writeElementString('WarningLevel', configWarningLevel);
531
 
532
    xw.writeEndElement(); /* xmlrequest */
533
    xw.writeEndDocument();
534
 
535
    xhr.open('POST', configProxyUrl, true);
536
    xhr.setRequestHeader('Content-Type', 'text/xml');
537
    xhr.setRequestHeader('X-EBAY-API-APP-NAME', configAppid);
538
    xhr.setRequestHeader('X-EBAY-API-COMPATIBILITY-LEVEL', configeBayTradingVersion);
539
    xhr.setRequestHeader('X-EBAY-API-CALL-NAME', callname);
540
    xhr.setRequestHeader('X-EBAY-API-SITEID', '0');
541
    xhr.setRequestHeader('X-EBAY-API-DEV-NAME', '');
542
    xhr.setRequestHeader('X-EBAY-API-CERT-NAME', '');
543
    xhr.setRequestHeader('X-Proxy-URL', configServiceEndpoint);
544
 
545
    return true;
546
}
547
 
548
function eBaySearch(itemId) {
549
    var i;
550
    var xml;
551
 
552
    var xw = new XMLWriter('UTF-8', '1.0');
553
    var xhr = new XMLHttpRequest();
554
 
555
    if (!createAddXMLSearch(xw, xhr, 'GetItemRequest', 'GetItem', itemId)) {
556
        return;
557
    }
558
 
559
    xml = xw.flush();
560
    xw.close();
561
 
562
    xhr.onload = function() {
563
        var obj = XMLparse(xhr.responseXML);
564
 
565
        var returnCode = obj.Ack;
566
 
567
        var x = document.getElementById("results");
568
        if (x.className.indexOf("w3-show") == -1) {
569
            x.className += " w3-show";
570
        }
571
 
572
        if (returnCode == 'Success') {
573
            tableEntry(obj.Item);
574
        } else {
575
            x.className += " process-errors";
576
            x.innerHTML += '<p class="w3-red">' + itemId + ': <strong>' + returnCode + ':</strong></p>';
577
 
6 - 578
            var errors = getJsonArray(obj.Errors);
2 - 579
            x.innerHTML += "<p>";
6 - 580
            for (i = 0; i < errors.length; i++) {
581
                x.innerHTML += errors[i].SeverityCode + " (" + errors[i].ErrorCode + "): " + escapeHtml(errors[i].LongMessage) + "<br/>";
2 - 582
            }
6 - 583
 
2 - 584
            x.innerHTML += "</p>";
585
        }
586
 
587
        --pagesToProcess;
588
        ++pagesProcessed;
589
 
590
        updateProgressBar(maxPagesToProcess, pagesProcessed);
591
    };
592
 
593
    xhr.send(xml);
594
}
595
 
596
function createAddXMLSearch(xw, xhr, xmlrequest, callname, itemId) {
597
 
598
    xw.writeStartDocument();
599
    xw.writeStartElement(xmlrequest);
600
    xw.writeAttributeString('xmlns', 'urn:ebay:apis:eBLBaseComponents');
601
 
602
    xw.writeStartElement('RequesterCredentials');
603
    xw.writeElementString('eBayAuthToken', eBayAuthToken);
604
    xw.writeEndElement(); /* RequesterCredentials */
605
 
606
    xw.writeElementString('ItemID', itemId);
607
    xw.writeElementString('IncludeItemSpecifics', 'true');
608
    xw.writeElementString('DetailLevel', 'ReturnAll');
609
 
610
    xw.writeElementString('ErrorLanguage', 'en_US');
611
    xw.writeElementString('Version', configeBayTradingVersion);
612
    xw.writeElementString('WarningLevel', configWarningLevel);
613
 
614
    xw.writeEndElement(); /* xmlrequest */
615
    xw.writeEndDocument();
616
 
617
    xhr.open('POST', configProxyUrl, true);
618
    xhr.setRequestHeader('Content-Type', 'text/xml');
619
    xhr.setRequestHeader('X-EBAY-API-APP-NAME', configAppid);
620
    xhr.setRequestHeader('X-EBAY-API-COMPATIBILITY-LEVEL', configeBayTradingVersion);
621
    xhr.setRequestHeader('X-EBAY-API-CALL-NAME', callname);
622
    xhr.setRequestHeader('X-EBAY-API-SITEID', '0');
623
    xhr.setRequestHeader('X-EBAY-API-DEV-NAME', '');
624
    xhr.setRequestHeader('X-EBAY-API-CERT-NAME', '');
625
    xhr.setRequestHeader('X-Proxy-URL', configServiceEndpoint);
626
 
627
    return true;
628
}
629
 
630
function getListings() {
631
    var x;
632
 
633
    if (eBayAuthTokenFlag === false) {
634
        return;
635
    }
636
 
637
    document.getElementById("logging").innerHTML = '';
638
 
639
    x = document.getElementById("results");
640
    if (x.className.indexOf("w3-show") == -1) {
641
        x.className += " w3-show";
642
    }
643
    x.className = x.className.replace("process-errors", "");
644
    x.innerHTML = '<p><strong>Retrieving Listings...</strong></p>';
645
 
646
    initProgressBar('Getting Items for Export (1/2)');
647
 
648
    liveListing = (getRadioValue('rptType') == 'liveList');
649
    tableSorterStart();
650
    maxPagesToProcess = 1;
651
    pagesToProcess = 1;
652
    pagesProcessed = 0;
653
    eBaySorterSearch(1);
654
 
655
    function checkpagesToProcess() {
656
        if (pagesToProcess > 0) {
657
            window.setTimeout(checkpagesToProcess, 100); // wait 100 milliseconds
658
        } else {
659
            tableSorterEnd();
660
            endProgressBar();
661
            // fillSorterListings(); is now in tableSorterEnd()
662
        }
663
    }
664
 
665
    checkpagesToProcess();
666
}
667
 
668
function tableSorterStart() {
669
    document.getElementById("logging").innerHTML = '';
670
    html = [];
671
 
672
    html.push('<h3>Items for Export</h3>');
673
    html.push('<p>Showing <span id="filtered-rows">0</span> of <span id="total-rows">0</span> / <span id="selected-rows">0</span> selected.</p>');
674
    html.push('<div class="w3-responsive">');
675
    html.push('<table id="' + tableSorterName + '" class="tablesorter">');
676
    html.push('<thead>');
677
    html.push('<tr>');
678
 
6 - 679
    html.push(tableHeaderCheckbox());
2 - 680
    html.push(tableHeader('Image'));
681
    html.push(tableHeader('Title'));
682
    html.push(tableHeader('Item Id'));
683
    html.push(tableHeader('SKU'));
684
    html.push(tableHeader('Category'));
685
    html.push(tableHeader('Format'));
686
    html.push(tableHeader('Price'));
687
    html.push(tableHeader('Quantity'));
688
    html.push(tableHeader('Views'));
689
    html.push(tableHeader('Watchers'));
690
    html.push(tableHeader(liveListing ? 'Start Date' : 'End Date'));
691
    html.push(tableHeader('Note'));
692
 
693
    html.push('</tr>');
694
    html.push('</thead>');
695
    html.push('<tbody>');
696
}
697
 
698
function tableSorterEntry(JsonObj) {
699
    var i;
700
    var image;
701
    var title;
702
    var itemId;
703
    var sku;
704
    var format;
705
    var price;
706
    var quantity;
707
    var views;
708
    var watchers;
709
    var listingDate;
710
    var privateNote;
711
    var ebayNote;
712
    var relisted;
713
 
714
    for (i = 0; i < JsonObj.length; i++) {
715
        image = getJsonValue(JsonObj[i].PictureDetails).replace('http:', 'https:');
716
        title = getJsonValue(JsonObj[i].Title);
717
        itemId = getJsonValue(JsonObj[i].ItemID);
718
        sku = getJsonValue(JsonObj[i].SKU);
719
        format = getJsonValue(JsonObj[i].ListingType);
720
        if (format == 'Chinese') {
721
            format = 'Auction';
722
            price = getJsonValue(JsonObj[i].StartPrice.text);
723
        } else {
724
            format = 'Fixed Price';
725
            price = getJsonValue(JsonObj[i].BuyItNowPrice.text);
726
        }
727
        quantity = getJsonValue(JsonObj[i].QuantityAvailable);
728
        views = '';
729
        watchers = getJsonValue(JsonObj[i].WatchCount);
730
        watchers = (watchers.length === 0 ? "0" : watchers);
731
        listingDate = getJsonValue(JsonObj[i].ListingDetails).substr(0, 10);
732
        privateNote = getJsonValue(JsonObj[i].PrivateNotes);
733
        ebayNote = getJsonValue(JsonObj[i].eBayNotes);
734
        relisted = getJsonValue(JsonObj[i].Relisted);
735
 
736
        if (!liveListing) {
737
            if (privateNote.startsWith("Exported to ") || relisted == 'true' || privateNote.startsWith("Sold via ") || privateNote.startsWith("Relisted As New Item")) {
738
                continue;
739
            }
740
        }
741
 
742
        html.push('<tr>');
743
 
744
        html.push(tableCellCheckbox());
745
        html.push(tableCell('<img class="w3-image" src="' + image + '" alt="Gallery Image" style="max-height:100px;max-width:100px;">'));
746
        html.push(tableCell(title));
747
        html.push(tableCell(itemId));
748
        html.push(tableCell(sku));
749
        html.push(tableCellLabel('Category' + itemId));
750
        html.push(tableCell(format));
751
        html.push(tableCell('$' + price));
752
        html.push(tableCell(quantity));
753
        html.push(tableCellLabel('Views' + itemId));
754
        html.push(tableCell(watchers));
755
        html.push(tableCell(listingDate));
756
        html.push(tableCell(privateNote + ' ' + ebayNote));
757
 
758
        html.push('</tr>');
759
    }
760
}
761
 
762
function tableSorterEnd() {
763
    html.push('</tbody>');
764
    html.push('</table>');
765
    html.push('</div>');
766
 
767
    document.getElementById("logging").innerHTML = html.join('');
768
 
769
    $(function() {
770
        $("#" + tableSorterName).on('tablesorter-initialized', function() {
771
 
772
            // class name to add on tr when checkbox is checked
773
            var highlightClass = 'checked',
774
                // resort the table after the checkbox is modified?
775
                resort = true,
776
                $table = $(this),
777
                c = this.config,
778
                wo = c && c.widgetOptions,
779
                // include sticky header checkbox; if installed
780
                $sticky = c && wo.$sticky || '',
781
                doChecky = function(c, col) {
782
                    $table
783
                        .children('tbody')
784
                        .children('tr:visible')
785
                        .children('td:nth-child( ' + (parseInt(col, 10) + 1) + ' )')
786
                        .find('input[type=checkbox]')
787
                        .each(function() {
788
                            this.checked = c;
789
                            $(this).trigger('change');
790
                        });
791
                };
792
 
793
            $table
794
                .children('tbody')
795
                .on('change', 'input[type=checkbox]', function() {
796
                    // ignore change if updating all rows
797
                    if ($table[0].ignoreChange) {
798
                        return;
799
                    }
800
                    var $this = $(this);
801
                    $this.closest('tr').toggleClass(highlightClass, this.checked);
802
                    $this.trigger('updateCell', [$this.closest('td'), resort]);
803
 
804
                    // handle header
805
                    var rowCount = $('#' + tableSorterName + ' tbody tr').length + $('#' + tableSorterName + ' tbody tr:hidden').length;
806
                    var checkedCount = $('#' + tableSorterName + ' tbody .checked').length;
807
                    var ua = window.navigator.userAgent;
808
                    if (checkedCount === 0) {
809
                        $table.add($sticky).find('thead input[type=checkbox]').prop('checked', false);
810
                        $table.add($sticky).find('thead input[type=checkbox]').prop('indeterminate', false);
811
                    } else if (checkedCount === rowCount) {
812
                        $table.add($sticky).find('thead input[type=checkbox]').prop('checked', true);
813
                        $table.add($sticky).find('thead input[type=checkbox]').prop('indeterminate', false);
814
                    } else {
815
                        $table.add($sticky).find('thead input[type=checkbox]').prop('checked', !(ua.indexOf('Trident/') > -1 || ua.indexOf('Edge/') > -1));
816
                        $table.add($sticky).find('thead input[type=checkbox]').prop('indeterminate', true);
817
                    }
818
                    $('#selected-rows').html(checkedCount);
819
                })
820
                .end()
821
                .add($sticky)
822
                .find('thead input[type=checkbox]')
823
                // Click on checkbox in table header to toggle all inputs
824
                .on('change', function() {
825
                    // prevent updateCell for every cell
826
                    $table[0].ignoreChange = true;
827
                    var c = this.checked,
828
                        col = $(this).closest('th').attr('data-column');
829
                    doChecky(c, col);
830
                    // update main & sticky header
831
 
832
                    $table.children('tbody').children('tr:visible').toggleClass(highlightClass, c);
833
                    // update all at once
834
                    $table[0].ignoreChange = false;
835
                    $table.trigger('update', [resort]);
836
 
837
                    // handle header
838
                    var rowCount = $('#' + tableSorterName + ' tbody tr').length + $('#' + tableSorterName + ' tbody tr:hidden').length;
839
                    var checkedCount = $('#' + tableSorterName + ' tbody .checked').length;
840
                    var ua = window.navigator.userAgent;
841
                    if (checkedCount === 0) {
842
                        $table.add($sticky).find('th[data-column=' + col + '] input[type=checkbox]').prop('checked', false);
843
                        $table.add($sticky).find('th[data-column=' + col + '] input[type=checkbox]').prop('indeterminate', false);
844
                    } else if (checkedCount === rowCount) {
845
                        $table.add($sticky).find('th[data-column=' + col + '] input[type=checkbox]').prop('checked', true);
846
                        $table.add($sticky).find('th[data-column=' + col + '] input[type=checkbox]').prop('indeterminate', false);
847
                    } else {
848
                        $table.add($sticky).find('th[data-column=' + col + '] input[type=checkbox]').prop('checked', !(ua.indexOf('Trident/') > -1 || ua.indexOf('Edge/') > -1));
849
                        $table.add($sticky).find('th[data-column=' + col + '] input[type=checkbox]').prop('indeterminate', true);
850
                    }
851
                    $('#selected-rows').html(checkedCount);
852
                })
853
                .on('mouseup', function() {
854
                    return false;
855
                });
856
 
857
        });
858
 
859
        $("#" + tableSorterName).tablesorter({
860
            theme: "blue",
861
            widgets: ["zebra", "stickyHeaders", "filter"],
862
            headers: {
863
                0: {
864
                    sorter: "checkbox"
865
                },
866
                1: {
867
                    sorter: false,
868
                    filter: false
869
                }
870
            },
871
            initialized: function() {
872
                fillSorterListings();
873
            }
874
        });
875
 
876
        $("#" + tableSorterName).bind('filterInit filterEnd', function(event, data) {
877
            $('#filtered-rows').html(data.filteredRows);
878
            $('#total-rows').html(data.totalRows);
879
        });
880
    });
881
}
882
 
883
function eBaySorterSearch(pageNo) {
884
    var i;
885
    var xml;
886
 
887
    var xw = new XMLWriter('UTF-8', '1.0');
888
    var xhr = new XMLHttpRequest();
889
 
890
    if (!createSorterAddXMLSearch(xw, xhr, 'GetMyeBaySelling', pageNo)) {
891
        return;
892
    }
893
 
894
    xml = xw.flush();
895
    xw.close();
896
 
897
    xhr.onload = function() {
898
        var obj = XMLparse(xhr.responseXML);
899
 
900
        var returnCode = obj.Ack;
901
 
902
        var objArray = (liveListing ? obj.ActiveList : obj.UnsoldList);
903
 
904
        var x = document.getElementById("results");
905
 
906
        if (returnCode == 'Success') {
907
            tableSorterEntry(objArray.ItemArray);
908
 
909
            if (Number(objArray.PaginationResult.TotalNumberOfPages) > pageNo) {
910
                maxPagesToProcess = Number(objArray.PaginationResult.TotalNumberOfPages);
911
                ++pagesToProcess;
912
                eBaySorterSearch(pageNo + 1);
913
            }
914
 
915
            updateProgressBar(maxPagesToProcess, pagesProcessed);
916
        } else {
917
            x.className += " process-errors";
918
            x.innerHTML += '<p class="w3-red">' + obj.CorrelationID + ': <strong>' + returnCode + ':</strong></p>';
6 - 919
            var errors = getJsonArray(obj.Errors);
2 - 920
            x.innerHTML += "<p>";
6 - 921
            for (i = 0; i < errors.length; i++) {
922
                x.innerHTML += errors[i].SeverityCode + " (" + errors[i].ErrorCode + "): " + escapeHtml(errors[i].LongMessage) + "<br/>";
2 - 923
            }
6 - 924
 
2 - 925
            x.innerHTML += "</p>";
926
        }
927
 
928
        --pagesToProcess;
929
        ++pagesProcessed;
930
 
931
        updateProgressBar(maxPagesToProcess, pagesProcessed);
932
    };
933
 
934
    xhr.send(xml);
935
}
936
 
937
function createSorterAddXMLSearch(xw, xhr, callname, pageNo) {
938
 
939
    xw.writeStartDocument();
940
    xw.writeStartElement(callname + "Request");
941
    xw.writeAttributeString('xmlns', 'urn:ebay:apis:eBLBaseComponents');
942
 
943
    xw.writeStartElement('RequesterCredentials');
944
    xw.writeElementString('eBayAuthToken', eBayAuthToken);
945
    xw.writeEndElement(); /* RequesterCredentials */
946
 
947
    xw.writeElementString('DetailLevel', 'ReturnAll');
948
    xw.writeStartElement('DeletedFromSoldList');
949
    xw.writeElementString('Include', 'false');
950
    xw.writeEndElement(); /* DeletedFromSoldList */
951
    xw.writeStartElement('DeletedFromUnsoldList');
952
    xw.writeElementString('Include', 'false');
953
    xw.writeEndElement(); /* DeletedFromUnsoldList */
954
    xw.writeStartElement('ScheduledList');
955
    xw.writeElementString('Include', 'false');
956
    xw.writeEndElement(); /* ScheduledList */
957
    xw.writeStartElement('SellingSummary');
958
    xw.writeElementString('Include', 'false');
959
    xw.writeEndElement(); /* SellingSummary */
960
    xw.writeStartElement('SoldList');
961
    xw.writeElementString('Include', 'false');
962
    xw.writeEndElement(); /* SoldList */
963
 
964
    xw.writeStartElement(liveListing ? 'UnsoldList' : 'ActiveList');
965
    xw.writeElementString('Include', 'false');
966
    xw.writeEndElement(); /* ActiveList */
967
 
968
    xw.writeStartElement(liveListing ? 'ActiveList' : 'UnsoldList');
969
    xw.writeElementString('Include', 'true');
970
    xw.writeElementString('IncludeNotes', 'true');
971
    xw.writeStartElement('Pagination');
972
    xw.writeElementString('EntriesPerPage', '200');
973
    xw.writeElementString('PageNumber', '' + pageNo);
974
    xw.writeEndElement(); /* Pagination*/
975
    xw.writeEndElement(); /* UnsoldList> */
976
    xw.writeElementString('OutputSelector', 'BuyItNowPrice');
977
    xw.writeElementString('OutputSelector', 'eBayNotes');
978
    xw.writeElementString('OutputSelector', 'ItemID');
979
    xw.writeElementString('OutputSelector', liveListing ? 'ActiveList.ItemArray.Item.ListingDetails.StartTime' : 'UnsoldList.ItemArray.Item.ListingDetails.EndTime');
980
    xw.writeElementString('OutputSelector', 'ListingType');
981
    xw.writeElementString('OutputSelector', 'PrivateNotes');
982
    xw.writeElementString('OutputSelector', 'QuantityAvailable');
983
    xw.writeElementString('OutputSelector', 'PictureDetails');
984
    xw.writeElementString('OutputSelector', 'Relisted');
985
    xw.writeElementString('OutputSelector', 'SKU');
986
    xw.writeElementString('OutputSelector', 'Title');
987
    xw.writeElementString('OutputSelector', 'StartPrice');
988
    xw.writeElementString('OutputSelector', 'WatchCount');
989
    xw.writeElementString('OutputSelector', 'PaginationResult');
990
 
991
    xw.writeElementString('ErrorLanguage', 'en_US');
992
    xw.writeElementString('Version', configeBayTradingVersion);
993
    xw.writeElementString('WarningLevel', configWarningLevel);
994
 
995
    xw.writeEndElement(); /* xmlrequest */
996
    xw.writeEndDocument();
997
 
998
    xhr.open('POST', configProxyUrl, true);
999
    xhr.setRequestHeader('Content-Type', 'text/xml');
1000
    xhr.setRequestHeader('X-EBAY-API-APP-NAME', configAppid);
1001
    xhr.setRequestHeader('X-EBAY-API-COMPATIBILITY-LEVEL', configeBayTradingVersion);
1002
    xhr.setRequestHeader('X-EBAY-API-CALL-NAME', callname);
1003
    xhr.setRequestHeader('X-EBAY-API-SITEID', '0');
1004
    xhr.setRequestHeader('X-EBAY-API-DEV-NAME', '');
1005
    xhr.setRequestHeader('X-EBAY-API-CERT-NAME', '');
1006
    xhr.setRequestHeader('X-Proxy-URL', configServiceEndpoint);
1007
 
1008
    return true;
1009
}
1010
 
1011
function fillSorterListings() {
1012
    var i;
1013
    var x = document.getElementById(tableSorterName);
1014
    var fillList = [];
1015
    var maxItems = 20;
1016
 
1017
    listingsToFill = 0;
1018
    maxListingsToFill = 0;
1019
    listingsFilled = 0;
1020
 
1021
    initProgressBar('Filling Listing Information (2/2)');
1022
 
1023
    for (i = 2; i < x.rows.length; i++) {
1024
        fillList.push(x.rows[i].cells[3].innerHTML);
1025
    }
6 - 1026
 
1027
    for (i = 0;
1028
        (i * maxItems) < fillList.length; i++) {
2 - 1029
        ++listingsToFill;
1030
        ++maxListingsToFill;
1031
        fillSorterListing(fillList.slice(i * maxItems, (i + 1) * maxItems));
1032
    }
1033
 
1034
    function checkListingsToFill() {
1035
        if (listingsToFill > 0) {
1036
            window.setTimeout(checkListingsToFill, 100); // wait 100 milliseconds
1037
        } else {
1038
            $("#" + tableSorterName).trigger("update");
1039
 
1040
            endProgressBar();
1041
 
1042
            x = document.getElementById("form1div");
1043
            x.className = x.className.replace(" w3-show", "");
1044
            x = document.getElementById("form2div");
1045
            x.className += " w3-show";
1046
 
1047
            x = document.getElementById("results");
1048
            x.innerHTML += '<p><strong>Report Finished!</strong></p>';
1049
            if (!x.className.includes("process-errors")) {
1050
                setTimeout(function() {
1051
                    x.className = x.className.replace(" w3-show", "");
1052
                }, 3000);
1053
            }
1054
        }
1055
    }
1056
 
1057
    checkListingsToFill();
1058
}
1059
 
1060
function fillSorterListing(itemIdList) {
1061
    var i;
1062
    var xml;
1063
 
1064
    var xw = new XMLWriter('UTF-8', '1.0');
1065
    var xhr = new XMLHttpRequest();
1066
 
1067
    if (!createSorterFillXMLSearch(xw, xhr, 'GetMultipleItems', itemIdList)) {
1068
        return;
1069
    }
1070
 
1071
    xml = xw.flush();
1072
    xw.close();
1073
 
1074
    xhr.onload = function() {
1075
        var obj = XMLparse(xhr.responseXML);
1076
 
1077
        var returnCode = obj.Ack;
1078
 
1079
        var x = document.getElementById("results");
1080
 
1081
        if (returnCode == 'Success') {
1082
            for (i = 0; i < obj.Item.length; i++) {
1083
                var itemId = getJsonValue(obj.Item[i].ItemID);
1084
                document.getElementById("Views" + itemId).innerHTML = getJsonValue(obj.Item[i].HitCount);
1085
                document.getElementById("Category" + itemId).innerHTML = getJsonValue(obj.Item[i].PrimaryCategoryName);
6 - 1086
            }
2 - 1087
        } else {
1088
            x.className += " process-errors";
1089
            x.innerHTML += '<p class="w3-red"><strong>' + returnCode + ':</strong></p>';
1090
 
6 - 1091
            var errors = getJsonArray(obj.Errors);
2 - 1092
            x.innerHTML += "<p>";
6 - 1093
            for (i = 0; i < errors.length; i++) {
1094
                x.innerHTML += errors[i].SeverityCode + " (" + errors[i].ErrorCode + "): " + escapeHtml(errors[i].LongMessage) + "<br/>";
2 - 1095
            }
6 - 1096
 
2 - 1097
            x.innerHTML += "</p>";
1098
        }
1099
 
1100
        --listingsToFill;
1101
        ++listingsFilled;
1102
        updateProgressBar(maxListingsToFill, listingsFilled);
1103
    };
1104
 
1105
    xhr.send(xml);
1106
}
1107
 
1108
function createSorterFillXMLSearch(xw, xhr, callname, itemIdList) {
1109
    var i;
6 - 1110
 
2 - 1111
    xw.writeStartDocument();
1112
    xw.writeStartElement(callname + "Request");
1113
    xw.writeAttributeString('xmlns', 'urn:ebay:apis:eBLBaseComponents');
1114
 
1115
    for (i = 0; i < itemIdList.length; i++) {
1116
        xw.writeElementString('ItemID', itemIdList[i]);
1117
    }
1118
 
1119
    xw.writeElementString('ErrorLanguage', 'en_US');
1120
    xw.writeElementString('Version', configeBayShoppingVersion);
1121
    xw.writeElementString('WarningLevel', configWarningLevel);
1122
 
1123
    xw.writeEndElement(); /* xmlrequest */
1124
    xw.writeEndDocument();
1125
 
1126
    xhr.open('POST', configProxyUrl, true);
1127
    xhr.setRequestHeader('Content-Type', 'text/xml');
1128
    xhr.setRequestHeader('X-EBAY-API-APP-NAME', configAppid);
1129
    xhr.setRequestHeader('X-EBAY-API-VERSION', configeBayShoppingVersion);
1130
    xhr.setRequestHeader('X-EBAY-API-CALL-NAME', callname);
1131
    xhr.setRequestHeader('X-EBAY-API-SITEID', '0');
1132
    xhr.setRequestHeader('X-EBAY-API-DEV-NAME', '');
1133
    xhr.setRequestHeader('X-EBAY-API-CERT-NAME', '');
1134
    xhr.setRequestHeader('X-EBAY-API-REQUEST-ENCODING', 'XML');
1135
    xhr.setRequestHeader('X-Proxy-URL', configeBayShopping);
1136
 
1137
    return true;
1138
}
1139
 
1140
    </script>
1141
 
1142
</body>
1143
</html>