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:  * Bundle Selections Resource Collection
 30:  *
 31:  * @category    Mage
 32:  * @package     Mage_Bundle
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_Bundle_Model_Resource_Selection_Collection extends Mage_Catalog_Model_Resource_Product_Collection
 36: {
 37:     /**
 38:      * Selection table name
 39:      *
 40:      * @var string
 41:      */
 42:     protected $_selectionTable;
 43: 
 44:     /**
 45:      * Initialize collection
 46:      *
 47:      */
 48:     protected function _construct()
 49:     {
 50:         parent::_construct();
 51:         $this->setRowIdFieldName('selection_id');
 52:         $this->_selectionTable = $this->getTable('bundle/selection');
 53:     }
 54: 
 55:     /**
 56:      * Set store id for each collection item when collection was loaded
 57:      *
 58:      * @return void
 59:      */
 60:     public function _afterLoad()
 61:     {
 62:         parent::_afterLoad();
 63:         if ($this->getStoreId() && $this->_items) {
 64:             foreach ($this->_items as $item) {
 65:                 $item->setStoreId($this->getStoreId());
 66:             }
 67:         }
 68:         return $this;
 69:     }
 70: 
 71:     /**
 72:      * Initialize collection select
 73:      *
 74:      */
 75:     protected function _initSelect()
 76:     {
 77:         parent::_initSelect();
 78:         $this->getSelect()->join(array('selection' => $this->_selectionTable),
 79:             'selection.product_id = e.entity_id',
 80:             array('*')
 81:         );
 82:     }
 83: 
 84:     /**
 85:      * Join website scope prices to collection, override default prices
 86:      *
 87:      * @param int $websiteId
 88:      * @return Mage_Bundle_Model_Resource_Selection_Collection
 89:      */
 90:     public function joinPrices($websiteId)
 91:     {
 92:         $adapter = $this->getConnection();
 93:         $priceType = $adapter->getCheckSql(
 94:             'price.selection_price_type IS NOT NULL',
 95:             'price.selection_price_type',
 96:             'selection.selection_price_type'
 97:         );
 98:         $priceValue = $adapter->getCheckSql(
 99:             'price.selection_price_value IS NOT NULL',
100:             'price.selection_price_value',
101:             'selection.selection_price_value'
102:         );
103:         $this->getSelect()->joinLeft(array('price' => $this->getTable('bundle/selection_price')),
104:             'selection.selection_id = price.selection_id AND price.website_id = ' . (int)$websiteId,
105:             array(
106:                 'selection_price_type' => $priceType,
107:                 'selection_price_value' => $priceValue,
108:                 'price_scope' => 'price.website_id'
109:             )
110:         );
111:         return $this;
112:     }
113: 
114:     /**
115:      * Apply option ids filter to collection
116:      *
117:      * @param array $optionIds
118:      * @return Mage_Bundle_Model_Resource_Selection_Collection
119:      */
120:     public function setOptionIdsFilter($optionIds)
121:     {
122:         if (!empty($optionIds)) {
123:             $this->getSelect()->where('selection.option_id IN (?)', $optionIds);
124:         }
125:         return $this;
126:     }
127: 
128:     /**
129:      * Apply selection ids filter to collection
130:      *
131:      * @param array $selectionIds
132:      * @return Mage_Bundle_Model_Resource_Selection_Collection
133:      */
134:     public function setSelectionIdsFilter($selectionIds)
135:     {
136:         if (!empty($selectionIds)) {
137:             $this->getSelect()->where('selection.selection_id IN (?)', $selectionIds);
138:         }
139:         return $this;
140:     }
141: 
142:     /**
143:      * Set position order
144:      *
145:      * @return Mage_Bundle_Model_Resource_Selection_Collection
146:      */
147:     public function setPositionOrder()
148:     {
149:         $this->getSelect()->order('selection.position asc')
150:             ->order('selection.selection_id asc');
151:         return $this;
152:     }
153: }
154: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0