Magento – How to get customer shopping cart information using sql query

magento-1.9shopping-cartsql

How to get customer shopping cart information using custom sql query.

I want to get shopping cart product information like below.

for example ::

product_name,
product_id,
product_image,
qty,
row_total,
is_in_stock,
base_subtotal,
base_grand_total,
shipping_amount,
street

Best Answer

you can get current customer cart/quote detail from below code

$cart = Mage::getSingleton('checkout/session')->getQuote();
foreach ($cart->getAllItems() as $item) {
   $product = Mage::getModel('catalog/product')->load($item->getProductId())  ;
   echo $product->getName();

}

you can get all data from $product as it is a product object so you can easily access product data

Related Topic