0

I need to get

  • Address Line 1
  • Address Line 2
  • Each Product Order Quantity
  • MRP(Manufacturer's Suggested Retail Price)

code inside

vendor/magento/module-checkout/view/frontend/templates/success.phtml

<?php
$lid = $this->getOrderId();
echo  "Order ID:".$lid."<br/>";

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Model\Order')->load($lid);


$totall = $order->getGrandTotal();
echo "Order Total:".$totall."<br/>";

$shippingAddress = $order->getShippingAddress();

echo "Telephone No:".$shippingAddress->getTelephone()."<br/>"; 

echo "postcode".$shippingAddress->getPostcode()."<br/>"; 

echo "city".$shippingAddress->getCity()."<br/>"; 

$items = $order->getAllItems();


foreach($items as $i):
   $_productsku = 
$objectManager->create('Magento\Catalog\Model\Product')->load($i->getProductId())->getSku();
   $_productquantity = 
$objectManager->create('Magento\Catalog\Model\Product')->load($i->getProductId())->getQtyOrdered();
   $_productprice = 
$objectManager->create('Magento\Catalog\Model\Product')->load($i->getProductId())->getPrice();

echo "product sku:".$_productsku."<br/>";
echo "product quantity:".$_productname."<br/>";
echo "product Rate:".$_productprice."<br/>";
endforeach;
?>
2
  • Specify the problem which you face using above code. Nov 11, 2017 at 7:00
  • no problems no errors. need to know, how can i get MRP, address1, address2, product order quantity for display purpose Nov 11, 2017 at 7:45

1 Answer 1

0

In your code in for each loop you are calling product obj for get qty order , it is not need just call from I object

1
  • ok how can i add it? Nov 11, 2017 at 7:43

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.