How can I show last order view on my customer panel dashboard? by default it shows last orders... I want to show last order view(detail) on dashboard. finally i tried this code
foreach ($_order->getAllVisibleItems() as $_item) {
echo $block->escapeHtml($_item->getName());
}
but have a problem, when i have 3 items in one order id it shows like item1 item2 item3. i want to show item1 item2 item3... with image of product. any help?
Now used this code but still cant see all product images, just shows one of them...
<?php foreach ($_order->getAllVisibleItems() as $_item) {
echo "Order date: " . $block->formatDate($_order->getCreatedAt());
$_imagehelper = $this->helper('Magento\Catalog\Helper\Image');
if($childProd = current($_item->getChildrenItems())){
$productImage = $_imagehelper->init($childProd->getProduct(), 'category_page_list', array('height' => 156 , 'width'=> 170))->getUrl();
}
else{
$productImage = $_imagehelper->init($_item->getProduct(), 'category_page_list', array('height' => 156 , 'width'=> 170))->getUrl();
}
}
?>