'Getting product name and phone number in the success page for Magento
I am using Magento 1.9 and I need to use customer name, number, and product name in the success page. How can I achieve that?
Solution 1:[1]
get customer name and phone number using below fields
$order = Mage::getModel('sales/order')->load($this->getOrderId());
if($order->getCustomerIsGuest()){
echo $order->getBillingAddress()->getName();
echo $order->getBillingAddress()->getTelephone();
}
else{
echo $order->getCustomerName();
echo $order->getTelephone();
}
Solution 2:[2]
Assuming you already have the order object in success page
$order->getBillingAddress()->getTelephone();
$order->getCustomerName();
$ordered_items = $order->getAllVisibleItems();
foreach($ordered_items as $item)
$product_name[] = $item->getName();
Solution 3:[3]
Even if some one searching for same.
$orderDetails = Mage::getModel(‘sales/order’)->loadByIncrementId($this->getOrderId());
To get Contact Number
echo $telePhone=$orderObj->getBillingAddress()->getTelephone();
To get Complete array use print_r($orderDetails);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sathish Kumar VG |
| Solution 2 | Aamir |
| Solution 3 | TylerH |
