Subversion Repositories munaweb

Rev

Rev 2 | Rev 5 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 4
Line 213... Line 213...
213
    xhttp.send();
213
    xhttp.send();
214
 
214
 
215
    return false;
215
    return false;
216
}
216
}
217
 
217
 
218
function printeBayAPIError(root) {
218
function printeBayAPIError(str, root) {
219
    var x = document.getElementById("results");
219
    var x = document.getElementById("results");
220
    x.className += " process-errors";
220
    x.className += " process-errors";
221
    x.innerHTML += "<h2>eBay API Error<h2>";
221
    x.innerHTML += "<h2>eBay API Error (" + str + ")<h2>";
222
    x.innerHTML += "<p>Id: " + root.errorMessage[0].error[0].errorId + "<br/>";
222
    x.innerHTML += "<p>Id: " + root.errorMessage[0].error[0].errorId + "<br/>";
223
    x.innerHTML += "<p>Severity: " + root.errorMessage[0].error[0].severity + "<br/>";
223
    x.innerHTML += "<p>Severity: " + root.errorMessage[0].error[0].severity + "<br/>";
224
    x.innerHTML += "<p>Message: " + root.errorMessage[0].error[0].message + "</p>";
224
    x.innerHTML += "<p>Message: " + root.errorMessage[0].error[0].message + "</p>";
225
}
225
}
226
 
226
 
Line 228... Line 228...
228
function _cb_findItemsAdvanced(root) {
228
function _cb_findItemsAdvanced(root) {
229
    // Error Handling
229
    // Error Handling
230
    var response = root.findItemsAdvancedResponse[0];
230
    var response = root.findItemsAdvancedResponse[0];
231
    var ack = response.ack;
231
    var ack = response.ack;
232
    if (ack != 'Success') {
232
    if (ack != 'Success') {
233
        printeBayAPIError(response);
233
        printeBayAPIError('Find Item', response);
234
 
234
 
235
        if (ack == 'Failure' || ack == 'PartialFailure') {
235
        if (ack == 'Failure' || ack == 'PartialFailure') {
236
            --pagesToProcess;
236
            --pagesToProcess;
237
            return;
237
            return;
238
        }
238
        }
Line 634... Line 634...
634
    productsToPrice = 0;
634
    productsToPrice = 0;
635
    maxProductsToPrice = 0;
635
    maxProductsToPrice = 0;
636
    productsPriced = 0;
636
    productsPriced = 0;
637
 
637
 
638
    for (i = 1; i < x.rows.length; i++) {
638
    for (i = 1; i < x.rows.length; i++) {
-
 
639
        if (x.rows[i].cells[4].innerText.length > 0) {
639
        ++productsToPrice;
640
            ++productsToPrice;
640
        ++maxProductsToPrice;
641
            ++maxProductsToPrice;
641
        findProductPrices(x.rows[i].cells[4].innerText, 1);
642
            findProductPrices(x.rows[i].cells[4].innerText, 1);
-
 
643
        }
642
    }
644
    }
643
 
645
 
644
    function checkProductsToPrice() {
646
    function checkProductsToPrice() {
645
        if (productsToPrice > 0) {
647
        if (productsToPrice > 0) {
646
            window.setTimeout(checkProductsToPrice, 100); // wait 100 milliseconds
648
            window.setTimeout(checkProductsToPrice, 100); // wait 100 milliseconds
Line 732... Line 734...
732
}
734
}
733
 
735
 
734
function findProductPrices(productId, pageNumber) {
736
function findProductPrices(productId, pageNumber) {
735
    var n = productId.indexOf(" ");
737
    var n = productId.indexOf(" ");
736
    var productIdType = productId.substr(0, n);
738
    var productIdType = productId.substr(0, n);
737
    productId = productId.substr(n + 1);
739
    var keyword = productId.substr(n + 1);
738
 
740
 
739
    url = configeBayFinding + "?";
741
    url = configeBayFinding + "?";
740
    if (productIdType == 'ReferenceID') {
742
    if (productIdType == 'ReferenceID') {
741
        url += "OPERATION-NAME=findItemsByProduct";
743
        url += "OPERATION-NAME=findItemsByProduct";
742
    } else {
744
    } else {
Line 754... Line 756...
754
 
756
 
755
    if (productIdType == 'ReferenceID') {
757
    if (productIdType == 'ReferenceID') {
756
        url += "&productId.@type=";
758
        url += "&productId.@type=";
757
        url += productIdType;
759
        url += productIdType;
758
        url += "&productId=";
760
        url += "&productId=";
759
        url += productId;
761
        url += keyword;
760
    } else {
762
    } else {
761
        url += "&keywords=";
763
        url += "&keywords=";
762
        url += productId;
764
        url += keyword;
763
    }
765
    }
764
 
766
 
765
    url += "&itemFilter(0).name=ExcludeSeller";
767
    url += "&itemFilter(0).name=ExcludeSeller";
766
    url += "&itemFilter(0).value=";
768
    url += "&itemFilter(0).value=";
767
    url += configeBaySellerName;
769
    url += configeBaySellerName;
Line 776... Line 778...
776
 
778
 
777
 
779
 
778
    xhttp.open("GET", configProxyUrl, true);
780
    xhttp.open("GET", configProxyUrl, true);
779
    xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
781
    xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
780
    xhttp.send();
782
    xhttp.send();
-
 
783
   
781
}
784
}
782
 
785
 
783
function _cb_findProductPrices(root) {
786
function _cb_findProductPrices(root) {
784
    var array;
787
    var array;
785
    var response;
788
    var response;
Line 812... Line 815...
812
        return;
815
        return;
813
    }
816
    }
814
 
817
 
815
    ack = response.ack;
818
    ack = response.ack;
816
    if (ack != 'Success') {
819
    if (ack != 'Success') {
817
        printeBayAPIError(response);
820
        printeBayAPIError('Get Prices', response);
818
 
821
 
819
        if (ack == 'Failure' || ack == 'PartialFailure') {
822
        if (ack == 'Failure' || ack == 'PartialFailure') {
820
            --productsToPrice;
823
            --productsToPrice;
821
            ++productsPriced;
824
            ++productsPriced;
822
            updateProgressBar(maxProductsToPrice, productsPriced);
825
            updateProgressBar(maxProductsToPrice, productsPriced);