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 Product Price Index
 30:  *
 31:  * @method Mage_Bundle_Model_Resource_Price_Index _getResource()
 32:  * @method Mage_Bundle_Model_Resource_Price_Index getResource()
 33:  * @method Mage_Bundle_Model_Price_Index setEntityId(int $value)
 34:  * @method int getWebsiteId()
 35:  * @method Mage_Bundle_Model_Price_Index setWebsiteId(int $value)
 36:  * @method int getCustomerGroupId()
 37:  * @method Mage_Bundle_Model_Price_Index setCustomerGroupId(int $value)
 38:  * @method float getMinPrice()
 39:  * @method Mage_Bundle_Model_Price_Index setMinPrice(float $value)
 40:  * @method float getMaxPrice()
 41:  * @method Mage_Bundle_Model_Price_Index setMaxPrice(float $value)
 42:  *
 43:  * @category    Mage
 44:  * @package     Mage_Bundle
 45:  * @author      Magento Core Team <core@magentocommerce.com>
 46:  */
 47: class Mage_Bundle_Model_Price_Index extends Mage_Core_Model_Abstract
 48: {
 49:     /**
 50:      * Initialize resource model
 51:      *
 52:      */
 53:     protected function _construct()
 54:     {
 55:         $this->_init('bundle/price_index');
 56:     }
 57: 
 58:     /**
 59:      * Retrieve resource instance wrapper
 60:      *
 61:      * @return Mage_Bundle_Model_Mysql4_Price_Index
 62:      */
 63:     protected function _getResource()
 64:     {
 65:         return parent::_getResource();
 66:     }
 67: 
 68:     /**
 69:      * Reindex Product price
 70:      *
 71:      * @param int $productId
 72:      * @param int $priceType
 73:      * @return Mage_Bundle_Model_Price_Index
 74:      */
 75:     protected function _reindexProduct($productId, $priceType)
 76:     {
 77:         $this->_getResource()->reindexProduct($productId, $priceType);
 78:         return $this;
 79:     }
 80: 
 81:     /**
 82:      * Reindex Bundle product Price Index
 83:      *
 84:      * @param Mage_Core_Model_Product|Mage_Catalog_Model_Product_Condition_Interface|array|int $products
 85:      * @return Mage_Bundle_Model_Price_Index
 86:      */
 87:     public function reindex($products = null)
 88:     {
 89:         $this->_getResource()->reindex($products);
 90:         return $this;
 91:     }
 92: 
 93:     /**
 94:      * Add bundle price range index to Product collection
 95:      *
 96:      * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
 97:      * @return Mage_Bundle_Model_Price_Index
 98:      */
 99:     public function addPriceIndexToCollection($collection)
100:     {
101:         $productObjects = array();
102:         $productIds     = array();
103:         foreach ($collection->getItems() as $product) {
104:             /* @var $product Mage_Catalog_Model_Product */
105:             if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
106:                 $productIds[] = $product->getEntityId();
107:                 $productObjects[$product->getEntityId()] = $product;
108:             }
109:         }
110:         $websiteId  = Mage::app()->getStore($collection->getStoreId())
111:             ->getWebsiteId();
112:         $groupId    = Mage::getSingleton('customer/session')
113:             ->getCustomerGroupId();
114: 
115:         $addOptionsToResult = false;
116:         $prices = $this->_getResource()->loadPriceIndex($productIds, $websiteId, $groupId);
117:         foreach ($productIds as $productId) {
118:             if (isset($prices[$productId])) {
119:                 $productObjects[$productId]
120:                     ->setData('_price_index', true)
121:                     ->setData('_price_index_min_price', $prices[$productId]['min_price'])
122:                     ->setData('_price_index_max_price', $prices[$productId]['max_price']);
123:             }
124:             else {
125:                 $addOptionsToResult = true;
126:             }
127:         }
128: 
129:         if ($addOptionsToResult) {
130:             $collection->addOptionsToResult();
131:         }
132: 
133:         return $this;
134:     }
135: 
136:     /**
137:      * Add price index to bundle product after load
138:      *
139:      * @param Mage_Catalog_Model_Product $product
140:      * @return Mage_Bundle_Model_Price_Index
141:      */
142:     public function addPriceIndexToProduct($product)
143:     {
144:         $websiteId  = $product->getStore()->getWebsiteId();
145:         $groupId    = Mage::getSingleton('customer/session')
146:             ->getCustomerGroupId();
147:         $prices = $this->_getResource()
148:             ->loadPriceIndex($product->getId(), $websiteId, $groupId);
149:         if (isset($prices[$product->getId()])) {
150:             $product->setData('_price_index', true)
151:                 ->setData('_price_index_min_price', $prices[$product->getId()]['min_price'])
152:                 ->setData('_price_index_max_price', $prices[$product->getId()]['max_price']);
153:         }
154:         return $this;
155:     }
156: }
157: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0