Stock Report With Image

I want to see stock reports with product image , is it possible?
i have added a column with image but it only shows image location , not images :frowning:

You can save this report as a custom script report and change the HTML to show the image instead of the url.

@crafter
Hi while saving this report , its throwing below error. How i can make this as custom report from here. Please advise

Not sure if there’s a better way but this can be done this with JavaScript.

// Not sure if there's an event that fires when a report table is populated,
// so I'm running it with a timer instead.
var intervalId = window.setInterval(function(){
  populate_images();
}, 1000);

function populate_images() {
    // This assumes the images go into the first column.
    $('.dt-cell__content--col-1').map(function(i,el) {
        var content = $(el).html().trim();
        if (content.charAt(0)==='/') {
             $(el).html('<img src="' + content + '">');
        }
    });
}

@cryptopunk you can do one thing for image render in report your fieldtype should be HTML & you can add string of img src in that fieldname…

1 Like

That works much better, thanks!