If you are working with magento Quote session in front end then use the following code to get Quote Session.

$quote = Mage::getSingleton('checkout/session')->getQuote();
$quoteId = $quote->getId();

Magento Get Quote Items.

Below is the code to get items from the quote.

$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote_Items = $quote->getAllVisibleItems();
foreach ($quote_Items as $item) {
$productId = $item->getProductId();
$productName = $item->getProductName();

Get Payment Method From the magento Quote Session.

If you want to get payment details then first you will need to get quote Id from the current session quote and then after that reload quote model again see the below code.

$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote = Mage::getModel('sales/quote')->load($quote->getQuoteId());
$payment_Code = $quote->getPayment()->getMethodInstance()->getCode();
$payment_Title = $quote->getPayment()->getMethodInstance()->getTitle();

Magento get Shipping Method From the Quote Session.

You can get shipping method directly from quote session there is no need to reload quote model, below is the code.

$quote = Mage::getSingleton('checkout/session')->getQuote();
$shippingMethod = $quote->getShippingAddress()->getShippingMethod();

Get Shipping And Billing Address From Magento Quote Session.

If want to get shipping and billing address from magento quote then use the following code.

$quote = Mage::getSingleton('checkout/session')->getQuote();
$shippingAddress = $quote->getShippingAddress();
$billingAddress = $quote->getBillingAddress();

Magento get quote shipping amount, Grand Total, Tax Amount, Discount Amount.

if you want to get the following details from magento quote session.

  • Shipping Amount
  • Grand Total
  • Tax Amount
  • Discount Amount.

Use below code to get the above details from the session quote.

$quote = Mage::getSingleton('checkout/session')->getQuote();
$shippingAmount = $quote->getShippingAmount();// get shipping amount
$grandTotal = $quote->getGrandTotal();// get grand total
$tax = $quote->getShippingAddress()->getData('tax_amount');// get tax amount
$totals =  $quote->getTotals();
$totalDiscount = $totals["discount"]->getValue();// get discount amount

You can also get the above information from the quote session using the following code.

$quote = Mage::getSingleton('checkout/session')->getQuote();
$totals =  $quote->getTotals();
$totalDiscount = $totals["discount"]->getValue();
$tax = $totals["tax"]->getValue();
$subtotal = $totals["subtotal"]->getValue();
$shipping = $totals["shipping"]->getValue();
$grandTotal = $totals["grand_total"]->getValue();