I am rendering sales_items
rows in frontend
Screenshot is:
Can anyone please help me to find how get image path here from product id or any other solution. and set path in src
tag ?
My .phtml file code is there :
<?php
$OrderItemHelper = $this->helper('CompanyName\ModuleName\Helper\Orders');
$collection = $OrderItemHelper->getOrderItem();
?>
<b><i>Total order Items <?php echo count($collection)?></i></b>
<hr>
<table class="data table" id="test-data-table">
<caption class="table-caption">Seller Product Data</caption>
<thead>
<tr>
<th scope="col" class="col title">ID</th>
<th scope="col" class="col title">Product Id</th>
<th scope="col" class="col title">Image</th>
<th scope="col" class="col author">Name</th>
<th scope="col" class="col author">Sku</th>
<th scope="col" class="col author">Description</th>
<th scope="col" class="col author">Sale Date</th>
<th scope="col" class="col author">Price</th>
<th scope="col" class="col author">Qty</th>
<th scope="col" class="col author">Total</th>
<th scope="col" class="col author">Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($collection as $key => $data): ?>
<tr>
<td data-th="ID" ><?php echo $data->getItemId(); ?></td>
<td data-th="ID" ><?php echo $data->getProductId(); ?></td>
<td data-th="Image" ><img src="how can get path here" ></td>
<td data-th="Name" ><?php echo $data->getName(); ?></td>
<td data-th="Sku"><?php echo $data->getSku(); ?></td>
<td data-th="Description"><?php echo $data->getDescription(); ?></td>
<td data-th="CreatedAt"><?php echo $data->getCreatedAt(); ?></td>
<td data-th="Price"><?php echo $data->getPrice(); ?></td>
<td data-th="Sku"><?php echo $data->getQtyOrdered(); ?></td>
<td data-th="Sku"><?php echo ($data->getQtyOrdered()*$data->getPrice()); ?></td>
<td>
<a href="<?php echo $block->getBaseUrl().'admin/catalog/product/edit/id/'.$data->getId(); ?>" class="action view">
<span>View</span>
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php
?>