Mage_Catalog_Model_Product_Flat_Indexer Class Reference

Inheritance diagram for Mage_Catalog_Model_Product_Flat_Indexer:

Mage_Core_Model_Abstract Varien_Object

List of all members.

Public Member Functions

 rebuild ($store=null)
 updateAttribute ($attributeCode, $store=null)
 prepareDataStorage ($store=null)
 updateEventAttributes ($store=null)
 updateProductStatus ($productId, $status, $store=null)
 updateProduct ($productIds, $store=null)
 saveProduct ($productIds, $store=null)
 removeProduct ($productIds, $store=null)
 deleteStore ($store)

Protected Member Functions

 _construct ()
 _getResource ()


Detailed Description

Definition at line 35 of file Indexer.php.


Member Function Documentation

_construct (  )  [protected]

Standart model resource initialization

Reimplemented from Varien_Object.

Definition at line 41 of file Indexer.php.

00042     {
00043         $this->_init('catalog/product_flat_indexer');
00044     }

_getResource (  )  [protected]

Get resource instance

Returns:
Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Flat_Indexer

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 51 of file Indexer.php.

00052     {
00053         return parent::_getResource();
00054     }

deleteStore ( store  ) 

Delete store process

Parameters:
int $store
Returns:
Mage_Catalog_Model_Product_Flat_Indexer

Definition at line 238 of file Indexer.php.

00239     {
00240         $this->_getResource()->deleteFlatTable($store);
00241         return $this;
00242     }

prepareDataStorage ( store = null  ) 

Prepare datastorage for catalog product flat

Parameters:
int $store
Returns:
Mage_Catalog_Model_Product_Flat_Indexer

Definition at line 99 of file Indexer.php.

00100     {
00101         if (is_null($store)) {
00102             foreach (Mage::app()->getStores() as $store) {
00103                 $this->prepareDataStorage($store->getId());
00104             }
00105 
00106             return $this;
00107         }
00108 
00109         $this->_getResource()->prepareFlatTable($store);
00110 
00111         return $this;
00112     }

rebuild ( store = null  ) 

Rebuild Catalog Product Flat Data

Parameters:
mixed $store
Returns:
Mage_Catalog_Model_Product_Flat_Indexer

Definition at line 62 of file Indexer.php.

00063     {
00064         $this->_getResource()->rebuild($store);
00065         return $this;
00066     }

removeProduct ( productIds,
store = null 
)

Remove product from flat

Parameters:
int|array $productIds
int $store
Returns:
Mage_Catalog_Model_Product_Flat_Indexer

Definition at line 218 of file Indexer.php.

00219     {
00220         if (is_null($store)) {
00221             foreach (Mage::app()->getStores() as $store) {
00222                 $this->removeProduct($productIds, $store->getId());
00223             }
00224             return $this;
00225         }
00226 
00227         $this->_getResource()->removeProduct($productIds, $store);
00228 
00229         return $this;
00230     }

saveProduct ( productIds,
store = null 
)

Save Catalog Product(s) Flat data

Parameters:
int|array $productIds
int $store
Returns:
Mage_Catalog_Model_Product_Flat_Indexer

Definition at line 195 of file Indexer.php.

00196     {
00197         if (is_null($store)) {
00198             foreach (Mage::app()->getStores() as $store) {
00199                 $this->saveProduct($productIds, $store->getId());
00200             }
00201             return $this;
00202         }
00203 
00204         $this->_getResource()->removeProduct($productIds, $store);
00205         $this->_getResource()->saveProduct($productIds, $store);
00206         $this->_getResource()->updateRelationProducts($store, $productIds);
00207 
00208         return $this;
00209     }

updateAttribute ( attributeCode,
store = null 
)

Update attribute data for flat table

Parameters:
string $attributeCode
int $store
Returns:
Mage_Catalog_Model_Product_Flat_Indexer

Definition at line 75 of file Indexer.php.

00076     {
00077         if (is_null($store)) {
00078             foreach (Mage::app()->getStores() as $store) {
00079                 $this->updateAttribute($attributeCode, $store->getId());
00080             }
00081 
00082             return $this;
00083         }
00084 
00085         $this->_getResource()->prepareFlatTable($store);
00086         $attribute = $this->_getResource()->getAttribute($attributeCode);
00087         $this->_getResource()->updateAttribute($attribute, $store);
00088         $this->_getResource()->updateChildrenDataFromParent($store);
00089 
00090         return $this;
00091     }

updateEventAttributes ( store = null  ) 

Update events observer attributes

Parameters:
int $store
Returns:
Mage_Catalog_Model_Product_Flat_Indexer

Definition at line 120 of file Indexer.php.

00121     {
00122         if (is_null($store)) {
00123             foreach (Mage::app()->getStores() as $store) {
00124                 $this->updateEventAttributes($store->getId());
00125             }
00126 
00127             return $this;
00128         }
00129 
00130         $this->_getResource()->prepareFlatTable($store);
00131         $this->_getResource()->updateEventAttributes($store);
00132         $this->_getResource()->updateRelationProducts($store);
00133 
00134         return $this;
00135     }

updateProduct ( productIds,
store = null 
)

Update Catalog Product Flat data

Parameters:
int|array $productIds
int $store
Returns:
Mage_Catalog_Model_Product_Flat_Indexer

Definition at line 172 of file Indexer.php.

00173     {
00174         if (is_null($store)) {
00175             foreach (Mage::app()->getStores() as $store) {
00176                 $this->updateProduct($productIds, $store->getId());
00177             }
00178             return $this;
00179         }
00180 
00181         $this->_getResource()->removeProduct($productIds, $store);
00182         $this->_getResource()->updateProduct($productIds, $store);
00183         $this->_getResource()->updateRelationProducts($store, $productIds);
00184 
00185         return $this;
00186     }

updateProductStatus ( productId,
status,
store = null 
)

Update product status

Parameters:
int $productId
int $status
int $store
Returns:
Mage_Catalog_Model_Product_Flat_Indexer

Definition at line 145 of file Indexer.php.

00146     {
00147         if (is_null($store)) {
00148             foreach (Mage::app()->getStores() as $store) {
00149                 $this->updateProductStatus($productId, $status, $store->getId());
00150             }
00151             return $this;
00152         }
00153 
00154         if ($status == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
00155             $this->_getResource()->updateProduct($productId, $store);
00156             $this->_getResource()->updateChildrenDataFromParent($store, $productId);
00157         }
00158         else {
00159             $this->_getResource()->removeProduct($productId, $store);
00160         }
00161 
00162         return $this;
00163     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:40 2009 for Magento by  doxygen 1.5.8