Magento 2 PHP Fatal Error: Failed Opening Required ‘app/Mage.php’

magento2PHP

I'm trying to add a thumbnail image to the view order page in the account section with the following code but it doesn't do anything:

<td>
    <?php $_product = Mage::getModel('catalog/product')->load($_item->getId()); ?>
    <img src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="" />
</td>

I get the following error:
PHP Fatal error: main(): Failed opening required 'app/Mage.php'

require(__DIR__ . '/app/Mage.php');

Any ideas why this is not working?

Best Answer

In Magento 2, don't try to use Mage::getModel or Mage::helper. They are Magento 1 ways. In your case, you can follow this guide to get thumbnail image on order view page.