Public Member Functions | |
__construct () | |
addItemRender ($productType, $blockType, $template) | |
getItemRender ($type) | |
getItemRendererInfo ($type) | |
getItemRenderer ($type) | |
getCustomer () | |
getCheckout () | |
getQuote () | |
getItems () | |
getItemHtml (Mage_Sales_Model_Quote_Item $item) | |
getTotals () | |
getTotalsCache () | |
Protected Attributes | |
$_customer = null | |
$_checkout = null | |
$_quote = null | |
$_totals | |
$_itemRenders = array() |
Definition at line 34 of file Abstract.php.
__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 Varien_Object.
Reimplemented in Mage_Checkout_Block_Cart_Sidebar.
Definition at line 43 of file Abstract.php.
00044 { 00045 parent::__construct(); 00046 $this->addItemRender('default', 'checkout/cart_item_renderer', 'checkout/cart/item/default.phtml'); 00047 }
addItemRender | ( | $ | productType, | |
$ | blockType, | |||
$ | template | |||
) |
Add renderer for item product type
string | $productType | |
string | $blockType | |
string | $template |
Definition at line 57 of file Abstract.php.
00058 { 00059 $this->_itemRenders[$productType] = array( 00060 'block' => $blockType, 00061 'template' => $template, 00062 'blockInstance' => null 00063 ); 00064 return $this; 00065 }
getCheckout | ( | ) |
Get checkout session
Definition at line 134 of file Abstract.php.
00135 { 00136 if (null === $this->_checkout) { 00137 $this->_checkout = Mage::getSingleton('checkout/session'); 00138 } 00139 return $this->_checkout; 00140 }
getCustomer | ( | ) |
Get logged in customer
Definition at line 121 of file Abstract.php.
00122 { 00123 if (null === $this->_customer) { 00124 $this->_customer = Mage::getSingleton('customer/session')->getCustomer(); 00125 } 00126 return $this->_customer; 00127 }
getItemHtml | ( | Mage_Sales_Model_Quote_Item $ | item | ) |
Get item row html
Mage_Sales_Model_Quote_Item | $item |
Definition at line 171 of file Abstract.php.
00172 { 00173 $renderer = $this->getItemRenderer($item->getProductType())->setItem($item); 00174 return $renderer->toHtml(); 00175 }
getItemRender | ( | $ | type | ) |
Get renderer information by product type code
string | $type |
Definition at line 75 of file Abstract.php.
00076 { 00077 return $this->getItemRendererInfo(); 00078 }
getItemRenderer | ( | $ | type | ) |
Get renderer block instance by product type code
string | $type |
Definition at line 100 of file Abstract.php.
00101 { 00102 if (!isset($this->_itemRenders[$type])) { 00103 $type = 'default'; 00104 } 00105 if (is_null($this->_itemRenders[$type]['blockInstance'])) { 00106 $this->_itemRenders[$type]['blockInstance'] = $this->getLayout() 00107 ->createBlock($this->_itemRenders[$type]['block']) 00108 ->setTemplate($this->_itemRenders[$type]['template']) 00109 ->setRenderedBlock($this); 00110 } 00111 00112 return $this->_itemRenders[$type]['blockInstance']; 00113 }
getItemRendererInfo | ( | $ | type | ) |
Get renderer information by product type code
string | $type |
Definition at line 86 of file Abstract.php.
00087 { 00088 if (isset($this->_itemRenders[$type])) { 00089 return $this->_itemRenders[$type]; 00090 } 00091 return $this->_itemRenders['default']; 00092 }
getItems | ( | ) |
Get all cart items
Definition at line 160 of file Abstract.php.
00161 { 00162 return $this->getQuote()->getAllVisibleItems(); 00163 }
getQuote | ( | ) |
Get active quote
Definition at line 147 of file Abstract.php.
00148 { 00149 if (null === $this->_quote) { 00150 $this->_quote = $this->getCheckout()->getQuote(); 00151 } 00152 return $this->_quote; 00153 }
getTotals | ( | ) |
Reimplemented in Mage_Checkout_Block_Cart_Totals.
Definition at line 177 of file Abstract.php.
00178 { 00179 return $this->getTotalsCache(); 00180 }
getTotalsCache | ( | ) |
Definition at line 182 of file Abstract.php.
00183 { 00184 if (empty($this->_totals)) { 00185 $this->_totals = $this->getQuote()->getTotals(); 00186 } 00187 return $this->_totals; 00188 }
$_checkout = null [protected] |
Definition at line 37 of file Abstract.php.
$_customer = null [protected] |
Definition at line 36 of file Abstract.php.
$_itemRenders = array() [protected] |
Definition at line 41 of file Abstract.php.
$_quote = null [protected] |
Definition at line 38 of file Abstract.php.
$_totals [protected] |