Show product_image on new module?main.CRITICAL: Plugin class doesn't existSet custom price of product when adding to cart code not workingMagento 2 : Problem while adding custom button order view page?Magento 2 Add new field to Magento_User admin formI have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridHow to get last ordered product details in Magento 2.2?Magento 2.2.5: Overriding Admin Controller sales/orderIs there a short method to achieve the Box login in Magento 2Magento 2 How to disable price from orders, customer account and order view if custom module is enabled?How to create custom form in Magento 2.2.3

Intern not wearing safety equipment; how could I have handled this differently?

Ping failure monitor

Array or vector? Two dimensional array or matrix?

Where are the Wazirs?

How can I review my manager, who is fine?

What's the difference between a type and a kind?

Which is a better conductor, a very thick rubber wire or a very thin copper wire?

Attach a visible light telescope to the outside of the ISS

Uniform initialization by tuple

Why does the Misal rico de Cisneros uses the word "Qiſſa", and what is it supposed to mean? Why not "Miſſa" (Missa)?

How did the IEC decide to create kibibytes?

Why did the frequency of the word "черт" (devil) in books increase by a few times since the October Revolution?

Possibility to correct pitch from digital versions of records with the hole not centered

Examples of fluid (including air) being used to transmit digital data?

How to evaluate the performance of open source solver?

Taking my Ph.D. advisor out for dinner after graduation

QR codes, do people use them?

Can a USB hub be used to access a drive from two devices?

How to deal with account scam and fraud?

Does anyone have a method of differentiating informative comments from commented out code?

Was the 45.9°C temperature in France in June 2019 the highest ever recorded in France?

What is the average number of draws it takes before you can not draw any more cards from the Deck of Many Things?

Why did Robert F. Kennedy loathe Lyndon B. Johnson?

NOLOCK or Read Uncommitted locking / latching behaviours



Show product_image on new module?


main.CRITICAL: Plugin class doesn't existSet custom price of product when adding to cart code not workingMagento 2 : Problem while adding custom button order view page?Magento 2 Add new field to Magento_User admin formI have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridHow to get last ordered product details in Magento 2.2?Magento 2.2.5: Overriding Admin Controller sales/orderIs there a short method to achieve the Box login in Magento 2Magento 2 How to disable price from orders, customer account and order view if custom module is enabled?How to create custom form in Magento 2.2.3






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm trying to display product_image on the custom_page :



enter image description here



Please Check my Code.and help me.




namespaceappcodeMagentoHistoryBlockHistoryData.php





  • I have:



    <?php
    namespace MagentoHistoryBlock;

    class HistoryData extends MagentoFrameworkViewElementTemplate


    public function __constructor(
    ..../Magento/Sales/Model/Order/Item $item....)

    ...
    $item = $item;
    ...



    public function getOrderData()
    $item = $this->item()->create()->getCollection()-
    >addFieldToSelect('*');
    return $item;




    And in this file




namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml




 <?php 
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->create('MagentoSalesModelOrderItem')-
>getCollection();
$orders->addFieldToSelect('*');
?>
<div class="table-wrapper order-items">
<table class="data table table-order-items" id="my-orders-table"
summary="<?=__('Items Ordered') ?>">
<caption class="table-caption"><?=__('Items Ordered') ?></caption>
<thead>
<tr>
<th class="col image"><?=__('Product Image') ?></th>
<th class="col name"><?=__('Product Name') ?></th>
<th class="col qty"><?=__('Qty') ?></th>
<th class="col price"><?=__('Price') ?></th>
<th class="col subtotal"><?=__('Subtotal') ?></th>
</tr>
</thead>
<tbody>
<?php foreach($orders as $item): ?>
<tr>
<td data-th="Product Image" class="col image"><?php echo
$item->getImage(); ?></td>
<td data-th="Product Name" class="col name"><?php echo
$item->getName(); ?></td>
<td data-th="Qty" class="col qty"><?php echo $item-
>getQtyOrdered(); ?></td>
<td data-th="Price" class="col price"><?php echo $item-
>getPrice(); ?></td>
<td data-th="Subtotal" class="col subtotal"><?php echo
$item->getBaseRowTotalInclTax(); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>


Can anyone help the next step to display image?? Thanks.










share|improve this question






























    0















    I'm trying to display product_image on the custom_page :



    enter image description here



    Please Check my Code.and help me.




    namespaceappcodeMagentoHistoryBlockHistoryData.php





    • I have:



      <?php
      namespace MagentoHistoryBlock;

      class HistoryData extends MagentoFrameworkViewElementTemplate


      public function __constructor(
      ..../Magento/Sales/Model/Order/Item $item....)

      ...
      $item = $item;
      ...



      public function getOrderData()
      $item = $this->item()->create()->getCollection()-
      >addFieldToSelect('*');
      return $item;




      And in this file




    namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml




     <?php 
    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $orders = $objectManager->create('MagentoSalesModelOrderItem')-
    >getCollection();
    $orders->addFieldToSelect('*');
    ?>
    <div class="table-wrapper order-items">
    <table class="data table table-order-items" id="my-orders-table"
    summary="<?=__('Items Ordered') ?>">
    <caption class="table-caption"><?=__('Items Ordered') ?></caption>
    <thead>
    <tr>
    <th class="col image"><?=__('Product Image') ?></th>
    <th class="col name"><?=__('Product Name') ?></th>
    <th class="col qty"><?=__('Qty') ?></th>
    <th class="col price"><?=__('Price') ?></th>
    <th class="col subtotal"><?=__('Subtotal') ?></th>
    </tr>
    </thead>
    <tbody>
    <?php foreach($orders as $item): ?>
    <tr>
    <td data-th="Product Image" class="col image"><?php echo
    $item->getImage(); ?></td>
    <td data-th="Product Name" class="col name"><?php echo
    $item->getName(); ?></td>
    <td data-th="Qty" class="col qty"><?php echo $item-
    >getQtyOrdered(); ?></td>
    <td data-th="Price" class="col price"><?php echo $item-
    >getPrice(); ?></td>
    <td data-th="Subtotal" class="col subtotal"><?php echo
    $item->getBaseRowTotalInclTax(); ?></td>
    </tr>
    <?php endforeach; ?>
    </tbody>
    </table>
    </div>


    Can anyone help the next step to display image?? Thanks.










    share|improve this question


























      0












      0








      0








      I'm trying to display product_image on the custom_page :



      enter image description here



      Please Check my Code.and help me.




      namespaceappcodeMagentoHistoryBlockHistoryData.php





      • I have:



        <?php
        namespace MagentoHistoryBlock;

        class HistoryData extends MagentoFrameworkViewElementTemplate


        public function __constructor(
        ..../Magento/Sales/Model/Order/Item $item....)

        ...
        $item = $item;
        ...



        public function getOrderData()
        $item = $this->item()->create()->getCollection()-
        >addFieldToSelect('*');
        return $item;




        And in this file




      namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml




       <?php 
      $objectManager = MagentoFrameworkAppObjectManager::getInstance();
      $orders = $objectManager->create('MagentoSalesModelOrderItem')-
      >getCollection();
      $orders->addFieldToSelect('*');
      ?>
      <div class="table-wrapper order-items">
      <table class="data table table-order-items" id="my-orders-table"
      summary="<?=__('Items Ordered') ?>">
      <caption class="table-caption"><?=__('Items Ordered') ?></caption>
      <thead>
      <tr>
      <th class="col image"><?=__('Product Image') ?></th>
      <th class="col name"><?=__('Product Name') ?></th>
      <th class="col qty"><?=__('Qty') ?></th>
      <th class="col price"><?=__('Price') ?></th>
      <th class="col subtotal"><?=__('Subtotal') ?></th>
      </tr>
      </thead>
      <tbody>
      <?php foreach($orders as $item): ?>
      <tr>
      <td data-th="Product Image" class="col image"><?php echo
      $item->getImage(); ?></td>
      <td data-th="Product Name" class="col name"><?php echo
      $item->getName(); ?></td>
      <td data-th="Qty" class="col qty"><?php echo $item-
      >getQtyOrdered(); ?></td>
      <td data-th="Price" class="col price"><?php echo $item-
      >getPrice(); ?></td>
      <td data-th="Subtotal" class="col subtotal"><?php echo
      $item->getBaseRowTotalInclTax(); ?></td>
      </tr>
      <?php endforeach; ?>
      </tbody>
      </table>
      </div>


      Can anyone help the next step to display image?? Thanks.










      share|improve this question
















      I'm trying to display product_image on the custom_page :



      enter image description here



      Please Check my Code.and help me.




      namespaceappcodeMagentoHistoryBlockHistoryData.php





      • I have:



        <?php
        namespace MagentoHistoryBlock;

        class HistoryData extends MagentoFrameworkViewElementTemplate


        public function __constructor(
        ..../Magento/Sales/Model/Order/Item $item....)

        ...
        $item = $item;
        ...



        public function getOrderData()
        $item = $this->item()->create()->getCollection()-
        >addFieldToSelect('*');
        return $item;




        And in this file




      namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml




       <?php 
      $objectManager = MagentoFrameworkAppObjectManager::getInstance();
      $orders = $objectManager->create('MagentoSalesModelOrderItem')-
      >getCollection();
      $orders->addFieldToSelect('*');
      ?>
      <div class="table-wrapper order-items">
      <table class="data table table-order-items" id="my-orders-table"
      summary="<?=__('Items Ordered') ?>">
      <caption class="table-caption"><?=__('Items Ordered') ?></caption>
      <thead>
      <tr>
      <th class="col image"><?=__('Product Image') ?></th>
      <th class="col name"><?=__('Product Name') ?></th>
      <th class="col qty"><?=__('Qty') ?></th>
      <th class="col price"><?=__('Price') ?></th>
      <th class="col subtotal"><?=__('Subtotal') ?></th>
      </tr>
      </thead>
      <tbody>
      <?php foreach($orders as $item): ?>
      <tr>
      <td data-th="Product Image" class="col image"><?php echo
      $item->getImage(); ?></td>
      <td data-th="Product Name" class="col name"><?php echo
      $item->getName(); ?></td>
      <td data-th="Qty" class="col qty"><?php echo $item-
      >getQtyOrdered(); ?></td>
      <td data-th="Price" class="col price"><?php echo $item-
      >getPrice(); ?></td>
      <td data-th="Subtotal" class="col subtotal"><?php echo
      $item->getBaseRowTotalInclTax(); ?></td>
      </tr>
      <?php endforeach; ?>
      </tbody>
      </table>
      </div>


      Can anyone help the next step to display image?? Thanks.







      magento2 magento2.3






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 28 at 9:35









      Magento_Bhurio

      7672 silver badges13 bronze badges




      7672 silver badges13 bronze badges










      asked Jun 28 at 9:10









      user81098user81098

      447 bronze badges




      447 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          1














          You can use the below code to get this done



          foreach ($orders as $item) 
          $_product = $objectManager->get('MagentoCatalogModelProduct')->load($item->getProductId());
          $imageHelper = $objectManager->get('MagentoCatalogHelperImage');
          $imageUrl = $imageHelper->init($_product, 'product_page_image_small')->setImageFile($_product->getImage())->resize(100, 100)->getUrl();



          Here You can use $imageUrl variable to show the image.



          Update your this file




          namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml




           <?php 
          $objectManager = MagentoFrameworkAppObjectManager::getInstance();
          $orders = $objectManager->create('MagentoSalesModelOrderItem')-
          >getCollection();
          $orders->addFieldToSelect('*');
          ?>
          <div class="table-wrapper order-items">
          <table class="data table table-order-items" id="my-orders-table"
          summary="<?=__('Items Ordered') ?>">
          <caption class="table-caption"><?=__('Items Ordered') ?></caption>
          <thead>
          <tr>
          <th class="col image"><?=__('Product Image') ?></th>
          <th class="col name"><?=__('Product Name') ?></th>
          <th class="col qty"><?=__('Qty') ?></th>
          <th class="col price"><?=__('Price') ?></th>
          <th class="col subtotal"><?=__('Subtotal') ?></th>
          </tr>
          </thead>
          <tbody>
          <?php foreach($orders as $item): ?>
          $_product = $objectManager->get('MagentoCatalogModelProduct')->load($item->getProductId());

          $imageHelper = $objectManager->get('MagentoCatalogHelperImage');

          $image_url = $imageHelper->init($_product, 'product_page_image_small')->setImageFile($_product->getImage())->resize(100, 100)->getUrl();
          ?>
          <tr>
          <td data-th="Product Image" class="col image"><img src="<?= $image_url ?>" width="75px" height="75px"></td>
          <td data-th="Product Name" class="col name"><?php echo
          $item->getName(); ?></td>
          <td data-th="Qty" class="col qty"><?php echo $item-
          >getQtyOrdered(); ?></td>
          <td data-th="Price" class="col price"><?php echo $item-
          >getPrice(); ?></td>
          <td data-th="Subtotal" class="col subtotal"><?php echo
          $item->getBaseRowTotalInclTax(); ?></td>
          </tr>
          <?php endforeach; ?>
          </tbody>
          </table>
          </div>


          I have checked it working.






          share|improve this answer

























          • I have updated my answer please check

            – Ravi Soni
            Jun 28 at 9:43











          • namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml , remove your all code. and put my code. which I mentioned in the answer.

            – Ravi Soni
            Jun 28 at 9:54











          • Check I have updated my code again.

            – Ravi Soni
            Jun 28 at 9:56











          • Yes...I will. Thaks

            – user81098
            Jun 28 at 9:57











          • Hi, Please mark as right answer if It's work.

            – Ravi Soni
            Jun 28 at 10:01













          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f280031%2fshow-product-image-on-new-module%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You can use the below code to get this done



          foreach ($orders as $item) 
          $_product = $objectManager->get('MagentoCatalogModelProduct')->load($item->getProductId());
          $imageHelper = $objectManager->get('MagentoCatalogHelperImage');
          $imageUrl = $imageHelper->init($_product, 'product_page_image_small')->setImageFile($_product->getImage())->resize(100, 100)->getUrl();



          Here You can use $imageUrl variable to show the image.



          Update your this file




          namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml




           <?php 
          $objectManager = MagentoFrameworkAppObjectManager::getInstance();
          $orders = $objectManager->create('MagentoSalesModelOrderItem')-
          >getCollection();
          $orders->addFieldToSelect('*');
          ?>
          <div class="table-wrapper order-items">
          <table class="data table table-order-items" id="my-orders-table"
          summary="<?=__('Items Ordered') ?>">
          <caption class="table-caption"><?=__('Items Ordered') ?></caption>
          <thead>
          <tr>
          <th class="col image"><?=__('Product Image') ?></th>
          <th class="col name"><?=__('Product Name') ?></th>
          <th class="col qty"><?=__('Qty') ?></th>
          <th class="col price"><?=__('Price') ?></th>
          <th class="col subtotal"><?=__('Subtotal') ?></th>
          </tr>
          </thead>
          <tbody>
          <?php foreach($orders as $item): ?>
          $_product = $objectManager->get('MagentoCatalogModelProduct')->load($item->getProductId());

          $imageHelper = $objectManager->get('MagentoCatalogHelperImage');

          $image_url = $imageHelper->init($_product, 'product_page_image_small')->setImageFile($_product->getImage())->resize(100, 100)->getUrl();
          ?>
          <tr>
          <td data-th="Product Image" class="col image"><img src="<?= $image_url ?>" width="75px" height="75px"></td>
          <td data-th="Product Name" class="col name"><?php echo
          $item->getName(); ?></td>
          <td data-th="Qty" class="col qty"><?php echo $item-
          >getQtyOrdered(); ?></td>
          <td data-th="Price" class="col price"><?php echo $item-
          >getPrice(); ?></td>
          <td data-th="Subtotal" class="col subtotal"><?php echo
          $item->getBaseRowTotalInclTax(); ?></td>
          </tr>
          <?php endforeach; ?>
          </tbody>
          </table>
          </div>


          I have checked it working.






          share|improve this answer

























          • I have updated my answer please check

            – Ravi Soni
            Jun 28 at 9:43











          • namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml , remove your all code. and put my code. which I mentioned in the answer.

            – Ravi Soni
            Jun 28 at 9:54











          • Check I have updated my code again.

            – Ravi Soni
            Jun 28 at 9:56











          • Yes...I will. Thaks

            – user81098
            Jun 28 at 9:57











          • Hi, Please mark as right answer if It's work.

            – Ravi Soni
            Jun 28 at 10:01















          1














          You can use the below code to get this done



          foreach ($orders as $item) 
          $_product = $objectManager->get('MagentoCatalogModelProduct')->load($item->getProductId());
          $imageHelper = $objectManager->get('MagentoCatalogHelperImage');
          $imageUrl = $imageHelper->init($_product, 'product_page_image_small')->setImageFile($_product->getImage())->resize(100, 100)->getUrl();



          Here You can use $imageUrl variable to show the image.



          Update your this file




          namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml




           <?php 
          $objectManager = MagentoFrameworkAppObjectManager::getInstance();
          $orders = $objectManager->create('MagentoSalesModelOrderItem')-
          >getCollection();
          $orders->addFieldToSelect('*');
          ?>
          <div class="table-wrapper order-items">
          <table class="data table table-order-items" id="my-orders-table"
          summary="<?=__('Items Ordered') ?>">
          <caption class="table-caption"><?=__('Items Ordered') ?></caption>
          <thead>
          <tr>
          <th class="col image"><?=__('Product Image') ?></th>
          <th class="col name"><?=__('Product Name') ?></th>
          <th class="col qty"><?=__('Qty') ?></th>
          <th class="col price"><?=__('Price') ?></th>
          <th class="col subtotal"><?=__('Subtotal') ?></th>
          </tr>
          </thead>
          <tbody>
          <?php foreach($orders as $item): ?>
          $_product = $objectManager->get('MagentoCatalogModelProduct')->load($item->getProductId());

          $imageHelper = $objectManager->get('MagentoCatalogHelperImage');

          $image_url = $imageHelper->init($_product, 'product_page_image_small')->setImageFile($_product->getImage())->resize(100, 100)->getUrl();
          ?>
          <tr>
          <td data-th="Product Image" class="col image"><img src="<?= $image_url ?>" width="75px" height="75px"></td>
          <td data-th="Product Name" class="col name"><?php echo
          $item->getName(); ?></td>
          <td data-th="Qty" class="col qty"><?php echo $item-
          >getQtyOrdered(); ?></td>
          <td data-th="Price" class="col price"><?php echo $item-
          >getPrice(); ?></td>
          <td data-th="Subtotal" class="col subtotal"><?php echo
          $item->getBaseRowTotalInclTax(); ?></td>
          </tr>
          <?php endforeach; ?>
          </tbody>
          </table>
          </div>


          I have checked it working.






          share|improve this answer

























          • I have updated my answer please check

            – Ravi Soni
            Jun 28 at 9:43











          • namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml , remove your all code. and put my code. which I mentioned in the answer.

            – Ravi Soni
            Jun 28 at 9:54











          • Check I have updated my code again.

            – Ravi Soni
            Jun 28 at 9:56











          • Yes...I will. Thaks

            – user81098
            Jun 28 at 9:57











          • Hi, Please mark as right answer if It's work.

            – Ravi Soni
            Jun 28 at 10:01













          1












          1








          1







          You can use the below code to get this done



          foreach ($orders as $item) 
          $_product = $objectManager->get('MagentoCatalogModelProduct')->load($item->getProductId());
          $imageHelper = $objectManager->get('MagentoCatalogHelperImage');
          $imageUrl = $imageHelper->init($_product, 'product_page_image_small')->setImageFile($_product->getImage())->resize(100, 100)->getUrl();



          Here You can use $imageUrl variable to show the image.



          Update your this file




          namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml




           <?php 
          $objectManager = MagentoFrameworkAppObjectManager::getInstance();
          $orders = $objectManager->create('MagentoSalesModelOrderItem')-
          >getCollection();
          $orders->addFieldToSelect('*');
          ?>
          <div class="table-wrapper order-items">
          <table class="data table table-order-items" id="my-orders-table"
          summary="<?=__('Items Ordered') ?>">
          <caption class="table-caption"><?=__('Items Ordered') ?></caption>
          <thead>
          <tr>
          <th class="col image"><?=__('Product Image') ?></th>
          <th class="col name"><?=__('Product Name') ?></th>
          <th class="col qty"><?=__('Qty') ?></th>
          <th class="col price"><?=__('Price') ?></th>
          <th class="col subtotal"><?=__('Subtotal') ?></th>
          </tr>
          </thead>
          <tbody>
          <?php foreach($orders as $item): ?>
          $_product = $objectManager->get('MagentoCatalogModelProduct')->load($item->getProductId());

          $imageHelper = $objectManager->get('MagentoCatalogHelperImage');

          $image_url = $imageHelper->init($_product, 'product_page_image_small')->setImageFile($_product->getImage())->resize(100, 100)->getUrl();
          ?>
          <tr>
          <td data-th="Product Image" class="col image"><img src="<?= $image_url ?>" width="75px" height="75px"></td>
          <td data-th="Product Name" class="col name"><?php echo
          $item->getName(); ?></td>
          <td data-th="Qty" class="col qty"><?php echo $item-
          >getQtyOrdered(); ?></td>
          <td data-th="Price" class="col price"><?php echo $item-
          >getPrice(); ?></td>
          <td data-th="Subtotal" class="col subtotal"><?php echo
          $item->getBaseRowTotalInclTax(); ?></td>
          </tr>
          <?php endforeach; ?>
          </tbody>
          </table>
          </div>


          I have checked it working.






          share|improve this answer















          You can use the below code to get this done



          foreach ($orders as $item) 
          $_product = $objectManager->get('MagentoCatalogModelProduct')->load($item->getProductId());
          $imageHelper = $objectManager->get('MagentoCatalogHelperImage');
          $imageUrl = $imageHelper->init($_product, 'product_page_image_small')->setImageFile($_product->getImage())->resize(100, 100)->getUrl();



          Here You can use $imageUrl variable to show the image.



          Update your this file




          namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml




           <?php 
          $objectManager = MagentoFrameworkAppObjectManager::getInstance();
          $orders = $objectManager->create('MagentoSalesModelOrderItem')-
          >getCollection();
          $orders->addFieldToSelect('*');
          ?>
          <div class="table-wrapper order-items">
          <table class="data table table-order-items" id="my-orders-table"
          summary="<?=__('Items Ordered') ?>">
          <caption class="table-caption"><?=__('Items Ordered') ?></caption>
          <thead>
          <tr>
          <th class="col image"><?=__('Product Image') ?></th>
          <th class="col name"><?=__('Product Name') ?></th>
          <th class="col qty"><?=__('Qty') ?></th>
          <th class="col price"><?=__('Price') ?></th>
          <th class="col subtotal"><?=__('Subtotal') ?></th>
          </tr>
          </thead>
          <tbody>
          <?php foreach($orders as $item): ?>
          $_product = $objectManager->get('MagentoCatalogModelProduct')->load($item->getProductId());

          $imageHelper = $objectManager->get('MagentoCatalogHelperImage');

          $image_url = $imageHelper->init($_product, 'product_page_image_small')->setImageFile($_product->getImage())->resize(100, 100)->getUrl();
          ?>
          <tr>
          <td data-th="Product Image" class="col image"><img src="<?= $image_url ?>" width="75px" height="75px"></td>
          <td data-th="Product Name" class="col name"><?php echo
          $item->getName(); ?></td>
          <td data-th="Qty" class="col qty"><?php echo $item-
          >getQtyOrdered(); ?></td>
          <td data-th="Price" class="col price"><?php echo $item-
          >getPrice(); ?></td>
          <td data-th="Subtotal" class="col subtotal"><?php echo
          $item->getBaseRowTotalInclTax(); ?></td>
          </tr>
          <?php endforeach; ?>
          </tbody>
          </table>
          </div>


          I have checked it working.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jun 28 at 11:13

























          answered Jun 28 at 9:28









          Ravi SoniRavi Soni

          1,0315 silver badges18 bronze badges




          1,0315 silver badges18 bronze badges












          • I have updated my answer please check

            – Ravi Soni
            Jun 28 at 9:43











          • namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml , remove your all code. and put my code. which I mentioned in the answer.

            – Ravi Soni
            Jun 28 at 9:54











          • Check I have updated my code again.

            – Ravi Soni
            Jun 28 at 9:56











          • Yes...I will. Thaks

            – user81098
            Jun 28 at 9:57











          • Hi, Please mark as right answer if It's work.

            – Ravi Soni
            Jun 28 at 10:01

















          • I have updated my answer please check

            – Ravi Soni
            Jun 28 at 9:43











          • namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml , remove your all code. and put my code. which I mentioned in the answer.

            – Ravi Soni
            Jun 28 at 9:54











          • Check I have updated my code again.

            – Ravi Soni
            Jun 28 at 9:56











          • Yes...I will. Thaks

            – user81098
            Jun 28 at 9:57











          • Hi, Please mark as right answer if It's work.

            – Ravi Soni
            Jun 28 at 10:01
















          I have updated my answer please check

          – Ravi Soni
          Jun 28 at 9:43





          I have updated my answer please check

          – Ravi Soni
          Jun 28 at 9:43













          namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml , remove your all code. and put my code. which I mentioned in the answer.

          – Ravi Soni
          Jun 28 at 9:54





          namespaceappcodeMagentoHistoryviewfrontendtemplateshistory.phtml , remove your all code. and put my code. which I mentioned in the answer.

          – Ravi Soni
          Jun 28 at 9:54













          Check I have updated my code again.

          – Ravi Soni
          Jun 28 at 9:56





          Check I have updated my code again.

          – Ravi Soni
          Jun 28 at 9:56













          Yes...I will. Thaks

          – user81098
          Jun 28 at 9:57





          Yes...I will. Thaks

          – user81098
          Jun 28 at 9:57













          Hi, Please mark as right answer if It's work.

          – Ravi Soni
          Jun 28 at 10:01





          Hi, Please mark as right answer if It's work.

          – Ravi Soni
          Jun 28 at 10:01

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f280031%2fshow-product-image-on-new-module%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

          Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?