Mage_Checkout_Helper_Cart Class Reference

Inheritance diagram for Mage_Checkout_Helper_Cart:

Mage_Core_Helper_Url Mage_Core_Helper_Abstract

List of all members.

Public Member Functions

 getCart ()
 getAddUrl ($product, $additional=array())
 getRemoveUrl ($item)
 getCartUrl ()
 getQuote ()
 getItemsCount ()
 getItemsQty ()
 getSummaryCount ()
 getIsVirtualQuote ()


Detailed Description

Shopping cart helper

Author:
Magento Core Team <core@magentocommerce.com>

Definition at line 32 of file Cart.php.


Member Function Documentation

getAddUrl ( product,
additional = array() 
)

Retrieve url for add product to cart

Parameters:
Mage_Catalog_Model_Product $product
Returns:
string

Identify continue shopping url

go to product view page

go to category view page

Definition at line 50 of file Cart.php.

00051     {
00052         /**
00053          * Identify continue shopping url
00054          */
00055 //        if ($currentProduct = Mage::registry('current_product')) {
00056 //            /**
00057 //             * go to product view page
00058 //            */
00059 //            $continueShoppingUrl = $currentProduct->getProductUrl();
00060 //        } elseif ($currentCategory = Mage::registry('current_category')) {
00061 //            /**
00062 //             * go to category view page
00063 //             */
00064 //
00065 //            $continueShoppingUrl = $currentCategory->getUrl().(count($this->_getRequest()->getQuery())!=0?'?'.http_build_qu//ery($this->_getRequest()->getQuery(), '', '&amp;'):'');
00066 //
00067 //       } else {
00068 //            $continueShoppingUrl = $this->_getUrl('*/*/*', array('_current'=>true));
00069 //        }
00070 
00071         $continueShoppingUrl = $this->getCurrentUrl();
00072 
00073         $params = array(
00074             Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => Mage::helper('core')->urlEncode($continueShoppingUrl),
00075             'product' => $product->getId()
00076         );
00077 
00078         if ($this->_getRequest()->getRouteName() == 'checkout'
00079             && $this->_getRequest()->getControllerName() == 'cart') {
00080             $params['in_cart'] = 1;
00081         }
00082 
00083         if (count($additional)){
00084             $params = array_merge($params, $additional);
00085         }
00086 
00087         return $this->_getUrl('checkout/cart/add', $params);
00088     }

getCart (  ) 

Retrieve cart instance

Returns:
Mage_Checkout_Model_Cart

Definition at line 39 of file Cart.php.

00040     {
00041         return Mage::getSingleton('checkout/cart');
00042     }

getCartUrl (  ) 

Retrieve shopping cart url

Returns:
unknown

Definition at line 110 of file Cart.php.

00111     {
00112         return $this->_getUrl('checkout/cart');
00113     }

getIsVirtualQuote (  ) 

Check qoute for virtual products only

Returns:
bool

Definition at line 160 of file Cart.php.

00161     {
00162         return $this->getQuote()->isVirtual();
00163     }

getItemsCount (  ) 

Get shopping cart items count

Returns:
int

Definition at line 130 of file Cart.php.

00131     {
00132         return $this->getCart()->getItemsCount();
00133     }

getItemsQty (  ) 

Get shopping cart summary qty

Returns:
decimal

Definition at line 140 of file Cart.php.

00141     {
00142         return $this->getCart()->getItemsQty();
00143     }

getQuote (  ) 

Retrieve current quote instance

Returns:
Mage_Sales_Model_Quote

Definition at line 120 of file Cart.php.

00121     {
00122         return Mage::getSingleton('checkout/session')->getQuote();
00123     }

getRemoveUrl ( item  ) 

Retrieve url for remove product from cart

Parameters:
Mage_Sales_Quote_Item $item
Returns:
string

Definition at line 96 of file Cart.php.

00097     {
00098         $params = array(
00099             'id'=>$item->getId(),
00100             Mage_Core_Controller_Front_Action::PARAM_NAME_BASE64_URL => $this->getCurrentBase64Url()
00101         );
00102         return $this->_getUrl('checkout/cart/delete', $params);
00103     }

getSummaryCount (  ) 

Get shopping cart items summary (inchlude config settings)

Returns:
decimal

Definition at line 150 of file Cart.php.

00151     {
00152         return $this->getCart()->getSummaryQty();
00153     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:51 2009 for Magento by  doxygen 1.5.8