1

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

  • why you need sql query you can get all data via magento syntax – Murtuza Zabuawala Oct 28 '16 at 11:50
  • I am new in magento. I have a this task so please suggest me. – Rakesh Patidar Oct 28 '16 at 11:53
1

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

  • Thanks, But I want to get cart information using custom sql query. – Rakesh Patidar Oct 28 '16 at 12:05
  • you get cart information from this code – Murtuza Zabuawala Oct 28 '16 at 12:05
  • Yes I know but i want to cart information using custom sql query. so please suggest me. – Rakesh Patidar Oct 28 '16 at 12:12
  • why you need custom query ?? please tell me so I can provide you better answer – Murtuza Zabuawala Oct 28 '16 at 12:13
  • I have get a this task. so please – Rakesh Patidar Oct 28 '16 at 12:17
0

You can get the code for it in

app/design/frontend/[Your-package]/[Your-theme]/template/Checkout/Cart

There you will find snippet like this

$cart = Mage::getSingleton('checkout/session')->getQuote();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.