Public Member Functions | |
addItemRender ($type, $block, $template) | |
getItemRenderer ($type) | |
getItemHtml (Varien_Object $item) | |
Protected Member Functions | |
_construct () | |
_prepareItem (Mage_Core_Block_Abstract $renderer) | |
Protected Attributes | |
$_itemRenders = array() |
Definition at line 34 of file Abstract.php.
_construct | ( | ) | [protected] |
Initialize default item renderer
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 49 of file Abstract.php.
00050 { 00051 parent::_construct(); 00052 $this->addItemRender('default', 'checkout/cart_item_renderer', 'checkout/cart/item/default.phtml'); 00053 }
_prepareItem | ( | Mage_Core_Block_Abstract $ | renderer | ) | [protected] |
Prepare item before output
Mage_Core_Block_Abstract | $renderer |
Reimplemented in Mage_Sales_Block_Order_Email_Creditmemo_Items, Mage_Sales_Block_Order_Email_Invoice_Items, Mage_Sales_Block_Order_Email_Shipment_Items, Mage_Sales_Block_Order_Print_Creditmemo, Mage_Sales_Block_Order_Print_Invoice, Mage_Sales_Block_Order_Print_Shipment, and Mage_Sales_Block_Order_Print.
Definition at line 101 of file Abstract.php.
addItemRender | ( | $ | type, | |
$ | block, | |||
$ | template | |||
) |
Add renderer for item product type
string | $type | |
string | $block | |
string | $template |
Definition at line 63 of file Abstract.php.
00064 { 00065 $this->_itemRenders[$type] = array( 00066 'block' => $block, 00067 'template' => $template, 00068 'renderer' => null 00069 ); 00070 00071 return $this; 00072 }
getItemHtml | ( | Varien_Object $ | item | ) |
Get item row html
Varien_Object | $item |
Definition at line 112 of file Abstract.php.
00113 { 00114 if ($item->getOrderItem()) { 00115 $type = $item->getOrderItem()->getProductType(); 00116 } elseif ($item instanceof Mage_Sales_Model_Quote_Address_Item) { 00117 $type = $item->getQuoteItem()->getProductType(); 00118 } else { 00119 $type = $item->getProductType(); 00120 } 00121 00122 $block = $this->getItemRenderer($type) 00123 ->setItem($item); 00124 $this->_prepareItem($block); 00125 return $block->toHtml(); 00126 }
getItemRenderer | ( | $ | type | ) |
Retrieve item renderer block
string | $type |
Definition at line 80 of file Abstract.php.
00081 { 00082 if (!isset($this->_itemRenders[$type])) { 00083 $type = 'default'; 00084 } 00085 00086 if (is_null($this->_itemRenders[$type]['renderer'])) { 00087 $this->_itemRenders[$type]['renderer'] = $this->getLayout() 00088 ->createBlock($this->_itemRenders[$type]['block']) 00089 ->setTemplate($this->_itemRenders[$type]['template']) 00090 ->setRenderedBlock($this); 00091 } 00092 return $this->_itemRenders[$type]['renderer']; 00093 }
$_itemRenders = array() [protected] |
Definition at line 44 of file Abstract.php.