$quote = Mage::getModel('checkout/session')->getQuote(); //Retrieve the quote from the current user session $total = $quote->getGrandTotal(); //Get the total amount due for the items in the cart $itemCount = count($quote->getAllItems()); //Count the number of items in the cart $shippingAddress = $quote->getShippingAddress(); //Get the shipping address for the order
$quote = new Varien_Object(); $quote->setData(array( 'items' => array( array('sku' => 'SKU001', 'name' => 'Product Name 1', 'price' => 10.99), array('sku' => 'SKU002', 'name' => 'Product Name 2', 'price' => 19.99), ), 'subtotal' => 30.98, 'shipping_address' => array( 'street' => array('123 Main St'), 'city' => 'Anytown', 'region' => 'CA', 'postcode' => '92121', 'country_id' => 'US', 'telephone' => '555-1234' ), )); //Create a quote object with array data $itemCount = count($quote->getData('items')); //Retrieve the number of items in the quote $subTotal = $quote->getData('subtotal'); //Retrieve the subtotal for the quote $shippingAddress = $quote->getData('shipping_address'); //Retrieve the shipping address for the quoteIn this example, we create a quote object using an array of data. This could be useful for testing or for generating quotes programmatically. We then retrieve various pieces of information from the quote object using Varien_Object's getData method.