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_CatalogInventory_Block_Adminhtml_Form_Field_Customergroup
  • Mage_CatalogInventory_Block_Adminhtml_Form_Field_Minsaleqty
  • Mage_CatalogInventory_Block_Qtyincrements
  • Mage_CatalogInventory_Block_Stockqty_Abstract
  • Mage_CatalogInventory_Block_Stockqty_Composite
  • Mage_CatalogInventory_Block_Stockqty_Default
  • Mage_CatalogInventory_Block_Stockqty_Type_Configurable
  • Mage_CatalogInventory_Block_Stockqty_Type_Grouped
  • Mage_CatalogInventory_Helper_Data
  • Mage_CatalogInventory_Helper_Minsaleqty
  • Mage_CatalogInventory_Model_Api2_Stock_Item
  • Mage_CatalogInventory_Model_Api2_Stock_Item_Rest
  • Mage_CatalogInventory_Model_Api2_Stock_Item_Rest_Admin_V1
  • Mage_CatalogInventory_Model_Api2_Stock_Item_Validator_Item
  • Mage_CatalogInventory_Model_Indexer_Stock
  • Mage_CatalogInventory_Model_Mysql4_Indexer_Stock
  • Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Configurable
  • Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Default
  • Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Grouped
  • Mage_CatalogInventory_Model_Mysql4_Stock
  • Mage_CatalogInventory_Model_Mysql4_Stock_Item
  • Mage_CatalogInventory_Model_Mysql4_Stock_Item_Collection
  • Mage_CatalogInventory_Model_Mysql4_Stock_Status
  • Mage_CatalogInventory_Model_Observer
  • Mage_CatalogInventory_Model_Resource_Indexer_Stock
  • Mage_CatalogInventory_Model_Resource_Indexer_Stock_Configurable
  • Mage_CatalogInventory_Model_Resource_Indexer_Stock_Default
  • Mage_CatalogInventory_Model_Resource_Indexer_Stock_Grouped
  • Mage_CatalogInventory_Model_Resource_Stock
  • Mage_CatalogInventory_Model_Resource_Stock_Item
  • Mage_CatalogInventory_Model_Resource_Stock_Item_Collection
  • Mage_CatalogInventory_Model_Resource_Stock_Status
  • Mage_CatalogInventory_Model_Source_Backorders
  • Mage_CatalogInventory_Model_Source_Stock
  • Mage_CatalogInventory_Model_Stock
  • Mage_CatalogInventory_Model_Stock_Item
  • Mage_CatalogInventory_Model_Stock_Item_Api
  • Mage_CatalogInventory_Model_Stock_Item_Api_V2
  • Mage_CatalogInventory_Model_Stock_Status
  • Mage_CatalogInventory_Model_System_Config_Backend_Minqty
  • Mage_CatalogInventory_Model_System_Config_Backend_Minsaleqty
  • Mage_CatalogInventory_Model_System_Config_Backend_Qtyincrements

Interfaces

  • Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Interface
  • Mage_CatalogInventory_Model_Resource_Indexer_Stock_Interface
  • 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_CatalogInventory
 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:  * CatalogInventory Grouped Products Stock Status Indexer Resource Model
 30:  *
 31:  * @category    Mage
 32:  * @package     Mage_CatalogInventory
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_CatalogInventory_Model_Resource_Indexer_Stock_Grouped
 36:     extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Default
 37: {
 38:     /**
 39:      * Reindex stock data for defined configurable product ids
 40:      *
 41:      * @param int|array $entityIds
 42:      * @return Mage_CatalogInventory_Model_Resource_Indexer_Stock_Grouped
 43:      */
 44:     public function reindexEntity($entityIds)
 45:     {
 46:         $this->_updateIndex($entityIds);
 47:         return $this;
 48:     }
 49: 
 50:     /**
 51:      * Get the select object for get stock status by product ids
 52:      *
 53:      * @param int|array $entityIds
 54:      * @param bool $usePrimaryTable use primary or temporary index table
 55:      * @return Varien_Db_Select
 56:      */
 57:     protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = false)
 58:     {
 59:         $adapter  = $this->_getWriteAdapter();
 60:         $idxTable = $usePrimaryTable ? $this->getMainTable() : $this->getIdxTable();
 61:         $select   = $adapter->select()
 62:             ->from(array('e' => $this->getTable('catalog/product')), array('entity_id'));
 63:         $this->_addWebsiteJoinToSelect($select, true);
 64:         $this->_addProductWebsiteJoinToSelect($select, 'cw.website_id', 'e.entity_id');
 65:         $select->columns('cw.website_id')
 66:             ->join(
 67:                 array('cis' => $this->getTable('cataloginventory/stock')),
 68:                 '',
 69:                 array('stock_id'))
 70:             ->joinLeft(
 71:                 array('cisi' => $this->getTable('cataloginventory/stock_item')),
 72:                 'cisi.stock_id = cis.stock_id AND cisi.product_id = e.entity_id',
 73:                 array())
 74:             ->joinLeft(
 75:                 array('l' => $this->getTable('catalog/product_link')),
 76:                 'e.entity_id = l.product_id AND l.link_type_id=' . Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED,
 77:                 array())
 78:             ->joinLeft(
 79:                 array('le' => $this->getTable('catalog/product')),
 80:                 'le.entity_id = l.linked_product_id',
 81:                 array())
 82:             ->joinLeft(
 83:                 array('i' => $idxTable),
 84:                 'i.product_id = l.linked_product_id AND cw.website_id = i.website_id AND cis.stock_id = i.stock_id',
 85:                 array())
 86:             ->columns(array('qty' => new Zend_Db_Expr('0')))
 87:             ->where('cw.website_id != 0')
 88:             ->where('e.type_id = ?', $this->getTypeId())
 89:             ->group(array('e.entity_id', 'cw.website_id', 'cis.stock_id'));
 90: 
 91:         // add limitation of status
 92:         $psExpr = $this->_addAttributeToSelect($select, 'status', 'e.entity_id', 'cs.store_id');
 93:         $psCond = $adapter->quoteInto($psExpr . '=?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
 94: 
 95:         if ($this->_isManageStock()) {
 96:             $statusExpr = $adapter->getCheckSql('cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0',
 97:                 1, 'cisi.is_in_stock');
 98:         } else {
 99:             $statusExpr = $adapter->getCheckSql('cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1',
100:                 'cisi.is_in_stock', 1);
101:         }
102: 
103:         $optExpr = $adapter->getCheckSql("{$psCond} AND le.required_options = 0", 'i.stock_status', 0);
104:         $stockStatusExpr = $adapter->getLeastSql(array("MAX({$optExpr})", "MIN({$statusExpr})"));
105: 
106:         $select->columns(array(
107:             'status' => $stockStatusExpr
108:         ));
109: 
110:         if (!is_null($entityIds)) {
111:             $select->where('e.entity_id IN(?)', $entityIds);
112:         }
113: 
114:         return $select;
115:     }
116: }
117: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0