Mage_Checkout_Block_Cart_Sidebar Class Reference

Inheritance diagram for Mage_Checkout_Block_Cart_Sidebar:

Mage_Checkout_Block_Cart_Abstract Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getRecentItems ($count=null)
 getSubtotal ($skipTax=false)
 getSubtotalInclTax ()
 getSummaryCount ()
 getIncExcTax ($flag)
 isPossibleOnepageCheckout ()
 getCheckoutUrl ()

Public Attributes

const XML_PATH_CHECKOUT_SIDEBAR_COUNT = 'checkout/sidebar/count'

Protected Member Functions

 _getShippingTaxAmount ()
 _toHtml ()


Detailed Description

Definition at line 35 of file Sidebar.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Mage_Checkout_Block_Cart_Abstract.

Definition at line 39 of file Sidebar.php.

00040     {
00041         parent::__construct();
00042         $this->addItemRender('default', 'checkout/cart_item_renderer', 'checkout/cart/sidebar/default.phtml');
00043     }


Member Function Documentation

_getShippingTaxAmount (  )  [protected]

Definition at line 120 of file Sidebar.php.

00121     {
00122         return $this->getQuote()->getShippingAddress()->getShippingTaxAmount();
00123     }

_toHtml (  )  [protected]

Render block HTML

Returns:
string

Reimplemented from Mage_Core_Block_Template.

Definition at line 151 of file Sidebar.php.

00152     {
00153         $html = '';
00154         if ((bool) Mage::app()->getStore()->getConfig('checkout/sidebar/display')) {
00155             $html = parent::_toHtml();
00156         }
00157         return $html;
00158     }

getCheckoutUrl (  ) 

Definition at line 141 of file Sidebar.php.

00142     {
00143         return $this->helper('checkout/url')->getCheckoutUrl();
00144     }

getIncExcTax ( flag  ) 

Definition at line 130 of file Sidebar.php.

00131     {
00132         $text = Mage::helper('tax')->getIncExcText($flag);
00133         return $text ? ' ('.$text.')' : '';
00134     }

getRecentItems ( count = null  ) 

Get array last added items

Returns:
array

Definition at line 50 of file Sidebar.php.

00051     {
00052         if ($count === null) {
00053             $count = $this->getData('item_count');
00054         }
00055         if ($count === null) {
00056             $count = Mage::getStoreConfig(self::XML_PATH_CHECKOUT_SIDEBAR_COUNT);
00057         }
00058         $items = array();
00059         if (!$this->getSummaryCount()) {
00060             return $items;
00061         }
00062         $i = 0;
00063         $allItems = array_reverse($this->getItems());
00064         foreach ($allItems as $item) {
00065             $items[] = $item;
00066             if (++$i == $count) {
00067                 break;
00068             }
00069         }
00070         return $items;
00071     }

getSubtotal ( skipTax = false  ) 

Get shopping cart subtotal. It will include tax, if required by config settings.

Returns:
decimal

Definition at line 79 of file Sidebar.php.

00080     {
00081         $subtotal = 0;
00082         $totals = $this->getTotals();
00083         if (isset($totals['subtotal'])) {
00084             $subtotal = $totals['subtotal']->getValue();
00085             if (!$skipTax) {
00086                 if ((!$this->helper('tax')->displayCartBothPrices()) && $this->helper('tax')->displayCartPriceInclTax()) {
00087                     $subtotal = $this->_addTax($subtotal);
00088                 }
00089             }
00090         }
00091         return $subtotal;
00092     }

getSubtotalInclTax (  ) 

Get subtotal, including tax. Will return > 0 only if appropriate config settings are enabled.

Returns:
decimal

Definition at line 100 of file Sidebar.php.

00101     {
00102         if (!$this->helper('tax')->displayCartBothPrices()) {
00103             return 0;
00104         }
00105         return $this->_addTax($this->getSubtotal(true));
00106     }

getSummaryCount (  ) 

Definition at line 125 of file Sidebar.php.

00126     {
00127         return Mage::getSingleton('checkout/cart')->getSummaryQty();
00128     }

isPossibleOnepageCheckout (  ) 

Definition at line 136 of file Sidebar.php.

00137     {
00138         return $this->helper('checkout')->canOnepageCheckout();
00139     }


Member Data Documentation

const XML_PATH_CHECKOUT_SIDEBAR_COUNT = 'checkout/sidebar/count'

Definition at line 37 of file Sidebar.php.


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

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