Skip to main content
added 91 characters in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

instead of use $_item->getProduct()->getId()

You should use sku $_item->getSku();

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('\Magento\Catalog\Model\ProductFactory'->create());
$product = $this->productFactory->create();
$product->load($product->getIdBySku($_item->getSku()));
$thitem = $_product$product->getThumbnail();

$fullImageUrl =$block->getUrl('pub/media/catalog').'product'.$product->getThumbnail()

Suggestion:

Use of direct product object is not good idea

Also suggest to inject \Magento\Catalog\Model\ProductFactory to your block class

instead of use $_item->getProduct()->getId()

You should use sku $_item->getSku();

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('\Magento\Catalog\Model\ProductFactory'->create());
$product = $this->productFactory->create();
$product->load($product->getIdBySku($_item->getSku()));
$thitem = $_product->getThumbnail();

Suggestion:

Use of direct product object is not good idea

Also suggest to inject \Magento\Catalog\Model\ProductFactory to your block class

instead of use $_item->getProduct()->getId()

You should use sku $_item->getSku();

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('\Magento\Catalog\Model\ProductFactory'->create());
$product = $this->productFactory->create();
$product->load($product->getIdBySku($_item->getSku()));
$thitem = $product->getThumbnail();

$fullImageUrl =$block->getUrl('pub/media/catalog').'product'.$product->getThumbnail()

Suggestion:

Use of direct product object is not good idea

Also suggest to inject \Magento\Catalog\Model\ProductFactory to your block class

Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

instead of use $_item->getProduct()->getId()

You should use sku $_item->getSku();

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('\Magento\Catalog\Model\ProductFactory'->create());
$product = $this->productFactory->create();
$product->load($product->getIdBySku($_item->getSku()));
$thitem = $_product->getThumbnail();

Suggestion:

Use of direct product object is not good idea

Also suggest to inject \Magento\Catalog\Model\ProductFactory to your block class