Rev 68 | Blame | Compare with Previous | Last modification | View Log | RSS feed
function findProductInfo(IDValue) {// Construct the findProduct requesturl = configeBayShopping;url += "?callname=FindProducts";url += "&responseencoding=JSON";url += "&appid=" + configAppid;url += "&version=1061";url += "&siteid=0";url += "&AvailableItemsOnly=true";url += "&MaxEntries=1";url += "&ProductID.Type=Reference";url += "&ProductID.Value=";url += IDValue;// Submit the requestvar xhttp = new XMLHttpRequest();xhttp.onreadystatechange = function() {if (this.readyState == 4 && this.status == 200) {_cb_FindProducts(JSON.parse(this.responseText));}};xhttp.open("GET", configProxyUrl, true);xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));xhttp.send();}// Create new page for product infofunction _cb_FindProducts(root) {var str;var x;var ack = root.Ack;if (ack != 'Success') {x = document.getElementById("warnings");str = '<div class="alert alert-danger alert-dismissible">';str += '<button type="button" class="close" data-dismiss="alert">×</button>';str += "<h2>eBay API Error<h2>";str += "<ul>";str += "<li>Id: " + root.Errors[0].ErrorCode + "</li>";str += "<li>Domain: " + root.Errors[0].ErrorClassification + "</li>";str += "<li>Severity: " + root.Errors[0].SeverityCode + "</li>";str += "<li>Category: " + root.Errors[0].category + "</li>";str += "<li>Short Message: " + root.Errors[0].ShortMessage + "</li>";str += "<li>Long Message: " + root.Errors[0].LongMessage + "</li>";str += "<li>Build/Version: " + root.Build + '/' + root.Version + "</li>";str += "</ul>";str += "<p>URL: " + "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a>" + "</p>";str += "</div>";x.innerHTML = str;x.className = x.className.replace(" invisible", " visible");if (ack == 'Failure' || ack == 'PartialFailure') {x.scrollIntoView(true);return;}}str = "";var i = 0;var JsonObj = typeof root.Product != 'object' ? JSON.parse(root.Product) : root.Product;var Title = JsonObj[0].Title;str = '<!DOCTYPE html>';str += '<html lang="en">';str += '<head>';str += '<title>' + Title + '</title>';str += '<meta charset="UTF-8">';str += '<meta name="viewport" content="width=device-width, initial-scale=1.0">';str += '<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">';str += '<link rel="icon" href="favicon.ico" type="image/x-icon">';str += '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">';str += '<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"><\/script>';str += '<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"><\/script>';str += '<link rel="stylesheet" href="css/style.css">';str += '<script src="js/muna-tools.js"><\/script>';str += '</head>';str += '<body>';str += '<div class="container-fluid">';str += '<div class="container-fluid border bg-secondary">';str += '<div class="clearfix">';str += '<img class="img-fluid float-right" src="images/MUNA%20-%20Logo%20100x100.png" alt="MUNA Trading Logo">';str += '<h2>' + Title + '</h2>';str += '</div>';str += '</div>';str += '<div class="container-fluid border bg-light">';str += '<div class="row">';str += '<div class="col">';str += '<h2>Detailed Product Information</h2>';if (JsonObj[0].StockPhotoURL) {str += '<a href="' + JsonObj[0].DetailsURL + '" target="_blank">';str += '<img src="' + JsonObj[0].StockPhotoURL + '">';str += '</a>';}if (JsonObj[0].ItemSpecifics) {str += '<p>';for (i = 0; i < JsonObj[0].ItemSpecifics.NameValueList.length; i++) {str += JsonObj[0].ItemSpecifics.NameValueList[i].Name + ': ' + JsonObj[0].ItemSpecifics.NameValueList[i].Value + '<br/>';}str += '</p>';}if (JsonObj[0].ProductID) {str += '<p>';for (i = 0; i < JsonObj[0].ProductID.length; i++) {str += JsonObj[0].ProductID[i].Type + ': ' + JsonObj[0].ProductID[i].Value + '<br/>';}str += '</p>';}str += '</div>';str += '</div>';str += '</div>';str += '<footer class="container-fluid text-center border border-bottom-0 border-left-0 border-right-0">';str += 'Copyright © ' + new Date().getFullYear() + ' MUNA Trading. All rights reserved.';str += '</footer>';str += '</div>';str += '</body>';str += '</html>';var newWin = window.open("", Title);if (newWin) {newWin.document.open().write(str);newWin.document.close();}}