function to know that there is any shipping method available
public function haveShippingMethods() { if (count(Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingRatesCollection())) { return true; } return false; }
use this code to get an array of billing address and shipping address
$all_data = array(); $customer = Mage::getModel(‘customer/session’)->getCustomer(); foreach($customer->getAddressesCollection() as $customer_address) { $all_data[] = $customer_address; } var_dump($all_data);
Mage::getSingleton('customer/session')->isLoggedIn()
Total items added in cart
Mage::getModel('checkout/cart')->getQuote()->getItemsCount(); Mage::getSingleton('checkout/session')->getQuote()->getItemsCount();
Total quantity added in cart
Mage::getModel('checkout/cart')->getQuote()->getItemsQty(); Mage::getSingleton('checkout/session')->getQuote()->getItemsQty();
Display products data in cart
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems(); foreach($items as $item) { echo 'ID: '.$item->getProductId().'
'; echo 'Name: '.$item->getName().'
'; echo 'Sku: '.$item->getSku().'
'; echo 'Quantity: '.$item->getQty().'
'; echo 'Price: '.$item->getPrice().'
'; echo "
"; }
Get order information on success.phtml
$_customerId = Mage::getSingleton('customer/session')->getCustomerId(); $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId(); $order = Mage::getSingleton('sales/order'); $order->load($lastOrderId); $_totalData =$order->getData(); $_grand = $_totalData['grand_total'];