Advertisement
Guest User

Untitled

a guest
Aug 30th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. /**
  2. * Retrieve flat column definition
  3. *
  4. * @return array
  5. */
  6. public function getFlatColums()
  7. {
  8. $attributeCode = $this->getAttribute()->getAttributeCode();
  9. $column = array(
  10. 'unsigned' => false,
  11. 'default' => null,
  12. 'extra' => null
  13. );
  14.  
  15. if (Mage::helper('core')->useDbCompatibleMode()) {
  16. $column['type'] = 'tinyint(1)';
  17. $column['is_null'] = true;
  18. } else {
  19. $column['type'] = Varien_Db_Ddl_Table::TYPE_SMALLINT;
  20. $column['length'] = 1;
  21. $column['nullable'] = true;
  22. $column['comment'] = $attributeCode . ' column';
  23. }
  24.  
  25. return array($attributeCode => $column);
  26. }
  27.  
  28. /**
  29. * Retrieve Indexes(s) for Flat
  30. *
  31. * @return array
  32. */
  33. public function getFlatIndexes()
  34. {
  35. $indexes = array();
  36.  
  37. $index = 'IDX_' . strtoupper($this->getAttribute()->getAttributeCode());
  38. $indexes[$index] = array(
  39. 'type' => 'index',
  40. 'fields' => array($this->getAttribute()->getAttributeCode())
  41. );
  42.  
  43. return $indexes;
  44. }
  45.  
  46. /**
  47. * Retrieve Select For Flat Attribute update
  48. *
  49. * @param int $store
  50. * @return Varien_Db_Select|null
  51. */
  52. public function getFlatUpdateSelect($store)
  53. {
  54. return Mage::getResourceModel('eav/entity_attribute')
  55. ->getFlatUpdateSelect($this->getAttribute(), $store);
  56. }
  57.  
  58. /**
  59. * Get a text for index option value
  60. *
  61. * @param string|int $value
  62. * @return string|bool
  63. */
  64. public function getIndexOptionText($value)
  65. {
  66. switch ($value) {
  67. case self::VALUE_YES:
  68. return 'Yes';
  69. case self::VALUE_NO:
  70. return 'No';
  71. }
  72.  
  73. return parent::getIndexOptionText($value);
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement