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:  * Sales Order Pdf Items renderer
 29:  *
 30:  * @category   Mage
 31:  * @package    Mage_Bundle
 32:  * @author     Magento Core Team <core@magentocommerce.com>
 33:  */
 34: abstract class Mage_Bundle_Model_Sales_Order_Pdf_Items_Abstract extends Mage_Sales_Model_Order_Pdf_Items_Abstract
 35: {
 36:     /**
 37:      * Getting all available childs for Invoice, Shipmen or Creditmemo item
 38:      *
 39:      * @param Varien_Object $item
 40:      * @return array
 41:      */
 42:     public function getChilds($item)
 43:     {
 44:         $_itemsArray = array();
 45: 
 46:         if ($item instanceof Mage_Sales_Model_Order_Invoice_Item) {
 47:             $_items = $item->getInvoice()->getAllItems();
 48:         } else if ($item instanceof Mage_Sales_Model_Order_Shipment_Item) {
 49:             $_items = $item->getShipment()->getAllItems();
 50:         } else if ($item instanceof Mage_Sales_Model_Order_Creditmemo_Item) {
 51:             $_items = $item->getCreditmemo()->getAllItems();
 52:         }
 53: 
 54:         if ($_items) {
 55:             foreach ($_items as $_item) {
 56:                 $parentItem = $_item->getOrderItem()->getParentItem();
 57:                 if ($parentItem) {
 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:     /**
 73:      * Retrieve is Shipment Separately flag for Item
 74:      *
 75:      * @param Varien_Object $item
 76:      * @return bool
 77:      */
 78:     public function isShipmentSeparately($item = null)
 79:     {
 80:         if ($item) {
 81:             if ($item->getOrderItem()) {
 82:                 $item = $item->getOrderItem();
 83:             }
 84: 
 85:             $parentItem = $item->getParentItem();
 86:             if ($parentItem) {
 87:                 $options = $parentItem->getProductOptions();
 88:                 if ($options) {
 89:                     if (isset($options['shipment_type'])
 90:                         && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
 91:                         return true;
 92:                     } else {
 93:                         return false;
 94:                     }
 95:                 }
 96:             } else {
 97:                 $options = $item->getProductOptions();
 98:                 if ($options) {
 99:                     if (isset($options['shipment_type'])
100:                         && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
101:                         return false;
102:                     } else {
103:                         return true;
104:                     }
105:                 }
106:             }
107:         }
108: 
109:         $options = $this->getOrderItem()->getProductOptions();
110:         if ($options) {
111:             if (isset($options['shipment_type'])
112:                 && $options['shipment_type'] == Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
113:                 return true;
114:             }
115:         }
116:         return false;
117:     }
118: 
119:     /**
120:      * Retrieve is Child Calculated
121:      *
122:      * @param Varien_Object $item
123:      * @return bool
124:      */
125:     public function isChildCalculated($item = null)
126:     {
127:         if ($item) {
128:             if ($item->getOrderItem()) {
129:                 $item = $item->getOrderItem();
130:             }
131: 
132:             $parentItem = $item->getParentItem();
133:             if ($parentItem) {
134:                 $options = $parentItem->getProductOptions();
135:                 if ($options) {
136:                     if (isset($options['product_calculations']) &&
137:                         $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD
138:                     ) {
139:                         return true;
140:                     } else {
141:                         return false;
142:                     }
143:                 }
144:             } else {
145:                 $options = $item->getProductOptions();
146:                 if ($options) {
147:                     if (isset($options['product_calculations']) &&
148:                         $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD
149:                     ) {
150:                         return false;
151:                     } else {
152:                         return true;
153:                     }
154:                 }
155:             }
156:         }
157: 
158:         $options = $this->getOrderItem()->getProductOptions();
159:         if ($options) {
160:             if (isset($options['product_calculations'])
161:                 && $options['product_calculations'] == Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
162:                 return true;
163:             }
164:         }
165:         return false;
166:     }
167: 
168:     /**
169:      * Retrieve Bundle Options
170:      *
171:      * @param Varien_Object $item
172:      * @return array
173:      */
174:     public function getBundleOptions($item = null)
175:     {
176:         $options = $this->getOrderItem()->getProductOptions();
177:         if ($options) {
178:             if (isset($options['bundle_options'])) {
179:                 return $options['bundle_options'];
180:             }
181:         }
182:         return array();
183:     }
184: 
185:     /**
186:      * Retrieve Selection attributes
187:      *
188:      * @param Varien_Object $item
189:      * @return mixed
190:      */
191:     public function getSelectionAttributes($item)
192:     {
193:         if ($item instanceof Mage_Sales_Model_Order_Item) {
194:             $options = $item->getProductOptions();
195:         } else {
196:             $options = $item->getOrderItem()->getProductOptions();
197:         }
198:         if (isset($options['bundle_selection_attributes'])) {
199:             return unserialize($options['bundle_selection_attributes']);
200:         }
201:         return null;
202:     }
203: 
204:     /**
205:      * Retrieve Order options
206:      *
207:      * @param Varien_Object $item
208:      * @return array
209:      */
210:     public function getOrderOptions($item = null)
211:     {
212:         $result = array();
213: 
214:         $options = $this->getOrderItem()->getProductOptions();
215:         if ($options) {
216:             if (isset($options['options'])) {
217:                 $result = array_merge($result, $options['options']);
218:             }
219:             if (isset($options['additional_options'])) {
220:                 $result = array_merge($result, $options['additional_options']);
221:             }
222:             if (!empty($options['attributes_info'])) {
223:                 $result = array_merge($options['attributes_info'], $result);
224:             }
225:         }
226:         return $result;
227:     }
228: 
229:     /**
230:      * Retrieve Order Item
231:      *
232:      * @return Mage_Sales_Order_Item
233:      */
234:     public function getOrderItem()
235:     {
236:         if ($this->getItem() instanceof Mage_Sales_Order_Item) {
237:             return $this->getItem();
238:         } else {
239:             return $this->getItem()->getOrderItem();
240:         }
241:     }
242: 
243:     /**
244:      * Retrieve Value HTML
245:      *
246:      * @param Mage_Sales_Order_Item $item
247:      * @return string
248:      */
249:     public function getValueHtml($item)
250:     {
251:         $result = strip_tags($item->getName());
252:         if (!$this->isShipmentSeparately($item)) {
253:             $attributes = $this->getSelectionAttributes($item);
254:             if ($attributes) {
255:                 $result =  sprintf('%d', $attributes['qty']) . ' x ' . $result;
256:             }
257:         }
258:         if (!$this->isChildCalculated($item)) {
259:             $attributes = $this->getSelectionAttributes($item);
260:             if ($attributes) {
261:                 $result .= " " . strip_tags($this->getOrderItem()->getOrder()->formatPrice($attributes['price']));
262:             }
263:         }
264:         return $result;
265:     }
266: 
267:     /**
268:      * Can show price info for item
269:      *
270:      * @param Mage_Sales_Order_Item $item
271:      * @return bool
272:      */
273:     public function canShowPriceInfo($item)
274:     {
275:         if (($item->getOrderItem()->getParentItem() && $this->isChildCalculated())
276:                 || (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())) {
277:             return true;
278:         }
279:         return false;
280:     }
281: }
282: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0