vgorilla
vgorilla

Reputation: 41

How to pull customer email on Magento Checkout Success.phtml 1.7

I've tried various solutions online to no avail. I think it should be something like:

<?php
$order->getBillingAddress()->getEmail();
?>

An email confirmation was sent to: <?php echo $order->getEmail ?>

I am able to display order ID with:

<?php echo $this->getOrderId() ?>

If you have a suggestion, please be as specific as you can because I am definitely a novice.

Upvotes: 4

Views: 6843

Answers (2)

MagePal Extensions
MagePal Extensions

Reputation: 17656

Try adding this to Success.phtml

<?php
   $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
   echo $order->getCustomerEmail();
?>

Read more: Get Order Increment ID in Magento

Upvotes: 7

magento code
magento code

Reputation: 185

Try with this code

$_customerId = Mage::getSingleton('customer/session')->getCustomerId();

$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();

$order = Mage::getSingleton('sales/order'); 

$order->load($lastOrderId);

Then do

foreach($order as $_order){
    echo $_order->getCustomerEmail();
}

Hope this helps

Upvotes: 0

Related Questions