How to display product by using order Item_Id in Magento 2?How to get Quantity Order for product to display on Product PageGetting the product info from different store in checkout processHow to add product in Magento using REST API?Display Product Id & Name of Order in custom pageMagento : How to Display Products as Default Display ProductMagento 2 Add new field to Magento_User admin formMagento 2: How to display the category in product URL?Magento 2 - How to add,save,display custom Field in Product Edit form using UiComponent?How to create custom form in Magento 2.2.3How do I add product data and directly to the database, which tables need to be updated in what order?

Evaluate the limit the following series

How important are the Author's mood and feelings for writing a story?

How to get a type of "screech" on guitar

How to determine Platform Event Size in Apex to ensure to be within < 1 MB

Are there any satellites in geosynchronous but not geostationary orbits?

What is a Romeo Word™?

Why are there few or no black super GMs?

How should I interpret a promising preprint that was never published in a peer-reviewed journal?

"Je suis petite, moi?", purpose of the "moi"?

Why should fork() have been designed to return a file descriptor?

Do Australia and New Zealand have a travel ban on Somalis (like Wikipedia says)?

Why did my "seldom" get corrected?

To what extent does asymmetric cryptography secure bitcoin transactions?

Simplest instruction set that has an c++/C compiler to write an emulator for?

What would be the safest way to drop thousands of small, hard objects from a typical, high wing, GA airplane?

Do higher dimensions have axes?

Function over a list that depends on the index

Does unblocking power bar outlets through short extension cords increase fire risk?

Does a hash function have a Upper bound on input length?

Suggestions for how to track down the source of this force:source:push error?

I want light controlled by one switch, not two

What are my hardware upgrade optoins for a late 2009 iMac?

Equality of complex numbers in general

Extract the attribute names from a large number of Shapefiles



How to display product by using order Item_Id in Magento 2?


How to get Quantity Order for product to display on Product PageGetting the product info from different store in checkout processHow to add product in Magento using REST API?Display Product Id & Name of Order in custom pageMagento : How to Display Products as Default Display ProductMagento 2 Add new field to Magento_User admin formMagento 2: How to display the category in product URL?Magento 2 - How to add,save,display custom Field in Product Edit form using UiComponent?How to create custom form in Magento 2.2.3How do I add product data and directly to the database, which tables need to be updated in what order?






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








0















I'm trying to show product detail by order Item_Id. I have this page:



enter image description here



When we click on Order Detail, it will get the item (2) to show product detail we've chosen. Here is my code to show this page:



<?php 
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->
create('MagentoSalesModelOrderItem')->getCollection();

echo "<p style='color:red;
font-size:20px;'>
Product Ordered
</p>";
?>
<div class="table-wrapper orders-history">
<table class="data table table-order-items history" id="my-orders-
table">
<caption class="table-caption"><?= $block->escapeHtml(__('Orders'))
?></caption>
<thead>
<tr>
<th scope="col" class="col orderitemid"> <?= $block->escapeHtml(__('OrderItem' )) ?></th>
<th scope="col" class="col image "> <?= $block->escapeHtml(__('Product Image')) ?></th>
<th scope="col" class="col name "> <?= $block->escapeHtml(__('Product Name' )) ?></th>
<th scope="col" class="col Qty "> <?= $block->escapeHtml(__('Qty' )) ?></th>
<th scope="col" class="col Price "> <?= $block->escapeHtml(__('Price' )) ?></th>
<th scope="col" class="col Total "> <?= $block->escapeHtml(__('Total' )) ?></th>
<th scope="col" class="col Action "> <?= $block->escapeHtml(__('Action' )) ?></th>
</tr>
</thead>
<tbody>
<?php foreach($orders as $item): ?>
<?php
$_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="OrderItem "class="col orderitemid"> <?php echo $item->getItemId(); ?></td>
<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>

<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions">
<a href="<?php echo $this->getUrl('history/detail/display',['item_id' => $item->getItemId()]); ?>">Order Detail</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>




Can anyone help the next step?
Thanks a lot.










share|improve this question
























  • You want to redirect to product page?

    – Rohan Hapani
    Jul 11 at 8:55











  • Hi @Rohan. Could you tell me how can I get productUrl to redirect to product page??

    – Michael Tao
    Jul 17 at 9:09











  • Please check my answer. using that you can get product URL.

    – Rohan Hapani
    Jul 17 at 9:12

















0















I'm trying to show product detail by order Item_Id. I have this page:



enter image description here



When we click on Order Detail, it will get the item (2) to show product detail we've chosen. Here is my code to show this page:



<?php 
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->
create('MagentoSalesModelOrderItem')->getCollection();

echo "<p style='color:red;
font-size:20px;'>
Product Ordered
</p>";
?>
<div class="table-wrapper orders-history">
<table class="data table table-order-items history" id="my-orders-
table">
<caption class="table-caption"><?= $block->escapeHtml(__('Orders'))
?></caption>
<thead>
<tr>
<th scope="col" class="col orderitemid"> <?= $block->escapeHtml(__('OrderItem' )) ?></th>
<th scope="col" class="col image "> <?= $block->escapeHtml(__('Product Image')) ?></th>
<th scope="col" class="col name "> <?= $block->escapeHtml(__('Product Name' )) ?></th>
<th scope="col" class="col Qty "> <?= $block->escapeHtml(__('Qty' )) ?></th>
<th scope="col" class="col Price "> <?= $block->escapeHtml(__('Price' )) ?></th>
<th scope="col" class="col Total "> <?= $block->escapeHtml(__('Total' )) ?></th>
<th scope="col" class="col Action "> <?= $block->escapeHtml(__('Action' )) ?></th>
</tr>
</thead>
<tbody>
<?php foreach($orders as $item): ?>
<?php
$_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="OrderItem "class="col orderitemid"> <?php echo $item->getItemId(); ?></td>
<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>

<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions">
<a href="<?php echo $this->getUrl('history/detail/display',['item_id' => $item->getItemId()]); ?>">Order Detail</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>




Can anyone help the next step?
Thanks a lot.










share|improve this question
























  • You want to redirect to product page?

    – Rohan Hapani
    Jul 11 at 8:55











  • Hi @Rohan. Could you tell me how can I get productUrl to redirect to product page??

    – Michael Tao
    Jul 17 at 9:09











  • Please check my answer. using that you can get product URL.

    – Rohan Hapani
    Jul 17 at 9:12













0












0








0








I'm trying to show product detail by order Item_Id. I have this page:



enter image description here



When we click on Order Detail, it will get the item (2) to show product detail we've chosen. Here is my code to show this page:



<?php 
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->
create('MagentoSalesModelOrderItem')->getCollection();

echo "<p style='color:red;
font-size:20px;'>
Product Ordered
</p>";
?>
<div class="table-wrapper orders-history">
<table class="data table table-order-items history" id="my-orders-
table">
<caption class="table-caption"><?= $block->escapeHtml(__('Orders'))
?></caption>
<thead>
<tr>
<th scope="col" class="col orderitemid"> <?= $block->escapeHtml(__('OrderItem' )) ?></th>
<th scope="col" class="col image "> <?= $block->escapeHtml(__('Product Image')) ?></th>
<th scope="col" class="col name "> <?= $block->escapeHtml(__('Product Name' )) ?></th>
<th scope="col" class="col Qty "> <?= $block->escapeHtml(__('Qty' )) ?></th>
<th scope="col" class="col Price "> <?= $block->escapeHtml(__('Price' )) ?></th>
<th scope="col" class="col Total "> <?= $block->escapeHtml(__('Total' )) ?></th>
<th scope="col" class="col Action "> <?= $block->escapeHtml(__('Action' )) ?></th>
</tr>
</thead>
<tbody>
<?php foreach($orders as $item): ?>
<?php
$_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="OrderItem "class="col orderitemid"> <?php echo $item->getItemId(); ?></td>
<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>

<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions">
<a href="<?php echo $this->getUrl('history/detail/display',['item_id' => $item->getItemId()]); ?>">Order Detail</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>




Can anyone help the next step?
Thanks a lot.










share|improve this question
















I'm trying to show product detail by order Item_Id. I have this page:



enter image description here



When we click on Order Detail, it will get the item (2) to show product detail we've chosen. Here is my code to show this page:



<?php 
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$orders = $objectManager->
create('MagentoSalesModelOrderItem')->getCollection();

echo "<p style='color:red;
font-size:20px;'>
Product Ordered
</p>";
?>
<div class="table-wrapper orders-history">
<table class="data table table-order-items history" id="my-orders-
table">
<caption class="table-caption"><?= $block->escapeHtml(__('Orders'))
?></caption>
<thead>
<tr>
<th scope="col" class="col orderitemid"> <?= $block->escapeHtml(__('OrderItem' )) ?></th>
<th scope="col" class="col image "> <?= $block->escapeHtml(__('Product Image')) ?></th>
<th scope="col" class="col name "> <?= $block->escapeHtml(__('Product Name' )) ?></th>
<th scope="col" class="col Qty "> <?= $block->escapeHtml(__('Qty' )) ?></th>
<th scope="col" class="col Price "> <?= $block->escapeHtml(__('Price' )) ?></th>
<th scope="col" class="col Total "> <?= $block->escapeHtml(__('Total' )) ?></th>
<th scope="col" class="col Action "> <?= $block->escapeHtml(__('Action' )) ?></th>
</tr>
</thead>
<tbody>
<?php foreach($orders as $item): ?>
<?php
$_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="OrderItem "class="col orderitemid"> <?php echo $item->getItemId(); ?></td>
<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>

<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions">
<a href="<?php echo $this->getUrl('history/detail/display',['item_id' => $item->getItemId()]); ?>">Order Detail</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>




Can anyone help the next step?
Thanks a lot.







magento2 product






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 11 at 9:26









Faisal Sheikh

1549 bronze badges




1549 bronze badges










asked Jul 11 at 8:31









Michael TaoMichael Tao

588 bronze badges




588 bronze badges












  • You want to redirect to product page?

    – Rohan Hapani
    Jul 11 at 8:55











  • Hi @Rohan. Could you tell me how can I get productUrl to redirect to product page??

    – Michael Tao
    Jul 17 at 9:09











  • Please check my answer. using that you can get product URL.

    – Rohan Hapani
    Jul 17 at 9:12

















  • You want to redirect to product page?

    – Rohan Hapani
    Jul 11 at 8:55











  • Hi @Rohan. Could you tell me how can I get productUrl to redirect to product page??

    – Michael Tao
    Jul 17 at 9:09











  • Please check my answer. using that you can get product URL.

    – Rohan Hapani
    Jul 17 at 9:12
















You want to redirect to product page?

– Rohan Hapani
Jul 11 at 8:55





You want to redirect to product page?

– Rohan Hapani
Jul 11 at 8:55













Hi @Rohan. Could you tell me how can I get productUrl to redirect to product page??

– Michael Tao
Jul 17 at 9:09





Hi @Rohan. Could you tell me how can I get productUrl to redirect to product page??

– Michael Tao
Jul 17 at 9:09













Please check my answer. using that you can get product URL.

– Rohan Hapani
Jul 17 at 9:12





Please check my answer. using that you can get product URL.

– Rohan Hapani
Jul 17 at 9:12










1 Answer
1






active

oldest

votes


















1














Remove this code :



<?php echo $this->getUrl('history/detail/display',['item_id' => $item->getItemId()]); ?>


And add this code for redirect to product page :



<?php echo $_product->getProductUrl(); ?>





share|improve this answer























  • Thanks for your answer @Rohan. How about the file .phtml I want to show the product

    – Michael Tao
    Jul 11 at 9:09












  • As I said, It will redirect to product page.

    – Rohan Hapani
    Jul 11 at 9:10













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%2f281694%2fhow-to-display-product-by-using-order-item-id-in-magento-2%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














Remove this code :



<?php echo $this->getUrl('history/detail/display',['item_id' => $item->getItemId()]); ?>


And add this code for redirect to product page :



<?php echo $_product->getProductUrl(); ?>





share|improve this answer























  • Thanks for your answer @Rohan. How about the file .phtml I want to show the product

    – Michael Tao
    Jul 11 at 9:09












  • As I said, It will redirect to product page.

    – Rohan Hapani
    Jul 11 at 9:10















1














Remove this code :



<?php echo $this->getUrl('history/detail/display',['item_id' => $item->getItemId()]); ?>


And add this code for redirect to product page :



<?php echo $_product->getProductUrl(); ?>





share|improve this answer























  • Thanks for your answer @Rohan. How about the file .phtml I want to show the product

    – Michael Tao
    Jul 11 at 9:09












  • As I said, It will redirect to product page.

    – Rohan Hapani
    Jul 11 at 9:10













1












1








1







Remove this code :



<?php echo $this->getUrl('history/detail/display',['item_id' => $item->getItemId()]); ?>


And add this code for redirect to product page :



<?php echo $_product->getProductUrl(); ?>





share|improve this answer













Remove this code :



<?php echo $this->getUrl('history/detail/display',['item_id' => $item->getItemId()]); ?>


And add this code for redirect to product page :



<?php echo $_product->getProductUrl(); ?>






share|improve this answer












share|improve this answer



share|improve this answer










answered Jul 11 at 9:07









Rohan HapaniRohan Hapani

7,9214 gold badges21 silver badges65 bronze badges




7,9214 gold badges21 silver badges65 bronze badges












  • Thanks for your answer @Rohan. How about the file .phtml I want to show the product

    – Michael Tao
    Jul 11 at 9:09












  • As I said, It will redirect to product page.

    – Rohan Hapani
    Jul 11 at 9:10

















  • Thanks for your answer @Rohan. How about the file .phtml I want to show the product

    – Michael Tao
    Jul 11 at 9:09












  • As I said, It will redirect to product page.

    – Rohan Hapani
    Jul 11 at 9:10
















Thanks for your answer @Rohan. How about the file .phtml I want to show the product

– Michael Tao
Jul 11 at 9:09






Thanks for your answer @Rohan. How about the file .phtml I want to show the product

– Michael Tao
Jul 11 at 9:09














As I said, It will redirect to product page.

– Rohan Hapani
Jul 11 at 9:10





As I said, It will redirect to product page.

– Rohan Hapani
Jul 11 at 9:10

















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%2f281694%2fhow-to-display-product-by-using-order-item-id-in-magento-2%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

Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림