jquery - AJAX - cart Magento totals and items in cart -


i'm working on ajax cart magento.

i'm not interested in extensions, cart has author made, it's custom.

can tell me what's best way acquire such info grand item total in cart , number of items?

in fastest , relevant way.

i can create external php file gather info user's session , ajax script gonna display on header every time when user adds or deletes product.

i can think of that's not best solution.

is there api, or what's best way this?

thanks,

adam

if referring mini-cart of sorts, have accomplished on multiple projects using below code:

<?php  // gets current session of user mage::getsingleton('core/session', array('name'=>'frontend'));  // loads products in current users cart $items = mage::getsingleton('checkout/session')->getquote()->getallvisibleitems();  // counts total number of items in cart $totalitems = count($items);  // can loop through products, , load them attributes foreach( $items $item ) {     $_product = mage::getmodel('catalog/product')->loadbyattribute('sku', $item->getsku());     // display code, etc }   // gets subtotal of current cart $subtotal = mage::getmodel('checkout/cart')->getquote()->getsubtotal();  ?> 

not sure if best way handle mini-cart functionality has worked great me in past , highly customizable.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -