Public Member Functions | |
saveIndex ($data, $storeId, $productId) | |
saveIndices (array $data, $storeId, $productId) | |
cleanup ($productId, $storeId=null, $attributeId=null) | |
loadAttributeCodesByCondition ($conditions) | |
Protected Member Functions | |
_construct () | |
_executeReplace ($data, $storeId, $productId) |
Definition at line 33 of file Abstract.php.
_construct | ( | ) | [protected] |
should be defined because abstract
Reimplemented from Mage_Core_Model_Resource_Abstract.
Reimplemented in Mage_CatalogIndex_Model_Mysql4_Indexer_Eav, Mage_CatalogIndex_Model_Mysql4_Indexer_Minimalprice, and Mage_CatalogIndex_Model_Mysql4_Indexer_Price.
Definition at line 38 of file Abstract.php.
_executeReplace | ( | $ | data, | |
$ | storeId, | |||
$ | productId | |||
) | [protected] |
Definition at line 53 of file Abstract.php.
00054 { 00055 $this->beginTransaction(); 00056 try { 00057 foreach ($data as $row) { 00058 $row[$this->_entityIdFieldName] = $productId; 00059 $this->_getWriteAdapter()->insert($this->getMainTable(), $row); 00060 } 00061 $this->commit(); 00062 } catch (Exception $e) { 00063 $this->rollBack(); 00064 throw $e; 00065 } 00066 00067 return $this; 00068 }
cleanup | ( | $ | productId, | |
$ | storeId = null , |
|||
$ | attributeId = null | |||
) |
Reimplemented in Mage_CatalogIndex_Model_Mysql4_Indexer_Minimalprice.
Definition at line 70 of file Abstract.php.
00071 { 00072 $conditions[] = $this->_getWriteAdapter()->quoteInto("{$this->_entityIdFieldName} = ?", $productId); 00073 00074 if (!is_null($storeId)) 00075 $conditions[] = $this->_getWriteAdapter()->quoteInto("{$this->_storeIdFieldName} = ?", $storeId); 00076 00077 if (!is_null($attributeId)) 00078 $conditions[] = $this->_getWriteAdapter()->quoteInto("{$this->_attributeIdFieldName} = ?", $attributeId); 00079 00080 $conditions = implode (' AND ', $conditions); 00081 $this->_getWriteAdapter()->delete($this->getMainTable(), $conditions); 00082 }
loadAttributeCodesByCondition | ( | $ | conditions | ) |
Definition at line 84 of file Abstract.php.
00085 { 00086 $table = $this->getTable('eav/attribute'); 00087 $select = $this->_getReadAdapter()->select(); 00088 $select->from($table, 'attribute_id'); 00089 $select->distinct(true); 00090 00091 if (is_array($conditions)) { 00092 foreach ($conditions as $k=>$condition) { 00093 if (is_array($condition)) { 00094 if ($k == 'or') { 00095 $function = 'where'; 00096 foreach ($condition as $field=>$value) { 00097 if (is_array($value)) 00098 $select->$function("{$field} in (?)", $value); 00099 else 00100 $select->$function("{$field} = ?", $value); 00101 00102 $function = 'orWhere'; 00103 } 00104 } else { 00105 $select->where("{$k} in (?)", $condition); 00106 } 00107 } else { 00108 $select->where("{$k} = ?", $condition); 00109 } 00110 } 00111 } else { 00112 $select->where($conditions); 00113 } 00114 00115 return $this->_getReadAdapter()->fetchCol($select); 00116 }
saveIndex | ( | $ | data, | |
$ | storeId, | |||
$ | productId | |||
) |
Definition at line 43 of file Abstract.php.
00044 { 00045 return $this->saveIndices(array($data), $storeId, $productId); 00046 }
saveIndices | ( | array $ | data, | |
$ | storeId, | |||
$ | productId | |||
) |
Definition at line 48 of file Abstract.php.
00049 { 00050 $this->_executeReplace($data, $storeId, $productId); 00051 }