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:  * Bundle Option Model
 29:  *
 30:  * @method Mage_Bundle_Model_Resource_Option _getResource()
 31:  * @method Mage_Bundle_Model_Resource_Option getResource()
 32:  * @method int getParentId()
 33:  * @method Mage_Bundle_Model_Option setParentId(int $value)
 34:  * @method int getRequired()
 35:  * @method Mage_Bundle_Model_Option setRequired(int $value)
 36:  * @method int getPosition()
 37:  * @method Mage_Bundle_Model_Option setPosition(int $value)
 38:  * @method string getType()
 39:  * @method Mage_Bundle_Model_Option setType(string $value)
 40:  *
 41:  * @category    Mage
 42:  * @package     Mage_Bundle
 43:  * @author      Magento Core Team <core@magentocommerce.com>
 44:  */
 45: class Mage_Bundle_Model_Option extends Mage_Core_Model_Abstract
 46: {
 47:     /**
 48:      * Default selection object
 49:      *
 50:      * @var Mage_Bundle_Model_Selection
 51:      */
 52:     protected $_defaultSelection = null;
 53: 
 54:     /**
 55:      * Initialize resource model
 56:      *
 57:      */
 58:     protected function _construct()
 59:     {
 60:         $this->_init('bundle/option');
 61:         parent::_construct();
 62:     }
 63: 
 64:     /**
 65:      * Add selection to option
 66:      *
 67:      * @param Mage_Bundle_Model_Selection $selection
 68:      * @return Mage_Bundle_Model_Option
 69:      */
 70:     public function addSelection($selection)
 71:     {
 72:         if (!$selection) {
 73:             return false;
 74:         }
 75:         if (!$selections = $this->getData('selections')) {
 76:             $selections = array();
 77:         }
 78:         array_push($selections, $selection);
 79:         $this->setSelections($selections);
 80:         return $this;
 81:     }
 82: 
 83:     /**
 84:      * Check Is Saleable Option
 85:      *
 86:      * @return bool
 87:      */
 88:     public function isSaleable()
 89:     {
 90:         $saleable = 0;
 91:         if ($this->getSelections()) {
 92:             foreach ($this->getSelections() as $selection) {
 93:                 if ($selection->isSaleable()) {
 94:                     $saleable++;
 95:                 }
 96:             }
 97:             return (bool)$saleable;
 98:         }
 99:         else {
100:             return false;
101:         }
102:     }
103: 
104:     /**
105:      * Retrieve default Selection object
106:      *
107:      * @return Mage_Bundle_Model_Selection
108:      */
109:     public function getDefaultSelection()
110:     {
111:         if (!$this->_defaultSelection && $this->getSelections()) {
112:             foreach ($this->getSelections() as $selection) {
113:                 if ($selection->getIsDefault()) {
114:                     $this->_defaultSelection = $selection;
115:                     break;
116:                 }
117:             }
118:         }
119:         return $this->_defaultSelection;
120:         /**
121:          *         if (!$this->_defaultSelection && $this->getSelections()) {
122:             $_selections = array();
123:             foreach ($this->getSelections() as $selection) {
124:                 if ($selection->getIsDefault()) {
125:                     $_selections[] = $selection;
126:                 }
127:             }
128:             if (!empty($_selections)) {
129:                 $this->_defaultSelection = $_selections;
130:             } else {
131:                 return null;
132:             }
133:         }
134:         return $this->_defaultSelection;
135:          */
136:     }
137: 
138:     /**
139:      * Check is multi Option selection
140:      *
141:      * @return bool
142:      */
143:     public function isMultiSelection()
144:     {
145:         if ($this->getType() == 'checkbox' || $this->getType() == 'multi') {
146:             return true;
147:         } else {
148:             return false;
149:         }
150:     }
151: 
152:     /**
153:      * Retrieve options searchable data
154:      *
155:      * @param int $productId
156:      * @param int $storeId
157:      * @return array
158:      */
159:     public function getSearchableData($productId, $storeId)
160:     {
161:         return $this->_getResource()
162:             ->getSearchableData($productId, $storeId);
163:     }
164: 
165:     /**
166:      * Return selection by it's id
167:      *
168:      * @param int $selectionId
169:      * @return Mage_Bundle_Model_Selection
170:      */
171:     public function getSelectionById($selectionId)
172:     {
173:         $selections = $this->getSelections();
174:         $i = count($selections);
175: 
176:         while ($i-- && $selections[$i]->getSelectionId() != $selectionId);
177: 
178:         return $i == -1 ? false : $selections[$i];
179:     }
180: }
181: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0