#StackBounty: #magento2 #catalog #admin-panel #thumbnail Replace thumbnail with small image in Admin Catalog Products

Bounty: 50

I’d like to display "small image" in place of "thumbnail image" for each product in magento administration Catalog > Products.

I tried editing file /vendor/magento/module-catalog/Ui/Component/Listing/Columns/Thumbnail.php like this:

public function prepareDataSource(array $dataSource)
        if (isset($dataSource['data']['items'])) {
            $fieldName = $this->getData('name');
            foreach ($dataSource['data']['items'] as & $item) {
                $product = new MagentoFrameworkDataObject($item);
                $imageHelper = $this->imageHelper->init($product, 'small_image');
                $item[$fieldName . '_src'] = $imageHelper->getUrl();
                $item[$fieldName . '_alt'] = $this->getAlt($item) ?: $imageHelper->getLabel();
                $item[$fieldName . '_link'] = $this->urlBuilder->getUrl(
                    ['id' => $product->getEntityId(), 'store' => $this->context->getRequestParam('store')]
                $origImageHelper = $this->imageHelper->init($product, 'small_image');
                $item[$fieldName . '_orig_src'] = $origImageHelper->getUrl();

        return $dataSource;

but it didn’t work. Any ideas?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.