How can i get the both guest and registered customer details such as Firstname and Telephone number on success page ?

I am having order# on that page, So can i get the customer information from order# there ?

  • Do you want the info associated with the order like the billing/shipping info or something else? – mbalparda Nov 27 '14 at 13:10
  • I need the customer fisrtname and mobile number from the order placed on success.phtml , So i can send him the transactional message to customer for his/her order confirmation. – K T Nov 27 '14 at 13:14

I have written a blog post regarding it. You will get all the information required from there.

Check the link: Thank you page Magento

Link2: Thank you page part II

Let me know if you have any doubts or queries regarding it.

Basically you will get all the required stuff from

$lastOrder = Mage::getModel(‘sales/order’)->load(Mage::getSingleton(‘checkout/session’)->getLastOrderId());


$orderObj = Mage::getModel(‘sales/order’)->loadByIncrementId($this->getOrderId());
  • Okay, Thanks.. i will check it out and will get back to you. – K T Nov 27 '14 at 13:21
  • You don't want to to a load inside a foreach. At all. Please check your code since it will decrease the performance if used anywhere. – mbalparda Nov 27 '14 at 13:22
  • Thanks for you suggestion. I haven't noticed it as it was written long time ago when i was just starting to learn Magento. I'll correct it. – Dexter Nov 27 '14 at 14:02
  • Thanks @Dexter , your guide was really helpful. It worked for me. – K T Nov 28 '14 at 6:26

You can start by using

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

and then retrieve the customer info from the order object like this

//If they have no customer id, they're a guest.
if($order->getCustomerId() === NULL){
    echo $order->getBillingAddress()->getLastname();
} else {
    //else, they're a normal registered user.
    $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
  • this solution was having some issues, Dexter's solution worked for me. Thanks for your help. – K T Nov 28 '14 at 6:28

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.