Mage_Catalog_Model_Resource_Eav_Attribute Class Reference

Inheritance diagram for Mage_Catalog_Model_Resource_Eav_Attribute:

Mage_Eav_Model_Entity_Attribute Mage_Eav_Model_Entity_Attribute_Abstract Mage_Core_Model_Abstract Mage_Eav_Model_Entity_Attribute_Interface Varien_Object

List of all members.

Public Member Functions

 isScopeGlobal ()
 isScopeWebsite ()
 isScopeStore ()
 getStoreId ()
 getApplyTo ()
 getSourceModel ()
 isAllowedForRuleCondition ()
 getFrontendLabel ()
 _getDefaultSourceModel ()

Static Public Member Functions

static initLabels ($storeId=null)

Public Attributes

const SCOPE_STORE = 0
const SCOPE_GLOBAL = 1
const SCOPE_WEBSITE = 2

Protected Member Functions

 _getLabelForStore ()

Static Protected Attributes

static $_labels = null


Detailed Description

Definition at line 34 of file Attribute.php.


Member Function Documentation

_getDefaultSourceModel (  ) 

Get default attribute source model

Returns:
string

Reimplemented from Mage_Eav_Model_Entity_Attribute.

Definition at line 184 of file Attribute.php.

00185     {
00186         return 'eav/entity_attribute_source_table';
00187     }

_getLabelForStore (  )  [protected]

Get Attribute translated label for store

Deprecated:
Returns:
string

Definition at line 148 of file Attribute.php.

00149     {
00150         return $this->getFrontendLabel();
00151 //        self::initLabels();
00152 //        return isset(self::$_labels[$this->getData('frontend_label')]) ? self::$_labels[$this->getData('frontend_label')] : false;
00153     }

getApplyTo (  ) 

Retrieve apply to products array Return empty array if applied to all products

Returns:
array

Definition at line 96 of file Attribute.php.

00097     {
00098         if ($this->getData('apply_to')) {
00099             return explode(',', $this->getData('apply_to'));
00100         } else {
00101             return array();
00102         }
00103     }

getFrontendLabel (  ) 

Retrieve don't translated frontend label

Returns:
string

Definition at line 137 of file Attribute.php.

00138     {
00139         return $this->_getData('frontend_label');
00140     }

getSourceModel (  ) 

Retrieve source model

Returns:
Mage_Eav_Model_Entity_Attribute_Source_Abstract

Definition at line 110 of file Attribute.php.

00111     {
00112         $model = $this->getData('source_model');
00113         if (empty($model)) {
00114             if ($this->getBackendType() == 'int' && $this->getFrontendInput() == 'select') {
00115                 return 'eav/entity_attribute_source_table';
00116             }
00117         }
00118         return $model;
00119     }

getStoreId (  ) 

Retrieve store id

Returns:
int

Definition at line 82 of file Attribute.php.

00083     {
00084         if ($dataObject = $this->getDataObject()) {
00085             return $dataObject->getStoreId();
00086         }
00087         return $this->getData('store_id');
00088     }

static initLabels ( storeId = null  )  [static]

Initialize store Labels for attributes

Deprecated:
Parameters:
int $storeId

Definition at line 161 of file Attribute.php.

00162     {
00163         if (is_null(self::$_labels)) {
00164             if (is_null($storeId)) {
00165                 $storeId = Mage::app()->getStore()->getId();
00166             }
00167             $attributeLabels = array();
00168             $attributes = Mage::getResourceSingleton('catalog/product')->getAttributesByCode();
00169             foreach ($attributes as $attribute) {
00170                 if (strlen($attribute->getData('frontend_label')) > 0) {
00171                     $attributeLabels[] = $attribute->getData('frontend_label');
00172                 }
00173             }
00174 
00175             self::$_labels = Mage::app()->getTranslator()->getResource()->getTranslationArrayByStrings($attributeLabels, $storeId);
00176         }
00177     }

isAllowedForRuleCondition (  ) 

Check is allow for rule condition

Returns:
bool

Definition at line 126 of file Attribute.php.

00127     {
00128         $allowedInputTypes = array('text', 'multiselect', 'textarea', 'date', 'datetime', 'select', 'boolean', 'price');
00129         return $this->getIsVisible() && in_array($this->getFrontendInput(), $allowedInputTypes);
00130     }

isScopeGlobal (  ) 

Retrieve attribute is global scope flag

Returns:
bool

Definition at line 52 of file Attribute.php.

00053     {
00054         return $this->getIsGlobal() == self::SCOPE_GLOBAL;
00055     }

isScopeStore (  ) 

Retrieve attribute is store scope flag

Returns:
bool

Definition at line 72 of file Attribute.php.

00073     {
00074         return !$this->isScopeGlobal() && !$this->isScopeWebsite();
00075     }

isScopeWebsite (  ) 

Retrieve attribute is website scope website

Returns:
bool

Definition at line 62 of file Attribute.php.

00063     {
00064         return $this->getIsGlobal() == self::SCOPE_WEBSITE;
00065     }


Member Data Documentation

$_labels = null [static, protected]

Definition at line 45 of file Attribute.php.

const SCOPE_GLOBAL = 1

Definition at line 37 of file Attribute.php.

const SCOPE_STORE = 0

Definition at line 36 of file Attribute.php.

const SCOPE_WEBSITE = 2

Definition at line 38 of file Attribute.php.


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

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