Mage_Bundle_Block_Adminhtml_Sales_Order_Items_Renderer Class Reference

Inheritance diagram for Mage_Bundle_Block_Adminhtml_Sales_Order_Items_Renderer:

Mage_Adminhtml_Block_Sales_Items_Renderer_Default Mage_Adminhtml_Block_Sales_Items_Abstract Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

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


Detailed Description

Definition at line 35 of file Renderer.php.


Member Function Documentation

canShowPriceInfo ( item  ) 

Definition at line 194 of file Renderer.php.

00195     {
00196         if (($item->getOrderItem()->getParentItem() && $this->isChildCalculated())
00197                 || (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())) {
00198             return true;
00199         }
00200         return false;
00201     }

getChilds ( item  ) 

Getting all available childs for Invoice, Shipmen or Creditmemo item

Parameters:
Varien_Object $item
Returns:
array

Definition at line 43 of file Renderer.php.

00044     {
00045         $_itemsArray = array();
00046 
00047         if ($item instanceof Mage_Sales_Model_Order_Invoice_Item) {
00048             $_items = $item->getInvoice()->getAllItems();
00049         } else if ($item instanceof Mage_Sales_Model_Order_Shipment_Item) {
00050             $_items = $item->getShipment()->getAllItems();
00051         } else if ($item instanceof Mage_Sales_Model_Order_Creditmemo_Item) {
00052             $_items = $item->getCreditmemo()->getAllItems();
00053         }
00054 
00055         if ($_items) {
00056             foreach ($_items as $_item) {
00057                 if ($parentItem = $_item->getOrderItem()->getParentItem()) {
00058                     $_itemsArray[$parentItem->getId()][$_item->getOrderItemId()] = $_item;
00059                 } else {
00060                     $_itemsArray[$_item->getOrderItem()->getId()][$_item->getOrderItemId()] = $_item;
00061                 }
00062             }
00063         }
00064 
00065         if (isset($_itemsArray[$item->getOrderItem()->getId()])) {
00066             return $_itemsArray[$item->getOrderItem()->getId()];
00067         } else {
00068             return null;
00069         }
00070     }

getOrderItem (  ) 

Definition at line 169 of file Renderer.php.

00170     {
00171         if ($this->getItem() instanceof Mage_Sales_Order_Item) {
00172             return $this->getItem();
00173         } else {
00174             return $this->getItem()->getOrderItem();
00175         }
00176     }

getOrderOptions ( item = null  ) 

Definition at line 151 of file Renderer.php.

00152     {
00153         $result = array();
00154 
00155         if ($options = $this->getOrderItem()->getProductOptions()) {
00156             if (isset($options['options'])) {
00157                 $result = array_merge($result, $options['options']);
00158             }
00159             if (isset($options['additional_options'])) {
00160                 $result = array_merge($result, $options['additional_options']);
00161             }
00162             if (!empty($options['attributes_info'])) {
00163                 $result = array_merge($options['attributes_info'], $result);
00164             }
00165         }
00166         return $result;
00167     }

getSelectionAttributes ( item  ) 

Definition at line 139 of file Renderer.php.

00139                                                   {
00140         if ($item instanceof Mage_Sales_Model_Order_Item) {
00141             $options = $item->getProductOptions();
00142         } else {
00143             $options = $item->getOrderItem()->getProductOptions();
00144         }
00145         if (isset($options['bundle_selection_attributes'])) {
00146             return unserialize($options['bundle_selection_attributes']);
00147         }
00148         return null;
00149     }

getValueHtml ( item  ) 

Definition at line 178 of file Renderer.php.

00179     {
00180         $result = $this->htmlEscape($item->getName());
00181         if (!$this->isShipmentSeparately($item)) {
00182             if ($attributes = $this->getSelectionAttributes($item)) {
00183                 $result =  sprintf('%d', $attributes['qty']) . ' x ' . $result;
00184             }
00185         }
00186         if (!$this->isChildCalculated($item)) {
00187             if ($attributes = $this->getSelectionAttributes($item)) {
00188                 $result .= " " . $this->getOrderItem()->getOrder()->formatPrice($attributes['price']);
00189             }
00190         }
00191         return $result;
00192     }

isChildCalculated ( item = null  ) 

Definition at line 105 of file Renderer.php.

00106     {
00107         if ($item) {
00108             if ($item->getOrderItem()) {
00109                 $item = $item->getOrderItem();
00110             }
00111             if ($parentItem = $item->getParentItem()) {
00112                 if ($options = $parentItem->getProductOptions()) {
00113                     if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
00114                         return true;
00115                     } else {
00116                         return false;
00117                     }
00118                 }
00119             } else {
00120                 if ($options = $item->getProductOptions()) {
00121                     if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
00122                         return false;
00123                     } else {
00124                         return true;
00125                     }
00126                 }
00127             }
00128         }
00129 
00130         if ($options = $this->getOrderItem()->getProductOptions()) {
00131             if (isset($options['product_calculations'])
00132                 && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
00133                 return true;
00134             }
00135         }
00136         return false;
00137     }

isShipmentSeparately ( item = null  ) 

Definition at line 72 of file Renderer.php.

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


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