Mage_Bundle_Block_Sales_Order_Items_Renderer Class Reference

Inheritance diagram for Mage_Bundle_Block_Sales_Order_Items_Renderer:

Mage_Sales_Block_Order_Item_Renderer_Default Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 isShipmentSeparately ($item=null)
 isChildCalculated ($item=null)
 getSelectionAttributes ($item)
 getValueHtml ($item)
 getChilds ($item)
 canShowPriceInfo ($item)


Detailed Description

Definition at line 34 of file Renderer.php.


Member Function Documentation

canShowPriceInfo ( item  ) 

Definition at line 161 of file Renderer.php.

00162     {
00163         if (($item->getOrderItem()->getParentItem() && $this->isChildCalculated())
00164                 || (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())) {
00165             return true;
00166         }
00167         return false;
00168     }

getChilds ( item  ) 

Getting all available childs for Invoice, Shipmen or Creditmemo item

Parameters:
Varien_Object $item
Returns:
array

Definition at line 132 of file Renderer.php.

00133     {
00134         $_itemsArray = array();
00135 
00136         if ($item instanceof Mage_Sales_Model_Order_Invoice_Item) {
00137             $_items = $item->getInvoice()->getAllItems();
00138         } else if ($item instanceof Mage_Sales_Model_Order_Shipment_Item) {
00139             $_items = $item->getShipment()->getAllItems();
00140         } else if ($item instanceof Mage_Sales_Model_Order_Creditmemo_Item) {
00141             $_items = $item->getCreditmemo()->getAllItems();
00142         }
00143 
00144         if ($_items) {
00145             foreach ($_items as $_item) {
00146                 if ($parentItem = $_item->getOrderItem()->getParentItem()) {
00147                     $_itemsArray[$parentItem->getId()][$_item->getOrderItemId()] = $_item;
00148                 } else {
00149                     $_itemsArray[$_item->getOrderItem()->getId()][$_item->getOrderItemId()] = $_item;
00150                 }
00151             }
00152         }
00153 
00154         if (isset($_itemsArray[$item->getOrderItem()->getId()])) {
00155             return $_itemsArray[$item->getOrderItem()->getId()];
00156         } else {
00157             return null;
00158         }
00159     }

getSelectionAttributes ( item  ) 

Definition at line 103 of file Renderer.php.

00103                                                   {
00104         if ($item instanceof Mage_Sales_Model_Order_Item) {
00105             $options = $item->getProductOptions();
00106         } else {
00107             $options = $item->getOrderItem()->getProductOptions();
00108         }
00109         if (isset($options['bundle_selection_attributes'])) {
00110             return unserialize($options['bundle_selection_attributes']);
00111         }
00112         return null;
00113     }

getValueHtml ( item  ) 

Definition at line 115 of file Renderer.php.

00116     {
00117         if ($attributes = $this->getSelectionAttributes($item)) {
00118             return sprintf('%d', $attributes['qty']) . ' x ' .
00119                 $this->htmlEscape($item->getName()) .
00120                 " " . $this->getOrder()->formatPrice($attributes['price']);
00121         } else {
00122             return $this->htmlEscape($item->getName());
00123         }
00124     }

isChildCalculated ( item = null  ) 

Definition at line 69 of file Renderer.php.

00070     {
00071         if ($item) {
00072             if ($item->getOrderItem()) {
00073                 $item = $item->getOrderItem();
00074             }
00075             if ($parentItem = $item->getParentItem()) {
00076                 if ($options = $parentItem->getProductOptions()) {
00077                     if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
00078                         return true;
00079                     } else {
00080                         return false;
00081                     }
00082                 }
00083             } else {
00084                 if ($options = $item->getProductOptions()) {
00085                     if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
00086                         return false;
00087                     } else {
00088                         return true;
00089                     }
00090                 }
00091             }
00092         }
00093 
00094         if ($options = $this->getOrderItem()->getProductOptions()) {
00095             if (isset($options['product_calculations'])
00096                 && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
00097                 return true;
00098             }
00099         }
00100         return false;
00101     }

isShipmentSeparately ( item = null  ) 

Definition at line 36 of file Renderer.php.

00037     {
00038         if ($item) {
00039             if ($item->getOrderItem()) {
00040                 $item = $item->getOrderItem();
00041             }
00042             if ($parentItem = $item->getParentItem()) {
00043                 if ($options = $parentItem->getProductOptions()) {
00044                     if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
00045                         return true;
00046                     } else {
00047                         return false;
00048                     }
00049                 }
00050             } else {
00051                 if ($options = $item->getProductOptions()) {
00052                     if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
00053                         return false;
00054                     } else {
00055                         return true;
00056                     }
00057                 }
00058             }
00059         }
00060 
00061         if ($options = $this->getOrderItem()->getProductOptions()) {
00062             if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
00063                 return true;
00064             }
00065         }
00066         return false;
00067     }


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

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