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:  * Helper for fetching properties by product configurational item
 29:  *
 30:  * @category   Mage
 31:  * @package    Mage_Bundle
 32:  * @author     Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Bundle_Helper_Catalog_Product_Configuration extends Mage_Core_Helper_Abstract
 35:     implements Mage_Catalog_Helper_Product_Configuration_Interface
 36: {
 37:     /**
 38:      * Get selection quantity
 39:      *
 40:      * @param Mage_Catalog_Model_Product $product
 41:      * @param int $selectionId
 42:      * @return decimal
 43:      */
 44:     public function getSelectionQty($product, $selectionId)
 45:     {
 46:         $selectionQty = $product->getCustomOption('selection_qty_' . $selectionId);
 47:         if ($selectionQty) {
 48:             return $selectionQty->getValue();
 49:         }
 50:         return 0;
 51:     }
 52: 
 53:     /**
 54:      * Obtain final price of selection in a bundle product
 55:      *
 56:      * @param Mage_Catalog_Model_Product_Configuration_Item_Interface $item
 57:      * @param Mage_Catalog_Model_Product $selectionProduct
 58:      * @return decimal
 59:      */
 60:     public function getSelectionFinalPrice(Mage_Catalog_Model_Product_Configuration_Item_Interface $item,
 61:         $selectionProduct)
 62:     {
 63:         $selectionProduct->unsetData('final_price');
 64:         return $item->getProduct()->getPriceModel()->getSelectionFinalTotalPrice(
 65:             $item->getProduct(),
 66:             $selectionProduct,
 67:             $item->getQty() * 1,
 68:             $this->getSelectionQty($item->getProduct(), $selectionProduct->getSelectionId()),
 69:             false,
 70:             true
 71:         );
 72:     }
 73: 
 74:     /**
 75:      * Get bundled selections (slections-products collection)
 76:      *
 77:      * Returns array of options objects.
 78:      * Each option object will contain array of selections objects
 79:      *
 80:      * @return array
 81:      */
 82:     public function getBundleOptions(Mage_Catalog_Model_Product_Configuration_Item_Interface $item)
 83:     {
 84:         $options = array();
 85:         $product = $item->getProduct();
 86: 
 87:         /**
 88:          * @var Mage_Bundle_Model_Product_Type
 89:          */
 90:         $typeInstance = $product->getTypeInstance(true);
 91: 
 92:         // get bundle options
 93:         $optionsQuoteItemOption = $item->getOptionByCode('bundle_option_ids');
 94:         $bundleOptionsIds = $optionsQuoteItemOption ? unserialize($optionsQuoteItemOption->getValue()) : array();
 95:         if ($bundleOptionsIds) {
 96:             /**
 97:             * @var Mage_Bundle_Model_Mysql4_Option_Collection
 98:             */
 99:             $optionsCollection = $typeInstance->getOptionsByIds($bundleOptionsIds, $product);
100: 
101:             // get and add bundle selections collection
102:             $selectionsQuoteItemOption = $item->getOptionByCode('bundle_selection_ids');
103: 
104:             $selectionsCollection = $typeInstance->getSelectionsByIds(
105:                 unserialize($selectionsQuoteItemOption->getValue()),
106:                 $product
107:             );
108: 
109:             $bundleOptions = $optionsCollection->appendSelections($selectionsCollection, true);
110:             foreach ($bundleOptions as $bundleOption) {
111:                 if ($bundleOption->getSelections()) {
112:                     $option = array(
113:                         'label' => $bundleOption->getTitle(),
114:                         'value' => array()
115:                     );
116: 
117:                     $bundleSelections = $bundleOption->getSelections();
118: 
119:                     foreach ($bundleSelections as $bundleSelection) {
120:                         $qty = $this->getSelectionQty($product, $bundleSelection->getSelectionId()) * 1;
121:                         if ($qty) {
122:                             $option['value'][] = $qty . ' x ' . $this->escapeHtml($bundleSelection->getName())
123:                                 . ' ' . Mage::helper('core')->currency(
124:                                     $this->getSelectionFinalPrice($item, $bundleSelection)
125:                                 );
126:                         }
127:                     }
128: 
129:                     if ($option['value']) {
130:                         $options[] = $option;
131:                     }
132:                 }
133:             }
134:         }
135: 
136:         return $options;
137:     }
138: 
139:     /**
140:      * Retrieves product options list
141:      *
142:      * @param Mage_Catalog_Model_Product_Configuration_Item_Interface $item
143:      * @return array
144:      */
145:     public function getOptions(Mage_Catalog_Model_Product_Configuration_Item_Interface $item)
146:     {
147:         return array_merge(
148:             $this->getBundleOptions($item),
149:             Mage::helper('catalog/product_configuration')->getCustomOptions($item)
150:         );
151:     }
152: }
153: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0