2

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?

4

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.

0

There is no more exist Mage class in magento2

You can use Model class only through objectManager or Factory method.

How to instantiate a model in magento2, you can take help from here: Link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.