Public Member Functions | |
setStoreId ($store) | |
getFlatTableName ($store=null) | |
getTypeId () | |
getAttributeForSelect ($attributeCode) | |
getAttributeSortColumn ($attributeCode) | |
getAllTableColumns () | |
isAttributeStatic ($attribute) | |
getEntityIdField () | |
getAttribute ($attribute) | |
Protected Member Functions | |
_construct () | |
Protected Attributes | |
$_storeId |
Definition at line 35 of file Flat.php.
_construct | ( | ) | [protected] |
Init connection and resource table
Reimplemented from Mage_Core_Model_Resource_Abstract.
Definition at line 49 of file Flat.php.
00050 { 00051 $this->_init('catalog/product_flat', 'entity_id'); 00052 $this->_storeId = Mage::app()->getStore()->getId(); 00053 }
getAllTableColumns | ( | ) |
Retrieve Flat Table columns list
Definition at line 137 of file Flat.php.
00138 { 00139 $describe = $this->_getWriteAdapter()->describeTable($this->getFlatTableName()); 00140 return array_keys($describe); 00141 }
getAttribute | ( | $ | attribute | ) |
Retrieve attribute instance Special for non static flat table
mixed | $attribute |
Definition at line 191 of file Flat.php.
00192 { 00193 return Mage::getSingleton('catalog/config') 00194 ->getAttribute('catalog_product', $attribute); 00195 }
getAttributeForSelect | ( | $ | attributeCode | ) |
Retrieve attribute columns for collection select
string | $attributeCode |
Definition at line 99 of file Flat.php.
00100 { 00101 $describe = $this->_getWriteAdapter()->describeTable($this->getFlatTableName()); 00102 if (!isset($describe[$attributeCode])) { 00103 return null; 00104 } 00105 $columns = array($attributeCode => $attributeCode); 00106 00107 if (isset($describe[$attributeCode . '_value'])) { 00108 $columns[$attributeCode . '_value'] = $attributeCode . '_value'; 00109 } 00110 00111 return $columns; 00112 }
getAttributeSortColumn | ( | $ | attributeCode | ) |
Retrieve Attribute Sort column name
string | $attributeCode |
Definition at line 120 of file Flat.php.
00121 { 00122 $describe = $this->_getWriteAdapter()->describeTable($this->getFlatTableName()); 00123 if (!isset($describe[$attributeCode])) { 00124 return null; 00125 } 00126 if (isset($describe[$attributeCode . '_value'])) { 00127 return $attributeCode . '_value'; 00128 } 00129 return $attributeCode; 00130 }
getEntityIdField | ( | ) |
Retrieve entity id field name in entity table Rewrited for EAV collection compatible
Definition at line 179 of file Flat.php.
00180 { 00181 return $this->getIdFieldName(); 00182 }
getFlatTableName | ( | $ | store = null |
) |
getTypeId | ( | ) |
Retrieve entity type id
Definition at line 86 of file Flat.php.
00087 { 00088 return Mage::getSingleton('catalog/config') 00089 ->getEntityType('catalog_product') 00090 ->getEntityTypeId(); 00091 }
isAttributeStatic | ( | $ | attribute | ) |
Check whether the attribute is a real field in entity table Rewrited for EAV Collection
integer|string|Mage_Eav_Model_Entity_Attribute_Abstract | $attribute |
Definition at line 150 of file Flat.php.
00151 { 00152 $attributeCode = null; 00153 if ($attribute instanceof Mage_Eav_Model_Entity_Attribute_Interface) { 00154 $attributeCode = $attribute->getAttributeCode(); 00155 } 00156 elseif (is_string($attribute)) { 00157 $attributeCode = $attribute; 00158 } 00159 elseif (is_numeric($attribute)) { 00160 $attributeCode = $this->getAttribute($attribute) 00161 ->getAttributeCode(); 00162 } 00163 00164 if ($attributeCode) { 00165 $columns = $this->getAllTableColumns(); 00166 if (in_array($attributeCode, $columns)) { 00167 return true; 00168 } 00169 } 00170 00171 return false; 00172 }
setStoreId | ( | $ | store | ) |