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:  * Order item render block
 29:  *
 30:  * @category    Mage
 31:  * @package     Mage_Bundle
 32:  * @author      Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Bundle_Block_Sales_Order_Items_Renderer extends Mage_Sales_Block_Order_Item_Renderer_Default
 35: {
 36:     public function isShipmentSeparately($item = null)
 37:     {
 38:         if ($item) {
 39:             if ($item->getOrderItem()) {
 40:                 $item = $item->getOrderItem();
 41:             }
 42:             if ($parentItem = $item->getParentItem()) {
 43:                 if ($options = $parentItem->getProductOptions()) {
 44:                     if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
 45:                         return true;
 46:                     } else {
 47:                         return false;
 48:                     }
 49:                 }
 50:             } else {
 51:                 if ($options = $item->getProductOptions()) {
 52:                     if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
 53:                         return false;
 54:                     } else {
 55:                         return true;
 56:                     }
 57:                 }
 58:             }
 59:         }
 60: 
 61:         if ($options = $this->getOrderItem()->getProductOptions()) {
 62:             if (isset($options['shipment_type']) && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
 63:                 return true;
 64:             }
 65:         }
 66:         return false;
 67:     }
 68: 
 69:     public function isChildCalculated($item = null)
 70:     {
 71:         if ($item) {
 72:             if ($item->getOrderItem()) {
 73:                 $item = $item->getOrderItem();
 74:             }
 75:             if ($parentItem = $item->getParentItem()) {
 76:                 if ($options = $parentItem->getProductOptions()) {
 77:                     if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
 78:                         return true;
 79:                     } else {
 80:                         return false;
 81:                     }
 82:                 }
 83:             } else {
 84:                 if ($options = $item->getProductOptions()) {
 85:                     if (isset($options['product_calculations']) && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
 86:                         return false;
 87:                     } else {
 88:                         return true;
 89:                     }
 90:                 }
 91:             }
 92:         }
 93: 
 94:         if ($options = $this->getOrderItem()->getProductOptions()) {
 95:             if (isset($options['product_calculations'])
 96:                 && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
 97:                 return true;
 98:             }
 99:         }
100:         return false;
101:     }
102: 
103:     public function getSelectionAttributes($item) {
104:         if ($item instanceof Mage_Sales_Model_Order_Item) {
105:             $options = $item->getProductOptions();
106:         } else {
107:             $options = $item->getOrderItem()->getProductOptions();
108:         }
109:         if (isset($options['bundle_selection_attributes'])) {
110:             return unserialize($options['bundle_selection_attributes']);
111:         }
112:         return null;
113:     }
114: 
115:     public function getValueHtml($item)
116:     {
117:         if ($attributes = $this->getSelectionAttributes($item)) {
118:             return sprintf('%d', $attributes['qty']) . ' x ' .
119:                 $this->htmlEscape($item->getName()) .
120:                 " " . $this->getOrder()->formatPrice($attributes['price']);
121:         } else {
122:             return $this->htmlEscape($item->getName());
123:         }
124:     }
125: 
126:     /**
127:      * Getting all available childs for Invoice, Shipmen or Creditmemo item
128:      *
129:      * @param Varien_Object $item
130:      * @return array
131:      */
132:     public function getChilds($item)
133:     {
134:         $_itemsArray = array();
135: 
136:         if ($item instanceof Mage_Sales_Model_Order_Invoice_Item) {
137:             $_items = $item->getInvoice()->getAllItems();
138:         } else if ($item instanceof Mage_Sales_Model_Order_Shipment_Item) {
139:             $_items = $item->getShipment()->getAllItems();
140:         } else if ($item instanceof Mage_Sales_Model_Order_Creditmemo_Item) {
141:             $_items = $item->getCreditmemo()->getAllItems();
142:         }
143: 
144:         if ($_items) {
145:             foreach ($_items as $_item) {
146:                 if ($parentItem = $_item->getOrderItem()->getParentItem()) {
147:                     $_itemsArray[$parentItem->getId()][$_item->getOrderItemId()] = $_item;
148:                 } else {
149:                     $_itemsArray[$_item->getOrderItem()->getId()][$_item->getOrderItemId()] = $_item;
150:                 }
151:             }
152:         }
153: 
154:         if (isset($_itemsArray[$item->getOrderItem()->getId()])) {
155:             return $_itemsArray[$item->getOrderItem()->getId()];
156:         } else {
157:             return null;
158:         }
159:     }
160: 
161:     public function canShowPriceInfo($item)
162:     {
163:         if (($item->getOrderItem()->getParentItem() && $this->isChildCalculated())
164:                 || (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())) {
165:             return true;
166:         }
167:         return false;
168:     }
169: }
170: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0