Mage_Sales_Block_Items_Abstract Class Reference

Inheritance diagram for Mage_Sales_Block_Items_Abstract:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_Checkout_Block_Multishipping_Addresses Mage_Checkout_Block_Multishipping_Billing_Items Mage_Checkout_Block_Multishipping_Overview Mage_Checkout_Block_Multishipping_Shipping Mage_Checkout_Block_Onepage_Review_Info Mage_Sales_Block_Order_Creditmemo_Items Mage_Sales_Block_Order_Email_Creditmemo_Items Mage_Sales_Block_Order_Email_Invoice_Items Mage_Sales_Block_Order_Email_Items Mage_Sales_Block_Order_Email_Shipment_Items Mage_Sales_Block_Order_Invoice_Items Mage_Sales_Block_Order_Items Mage_Sales_Block_Order_Print Mage_Sales_Block_Order_Print_Creditmemo Mage_Sales_Block_Order_Print_Invoice Mage_Sales_Block_Order_Print_Shipment Mage_Sales_Block_Order_Shipment_Items

List of all members.

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()


Detailed Description

Definition at line 34 of file Abstract.php.


Member Function Documentation

_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]

addItemRender ( type,
block,
template 
)

Add renderer for item product type

Parameters:
string $type
string $block
string $template
Returns:
Mage_Checkout_Block_Cart_Abstract

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

Parameters:
Varien_Object $item
Returns:
string

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

Parameters:
string $type
Returns:
Mage_Core_Block_Abstract

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     }


Member Data Documentation

$_itemRenders = array() [protected]

Definition at line 44 of file Abstract.php.


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

Generated on Sat Jul 4 17:24:39 2009 for Magento by  doxygen 1.5.8