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_CatalogIndex_Model_Aggregation
  • Mage_CatalogIndex_Model_Attribute
  • Mage_CatalogIndex_Model_Catalog_Index_Flag
  • Mage_CatalogIndex_Model_Catalog_Index_Kill_Flag
  • Mage_CatalogIndex_Model_Data_Abstract
  • Mage_CatalogIndex_Model_Data_Configurable
  • Mage_CatalogIndex_Model_Data_Grouped
  • Mage_CatalogIndex_Model_Data_Simple
  • Mage_CatalogIndex_Model_Data_Virtual
  • Mage_CatalogIndex_Model_Indexer
  • Mage_CatalogIndex_Model_Indexer_Abstract
  • Mage_CatalogIndex_Model_Indexer_Eav
  • Mage_CatalogIndex_Model_Indexer_Minimalprice
  • Mage_CatalogIndex_Model_Indexer_Price
  • Mage_CatalogIndex_Model_Indexer_Tierprice
  • Mage_CatalogIndex_Model_Mysql4_Abstract
  • Mage_CatalogIndex_Model_Mysql4_Aggregation
  • Mage_CatalogIndex_Model_Mysql4_Attribute
  • Mage_CatalogIndex_Model_Mysql4_Data_Abstract
  • Mage_CatalogIndex_Model_Mysql4_Data_Configurable
  • Mage_CatalogIndex_Model_Mysql4_Data_Grouped
  • Mage_CatalogIndex_Model_Mysql4_Indexer
  • Mage_CatalogIndex_Model_Mysql4_Indexer_Abstract
  • Mage_CatalogIndex_Model_Mysql4_Indexer_Eav
  • Mage_CatalogIndex_Model_Mysql4_Indexer_Minimalprice
  • Mage_CatalogIndex_Model_Mysql4_Indexer_Price
  • Mage_CatalogIndex_Model_Mysql4_Price
  • Mage_CatalogIndex_Model_Mysql4_Retreiver
  • Mage_CatalogIndex_Model_Mysql4_Setup
  • Mage_CatalogIndex_Model_Observer
  • Mage_CatalogIndex_Model_Price
  • Mage_CatalogIndex_Model_Resource_Abstract
  • Mage_CatalogIndex_Model_Resource_Aggregation
  • Mage_CatalogIndex_Model_Resource_Attribute
  • Mage_CatalogIndex_Model_Resource_Data_Abstract
  • Mage_CatalogIndex_Model_Resource_Data_Configurable
  • Mage_CatalogIndex_Model_Resource_Data_Grouped
  • Mage_CatalogIndex_Model_Resource_Indexer
  • Mage_CatalogIndex_Model_Resource_Indexer_Abstract
  • Mage_CatalogIndex_Model_Resource_Indexer_Eav
  • Mage_CatalogIndex_Model_Resource_Indexer_Minimalprice
  • Mage_CatalogIndex_Model_Resource_Indexer_Price
  • Mage_CatalogIndex_Model_Resource_Price
  • Mage_CatalogIndex_Model_Resource_Retreiver
  • Mage_CatalogIndex_Model_Resource_Setup
  • Mage_CatalogIndex_Model_Retreiver

Interfaces

  • Mage_CatalogIndex_Model_Indexer_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_CatalogIndex
 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:  * Catalog indexer abstract class
 30:  *
 31:  * @author      Magento Core Team <core@magentocommerce.com>
 32:  */
 33: abstract class Mage_CatalogIndex_Model_Indexer_Abstract
 34:     extends Mage_Core_Model_Abstract
 35:     implements Mage_CatalogIndex_Model_Indexer_Interface
 36: {
 37:     protected $_processChildren = true;
 38:     protected $_processChildrenForConfigurable = true;
 39:     protected $_runOnce = false;
 40: 
 41:     public function processAfterSave(Mage_Catalog_Model_Product $object, $forceId = null)
 42:     {
 43:         $associated = array();
 44:         switch ($object->getTypeId()) {
 45:             case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
 46:                 $associated = $object->getTypeInstance(true)->getAssociatedProducts($object);
 47:                 break;
 48: 
 49:             case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE:
 50:                 $associated = $object->getTypeInstance(true)->getUsedProducts(null, $object);
 51:                 break;
 52:         }
 53: 
 54:         if (!$this->_isObjectIndexable($object) && is_null($forceId)) {
 55:             return;
 56:         }
 57: 
 58:         $data = array();
 59: 
 60:         if ($this->_runOnce) {
 61:             $data = $this->createIndexData($object);
 62:         } else {
 63:             $attributes = $object->getAttributes();
 64:             foreach ($attributes as $attribute) {
 65:                 if ($this->_isAttributeIndexable($attribute) && $object->getData($attribute->getAttributeCode()) != null) {
 66:                     $row = $this->createIndexData($object, $attribute);
 67:                     if ($row && is_array($row)) {
 68:                         if (isset($row[0]) && is_array($row[0])) {
 69:                             $data = array_merge($data, $row);
 70:                         } else {
 71:                             $data[] = $row;
 72:                         }
 73:                     }
 74:                 }
 75:             }
 76:         }
 77:         $function = 'saveIndex';
 78:         if ($data && is_array($data)) {
 79:             if (isset($data[0]) && is_array($data[0]))
 80:                 $function = 'saveIndices';
 81: 
 82:             $this->$function($data, $object->getStoreId(), ($forceId != null ? $forceId : $object->getId()));
 83:         }
 84: 
 85:         if (!$this->_processChildrenForConfigurable && $object->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)
 86:             return;
 87: 
 88:         if ($associated && $this->_processChildren) {
 89: 
 90:             foreach ($associated as $child) {
 91:                 $child
 92:                     ->setStoreId($object->getStoreId())
 93:                     ->setWebsiteId($object->getWebsiteId());
 94:                 $this->processAfterSave($child, $object->getId());
 95:             }
 96:         }
 97:     }
 98: 
 99:     public function saveIndex($data, $storeId, $productId)
100:     {
101:         $this->_getResource()->saveIndex($data, $storeId, $productId);
102:     }
103: 
104:     public function saveIndices(array $data, $storeId, $productId)
105:     {
106:         $this->_getResource()->saveIndices($data, $storeId, $productId);
107:     }
108: 
109:     protected function _isObjectIndexable(Mage_Catalog_Model_Product $object)
110:     {
111:         if ($object->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
112:             return false;
113:         }
114: 
115:         if ($object->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG &&
116:             $object->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) {
117:             return false;
118:         }
119: 
120:         return true;
121:     }
122: 
123:     public function isAttributeIndexable(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
124:     {
125:         return $this->_isAttributeIndexable($attribute);
126:     }
127: 
128:     protected function _isAttributeIndexable(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
129:     {
130:         return true;
131:     }
132: 
133:     public function getIndexableAttributeCodes()
134:     {
135:         return $this->_getResource()->loadAttributeCodesByCondition($this->_getIndexableAttributeConditions());
136:     }
137: 
138:     protected function _getIndexableAttributeConditions()
139:     {
140:         return array();
141:     }
142: 
143:     public function cleanup($productId, $storeId = null)
144:     {
145:         $this->_getResource()->cleanup($productId, $storeId);
146:     }
147: 
148:     public function isAttributeIdUsed()
149:     {
150:         return true;
151:     }
152: }
153: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0