Skip to content

Instantly share code, notes, and snippets.

@joeyemery
Created August 21, 2015 19:01
Show Gist options
  • Save joeyemery/b902f434e7390fff2606 to your computer and use it in GitHub Desktop.
Save joeyemery/b902f434e7390fff2606 to your computer and use it in GitHub Desktop.
```` /*$output .= "<script>
$(function() {
var orderId = " . $order->getOriginalQuote()->getId() . ";
$.ajax({
url: 'http://api.molekula.com/third-party/v1/pickingslip-scanner/' + orderId + '/images',
type: 'GET',
dataType: 'json'
})
.done(function(data) {
if (data.status_code != 200) {
$('#{$line->getId()} .order-line-images').each(function() {
$(this).text('No image found');
});
return false;
}
$('#" . $line->getId() . " .order-line-images').each(function() {
var id = {$line->getId()};
if (id == 90004692) {
$(this).html('&nbsp;');
} else {
if (data.data[id] !== undefined) {
$(this).html('<img src=\"data:image/jpeg;base64,' + data.data[id] + '\" class=\"img-responsive modal-image\" height=\"100\" width=\"100\" data-order-id=\"' + id + '\">');
} else if (data.data[$(this).attr('data-order-id')] !== undefined) {
$(this).html('<img src=\"data:image/jpeg;base64,' + data.data[$(this).attr('data-order-id')] + '\" class=\"img-responsive modal-image\" height=\"100\" width=\"100\" data-order-id=\"' + id + '\">');
}
}
});
})
.fail(function() {
$('#{$line->getId()} .order-line-images').each(function() {
$(this).text('No image found');
});
});
$('.evidence-fix').live('dblclick', function() {
$.ajax({
url: 'http://api.molekula.com/third-party/v1/pickingslip-scanner/' + orderId + '/fix-images',
type: 'GET',
dataType: 'json',
async: false
})
.done(function(data) {
if (data.status_code != 200) {
$('#{$line->getId()} .order-line-images').each(function() {
$(this).text('No image found');
});
return false;
}
$.ajax({
url: 'http://api.molekula.com/third-party/v1/pickingslip-scanner/' + orderId + '/images',
type: 'GET',
dataType: 'json',
async: false
})
.done(function(data) {
if (data.status_code != 200) {
$('#{$line->getId()} .order-line-images').each(function() {
$(this).text('No image found');
});
return false;
}
$('#" . $line->getId() . " .order-line-images').each(function() {
var id = $(this).attr('data-order-id');
if (id == 90004692) {
$(this).html('&nbsp;');
} else {
$(this).html('<img src=\"data:image/jpeg;base64,' + data.data[id] + '\" class=\"img-responsive modal-image\" height=\"100\" width=\"100\">');
}
});
})
.fail(function() {
$('#{$line->getId()} .order-line-images').each(function() {
$(this).text('No image found');
});
});
})
.fail(function() {
$('#{$line->getId()} .order-line-images').each(function() {
$(this).text('No image found');
});
});
});
});
</script>";*/````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment