Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Bundle_Adminhtml_Bundle_Product_EditController
  • Mage_Bundle_Adminhtml_Bundle_SelectionController
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Checkbox
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Multi
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Radio
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Select
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Extend
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Special
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search_Grid
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Selection
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs
  • Mage_Bundle_Block_Adminhtml_Sales_Order_Items_Renderer
  • Mage_Bundle_Block_Adminhtml_Sales_Order_View_Items_Renderer
  • Mage_Bundle_Block_Catalog_Product_List_Partof
  • Mage_Bundle_Block_Catalog_Product_Price
  • Mage_Bundle_Block_Catalog_Product_View
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select
  • Mage_Bundle_Block_Checkout_Cart_Item_Renderer
  • Mage_Bundle_Block_Sales_Order_Items_Renderer
  • Mage_Bundle_Helper_Catalog_Product_Configuration
  • Mage_Bundle_Helper_Data
  • Mage_Bundle_Model_CatalogIndex_Data_Bundle
  • Mage_Bundle_Model_Mysql4_Bundle
  • Mage_Bundle_Model_Mysql4_Indexer_Price
  • Mage_Bundle_Model_Mysql4_Indexer_Stock
  • Mage_Bundle_Model_Mysql4_Option
  • Mage_Bundle_Model_Mysql4_Option_Collection
  • Mage_Bundle_Model_Mysql4_Price_Index
  • Mage_Bundle_Model_Mysql4_Selection
  • Mage_Bundle_Model_Mysql4_Selection_Collection
  • Mage_Bundle_Model_Observer
  • Mage_Bundle_Model_Option
  • Mage_Bundle_Model_Price_Index
  • Mage_Bundle_Model_Product_Attribute_Source_Price_View
  • Mage_Bundle_Model_Product_Price
  • Mage_Bundle_Model_Product_Type
  • Mage_Bundle_Model_Resource_Bundle
  • Mage_Bundle_Model_Resource_Indexer_Price
  • Mage_Bundle_Model_Resource_Indexer_Stock
  • Mage_Bundle_Model_Resource_Option
  • Mage_Bundle_Model_Resource_Option_Collection
  • Mage_Bundle_Model_Resource_Price_Index
  • Mage_Bundle_Model_Resource_Selection
  • Mage_Bundle_Model_Resource_Selection_Collection
  • Mage_Bundle_Model_Sales_Order_Pdf_Items_Abstract
  • Mage_Bundle_Model_Sales_Order_Pdf_Items_Shipment
  • Mage_Bundle_Model_Selection
  • Mage_Bundle_Model_Source_Option_Selection_Price_Type
  • Mage_Bundle_Model_Source_Option_Type
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Bundle
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: 
 28: /**
 29:  * Adminhtml sales order item renderer
 30:  *
 31:  * @category    Mage
 32:  * @package     Mage_Bundle
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_Bundle_Block_Adminhtml_Sales_Order_Items_Renderer extends Mage_Adminhtml_Block_Sales_Items_Renderer_Default
 36: {
 37:     /**
 38:      * Getting all available childs for Invoice, Shipmen or Creditmemo item
 39:      *
 40:      * @param Varien_Object $item
 41:      * @return array
 42:      */
 43:     public function getChilds($item)
 44:     {
 45:         $_itemsArray = array();
 46: 
 47:         if ($item instanceof Mage_Sales_Model_Order_Invoice_Item) {
 48:             $_items = $item->getInvoice()->getAllItems();
 49:         } else if ($item instanceof Mage_Sales_Model_Order_Shipment_Item) {
 50:             $_items = $item->getShipment()->getAllItems();
 51:         } else if ($item instanceof Mage_Sales_Model_Order_Creditmemo_Item) {
 52:             $_items = $item->getCreditmemo()->getAllItems();
 53:         }
 54: 
 55:         if ($_items) {
 56:             foreach ($_items as $_item) {
 57:                 if ($parentItem = $_item->getOrderItem()->getParentItem()) {
 58:                     $_itemsArray[$parentItem->getId()][$_item->getOrderItemId()] = $_item;
 59:                 } else {
 60:                     $_itemsArray[$_item->getOrderItem()->getId()][$_item->getOrderItemId()] = $_item;
 61:                 }
 62:             }
 63:         }
 64: 
 65:         if (isset($_itemsArray[$item->getOrderItem()->getId()])) {
 66:             return $_itemsArray[$item->getOrderItem()->getId()];
 67:         } else {
 68:             return null;
 69:         }
 70:     }
 71: 
 72:     public function isShipmentSeparately($item = null)
 73:     {
 74:         if ($item) {
 75:             if ($item->getOrderItem()) {
 76:                 $item = $item->getOrderItem();
 77:             }
 78:             if ($parentItem = $item->getParentItem()) {
 79:                 if ($options = $parentItem->getProductOptions()) {
 80:                     if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
 81:                         return true;
 82:                     } else {
 83:                         return false;
 84:                     }
 85:                 }
 86:             } else {
 87:                 if ($options = $item->getProductOptions()) {
 88:                     if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
 89:                         return false;
 90:                     } else {
 91:                         return true;
 92:                     }
 93:                 }
 94:             }
 95:         }
 96: 
 97:         if ($options = $this->getOrderItem()->getProductOptions()) {
 98:             if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
 99:                 return true;
100:             }
101:         }
102:         return false;
103:     }
104: 
105:     public function isChildCalculated($item = null)
106:     {
107:         if ($item) {
108:             if ($item->getOrderItem()) {
109:                 $item = $item->getOrderItem();
110:             }
111:             if ($parentItem = $item->getParentItem()) {
112:                 if ($options = $parentItem->getProductOptions()) {
113:                     if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
114:                         return true;
115:                     } else {
116:                         return false;
117:                     }
118:                 }
119:             } else {
120:                 if ($options = $item->getProductOptions()) {
121:                     if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
122:                         return false;
123:                     } else {
124:                         return true;
125:                     }
126:                 }
127:             }
128:         }
129: 
130:         if ($options = $this->getOrderItem()->getProductOptions()) {
131:             if (isset($options['product_calculations'])
132:                 && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
133:                 return true;
134:             }
135:         }
136:         return false;
137:     }
138: 
139:     public function getSelectionAttributes($item) {
140:         if ($item instanceof Mage_Sales_Model_Order_Item) {
141:             $options = $item->getProductOptions();
142:         } else {
143:             $options = $item->getOrderItem()->getProductOptions();
144:         }
145:         if (isset($options['bundle_selection_attributes'])) {
146:             return unserialize($options['bundle_selection_attributes']);
147:         }
148:         return null;
149:     }
150: 
151:     public function getOrderOptions($item = null)
152:     {
153:         $result = array();
154: 
155:         if ($options = $this->getOrderItem()->getProductOptions()) {
156:             if (isset($options['options'])) {
157:                 $result = array_merge($result, $options['options']);
158:             }
159:             if (isset($options['additional_options'])) {
160:                 $result = array_merge($result, $options['additional_options']);
161:             }
162:             if (!empty($options['attributes_info'])) {
163:                 $result = array_merge($options['attributes_info'], $result);
164:             }
165:         }
166:         return $result;
167:     }
168: 
169:     public function getOrderItem()
170:     {
171:         if ($this->getItem() instanceof Mage_Sales_Order_Item) {
172:             return $this->getItem();
173:         } else {
174:             return $this->getItem()->getOrderItem();
175:         }
176:     }
177: 
178:     public function getValueHtml($item)
179:     {
180:         $result = $this->htmlEscape($item->getName());
181:         if (!$this->isShipmentSeparately($item)) {
182:             if ($attributes = $this->getSelectionAttributes($item)) {
183:                 $result =  sprintf('%d', $attributes['qty']) . ' x ' . $result;
184:             }
185:         }
186:         if (!$this->isChildCalculated($item)) {
187:             if ($attributes = $this->getSelectionAttributes($item)) {
188:                 $result .= " " . $this->getOrderItem()->getOrder()->formatPrice($attributes['price']);
189:             }
190:         }
191:         return $result;
192:     }
193: 
194:     public function canShowPriceInfo($item)
195:     {
196:         if (($item->getOrderItem()->getParentItem() && $this->isChildCalculated())
197:                 || (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())) {
198:             return true;
199:         }
200:         return false;
201:     }
202: }
203: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0