I want to get order date, ship method & payment method name after place order in Success.phtml file.
1 Answer
Try below code to get order data, ship method & payment method name
if ($this->getOrderId())
{
$order = Mage::getModel("sales/order")->load($orderId);
$orderTotalValue = number_format ($order->getGrandTotal(), 2, '.' , $thousands_sep = ''); //Fetch the order total value
$orderItems = $order->getItemsCollection();
//Fetch the order items detail
foreach ($orderItems as $item){
$product_id = $item->product_id;
$product_sku = $item->sku;
$product_price = $item->getPrice();
$product_name = $item->getName();
$_product = Mage::getModel('catalog/product')->load($product_id);
$cats = $_product->getCategoryIds();
$category_id = $cats[0]; // just get the first id
$category = Mage::getModel('catalog/category')->load($category_id);
$category_name = $category->getName();
}
$shipping_method = $order->getShippingMethod(); //Fetch the shipping method from order
$payment_method_code = $order->getPayment()->getMethodInstance()->getCode(); //Fetch the payment method code from order
}