Public Member Functions | |
processAfterSave (Mage_Catalog_Model_Product $object, $forceId=null) | |
saveIndex ($data, $storeId, $productId) | |
saveIndices (array $data, $storeId, $productId) | |
isAttributeIndexable (Mage_Eav_Model_Entity_Attribute_Abstract $attribute) | |
getIndexableAttributeCodes () | |
cleanup ($productId, $storeId=null) | |
isAttributeIdUsed () | |
Protected Member Functions | |
_isObjectIndexable (Mage_Catalog_Model_Product $object) | |
_isAttributeIndexable (Mage_Eav_Model_Entity_Attribute_Abstract $attribute) | |
_getIndexableAttributeConditions () | |
Protected Attributes | |
$_processChildren = true | |
$_processChildrenForConfigurable = true | |
$_runOnce = false |
Definition at line 33 of file Abstract.php.
_getIndexableAttributeConditions | ( | ) | [protected] |
Reimplemented in Mage_CatalogIndex_Model_Indexer_Eav, Mage_CatalogIndex_Model_Indexer_Price, and Mage_CatalogIndex_Model_Indexer_Tierprice.
Definition at line 138 of file Abstract.php.
00139 { 00140 return array(); 00141 }
_isAttributeIndexable | ( | Mage_Eav_Model_Entity_Attribute_Abstract $ | attribute | ) | [protected] |
Reimplemented in Mage_CatalogIndex_Model_Indexer_Eav, Mage_CatalogIndex_Model_Indexer_Minimalprice, Mage_CatalogIndex_Model_Indexer_Price, and Mage_CatalogIndex_Model_Indexer_Tierprice.
Definition at line 128 of file Abstract.php.
_isObjectIndexable | ( | Mage_Catalog_Model_Product $ | object | ) | [protected] |
Definition at line 109 of file Abstract.php.
00110 { 00111 if ($object->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) { 00112 return false; 00113 } 00114 00115 if ($object->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG && 00116 $object->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) { 00117 return false; 00118 } 00119 00120 return true; 00121 }
cleanup | ( | $ | productId, | |
$ | storeId = null | |||
) |
Definition at line 143 of file Abstract.php.
00144 { 00145 $this->_getResource()->cleanup($productId, $storeId); 00146 }
getIndexableAttributeCodes | ( | ) |
Definition at line 133 of file Abstract.php.
00134 { 00135 return $this->_getResource()->loadAttributeCodesByCondition($this->_getIndexableAttributeConditions()); 00136 }
isAttributeIdUsed | ( | ) |
Reimplemented in Mage_CatalogIndex_Model_Indexer_Minimalprice.
Definition at line 148 of file Abstract.php.
isAttributeIndexable | ( | Mage_Eav_Model_Entity_Attribute_Abstract $ | attribute | ) |
Definition at line 123 of file Abstract.php.
00124 { 00125 return $this->_isAttributeIndexable($attribute); 00126 }
processAfterSave | ( | Mage_Catalog_Model_Product $ | object, | |
$ | forceId = null | |||
) |
Definition at line 41 of file Abstract.php.
00042 { 00043 $associated = array(); 00044 switch ($object->getTypeId()) { 00045 case Mage_Catalog_Model_Product_Type::TYPE_GROUPED: 00046 $associated = $object->getTypeInstance(true)->getAssociatedProducts($object); 00047 break; 00048 00049 case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE: 00050 $associated = $object->getTypeInstance(true)->getUsedProducts(null, $object); 00051 break; 00052 } 00053 00054 if (!$this->_isObjectIndexable($object) && is_null($forceId)) { 00055 return; 00056 } 00057 00058 $data = array(); 00059 00060 if ($this->_runOnce) { 00061 $data = $this->createIndexData($object); 00062 } else { 00063 $attributes = $object->getAttributes(); 00064 foreach ($attributes as $attribute) { 00065 if ($this->_isAttributeIndexable($attribute) && $object->getData($attribute->getAttributeCode()) != null) { 00066 $row = $this->createIndexData($object, $attribute); 00067 if ($row && is_array($row)) { 00068 if (isset($row[0]) && is_array($row[0])) { 00069 $data = array_merge($data, $row); 00070 } else { 00071 $data[] = $row; 00072 } 00073 } 00074 } 00075 } 00076 } 00077 $function = 'saveIndex'; 00078 if ($data && is_array($data)) { 00079 if (isset($data[0]) && is_array($data[0])) 00080 $function = 'saveIndices'; 00081 00082 $this->$function($data, $object->getStoreId(), ($forceId != null ? $forceId : $object->getId())); 00083 } 00084 00085 if (!$this->_processChildrenForConfigurable && $object->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) 00086 return; 00087 00088 if ($associated && $this->_processChildren) { 00089 00090 foreach ($associated as $child) { 00091 $child 00092 ->setStoreId($object->getStoreId()) 00093 ->setWebsiteId($object->getWebsiteId()); 00094 $this->processAfterSave($child, $object->getId()); 00095 } 00096 } 00097 }
saveIndex | ( | $ | data, | |
$ | storeId, | |||
$ | productId | |||
) |
Definition at line 99 of file Abstract.php.
00100 { 00101 $this->_getResource()->saveIndex($data, $storeId, $productId); 00102 }
saveIndices | ( | array $ | data, | |
$ | storeId, | |||
$ | productId | |||
) |
Definition at line 104 of file Abstract.php.
00105 { 00106 $this->_getResource()->saveIndices($data, $storeId, $productId); 00107 }
$_processChildren = true [protected] |
Reimplemented in Mage_CatalogIndex_Model_Indexer_Minimalprice, and Mage_CatalogIndex_Model_Indexer_Tierprice.
Definition at line 37 of file Abstract.php.
$_processChildrenForConfigurable = true [protected] |
$_runOnce = false [protected] |
Reimplemented in Mage_CatalogIndex_Model_Indexer_Minimalprice.
Definition at line 39 of file Abstract.php.