Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Catalog_Model_Entity_Product_Attribute_Design_Options_Container
  • Mage_Catalog_Model_Product_Attribute_Source_Inputtype
  • Mage_Eav_Block_Adminhtml_Attribute_Edit_Js
  • Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
  • Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract
  • Mage_Eav_Helper_Data
  • Mage_Eav_Model_Adminhtml_System_Config_Source_Inputtype
  • Mage_Eav_Model_Adminhtml_System_Config_Source_Inputtype_Validator
  • Mage_Eav_Model_Attribute
  • Mage_Eav_Model_Attribute_Data
  • Mage_Eav_Model_Attribute_Data_Abstract
  • Mage_Eav_Model_Attribute_Data_Boolean
  • Mage_Eav_Model_Attribute_Data_Date
  • Mage_Eav_Model_Attribute_Data_File
  • Mage_Eav_Model_Attribute_Data_Hidden
  • Mage_Eav_Model_Attribute_Data_Image
  • Mage_Eav_Model_Attribute_Data_Multiline
  • Mage_Eav_Model_Attribute_Data_Multiselect
  • Mage_Eav_Model_Attribute_Data_Select
  • Mage_Eav_Model_Attribute_Data_Text
  • Mage_Eav_Model_Attribute_Data_Textarea
  • Mage_Eav_Model_Config
  • Mage_Eav_Model_Convert_Adapter_Entity
  • Mage_Eav_Model_Convert_Adapter_Grid
  • Mage_Eav_Model_Convert_Parser_Abstract
  • Mage_Eav_Model_Entity
  • Mage_Eav_Model_Entity_Abstract
  • Mage_Eav_Model_Entity_Attribute
  • Mage_Eav_Model_Entity_Attribute_Abstract
  • Mage_Eav_Model_Entity_Attribute_Backend_Abstract
  • Mage_Eav_Model_Entity_Attribute_Backend_Array
  • Mage_Eav_Model_Entity_Attribute_Backend_Datetime
  • Mage_Eav_Model_Entity_Attribute_Backend_Default
  • Mage_Eav_Model_Entity_Attribute_Backend_Increment
  • Mage_Eav_Model_Entity_Attribute_Backend_Serialized
  • Mage_Eav_Model_Entity_Attribute_Backend_Store
  • Mage_Eav_Model_Entity_Attribute_Backend_Time_Created
  • Mage_Eav_Model_Entity_Attribute_Backend_Time_Updated
  • Mage_Eav_Model_Entity_Attribute_Frontend_Abstract
  • Mage_Eav_Model_Entity_Attribute_Frontend_Datetime
  • Mage_Eav_Model_Entity_Attribute_Frontend_Default
  • Mage_Eav_Model_Entity_Attribute_Group
  • Mage_Eav_Model_Entity_Attribute_Option
  • Mage_Eav_Model_Entity_Attribute_Set
  • Mage_Eav_Model_Entity_Attribute_Source_Abstract
  • Mage_Eav_Model_Entity_Attribute_Source_Boolean
  • Mage_Eav_Model_Entity_Attribute_Source_Config
  • Mage_Eav_Model_Entity_Attribute_Source_Store
  • Mage_Eav_Model_Entity_Attribute_Source_Table
  • Mage_Eav_Model_Entity_Collection
  • Mage_Eav_Model_Entity_Collection_Abstract
  • Mage_Eav_Model_Entity_Increment_Abstract
  • Mage_Eav_Model_Entity_Increment_Alphanum
  • Mage_Eav_Model_Entity_Increment_Numeric
  • Mage_Eav_Model_Entity_Setup
  • Mage_Eav_Model_Entity_Store
  • Mage_Eav_Model_Entity_Type
  • Mage_Eav_Model_Form
  • Mage_Eav_Model_Form_Element
  • Mage_Eav_Model_Form_Fieldset
  • Mage_Eav_Model_Form_Type
  • Mage_Eav_Model_Mysql4_Config
  • Mage_Eav_Model_Mysql4_Entity_Attribute
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Collection
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Group
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Group_Collection
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Option
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Option_Collection
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Set
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Set_Collection
  • Mage_Eav_Model_Mysql4_Entity_Store
  • Mage_Eav_Model_Mysql4_Entity_Type
  • Mage_Eav_Model_Mysql4_Entity_Type_Collection
  • Mage_Eav_Model_Mysql4_Form_Element
  • Mage_Eav_Model_Mysql4_Form_Element_Collection
  • Mage_Eav_Model_Mysql4_Form_Fieldset
  • Mage_Eav_Model_Mysql4_Form_Fieldset_Collection
  • Mage_Eav_Model_Mysql4_Form_Type
  • Mage_Eav_Model_Mysql4_Form_Type_Collection
  • Mage_Eav_Model_Resource_Attribute
  • Mage_Eav_Model_Resource_Attribute_Collection
  • Mage_Eav_Model_Resource_Config
  • Mage_Eav_Model_Resource_Entity_Attribute
  • Mage_Eav_Model_Resource_Entity_Attribute_Collection
  • Mage_Eav_Model_Resource_Entity_Attribute_Group
  • Mage_Eav_Model_Resource_Entity_Attribute_Group_Collection
  • Mage_Eav_Model_Resource_Entity_Attribute_Option
  • Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection
  • Mage_Eav_Model_Resource_Entity_Attribute_Set
  • Mage_Eav_Model_Resource_Entity_Attribute_Set_Collection
  • Mage_Eav_Model_Resource_Entity_Store
  • Mage_Eav_Model_Resource_Entity_Type
  • Mage_Eav_Model_Resource_Entity_Type_Collection
  • Mage_Eav_Model_Resource_Form_Attribute
  • Mage_Eav_Model_Resource_Form_Attribute_Collection
  • Mage_Eav_Model_Resource_Form_Element
  • Mage_Eav_Model_Resource_Form_Element_Collection
  • Mage_Eav_Model_Resource_Form_Fieldset
  • Mage_Eav_Model_Resource_Form_Fieldset_Collection
  • Mage_Eav_Model_Resource_Form_Type
  • Mage_Eav_Model_Resource_Form_Type_Collection
  • Mage_Eav_Model_Resource_Helper_Mysql4

Interfaces

  • Mage_Eav_Model_Entity_Attribute_Backend_Interface
  • Mage_Eav_Model_Entity_Attribute_Frontend_Interface
  • Mage_Eav_Model_Entity_Attribute_Interface
  • Mage_Eav_Model_Entity_Attribute_Source_Interface
  • Mage_Eav_Model_Entity_Increment_Interface
  • Mage_Eav_Model_Entity_Interface

Exceptions

  • Mage_Eav_Exception
  • Mage_Eav_Model_Entity_Attribute_Exception
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Eav
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: 
 28: /**
 29:  * Entity/Attribute/Model - attribute frontend abstract
 30:  *
 31:  * @category   Mage
 32:  * @package    Mage_Eav
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: abstract class Mage_Eav_Model_Entity_Attribute_Frontend_Abstract
 36:     implements Mage_Eav_Model_Entity_Attribute_Frontend_Interface
 37: {
 38: 
 39:     /**
 40:      * Reference to the attribute instance
 41:      *
 42:      * @var Mage_Eav_Model_Entity_Attribute_Abstract
 43:      */
 44:     protected $_attribute;
 45: 
 46:     /**
 47:      * Set attribute instance
 48:      *
 49:      * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
 50:      * @return Mage_Eav_Model_Entity_Attribute_Frontend_Abstract
 51:      */
 52:     public function setAttribute($attribute)
 53:     {
 54:         $this->_attribute = $attribute;
 55:         return $this;
 56:     }
 57: 
 58:     /**
 59:      * Get attribute instance
 60:      *
 61:      * @return Mage_Eav_Model_Entity_Attribute_Abstract
 62:      */
 63:     public function getAttribute()
 64:     {
 65:         return $this->_attribute;
 66:     }
 67: 
 68:     /**
 69:      * Get attribute type for user interface form
 70:      *
 71:      * @return string
 72:      */
 73:     public function getInputType()
 74:     {
 75:         return $this->getAttribute()->getFrontendInput();
 76:     }
 77: 
 78:     /**
 79:      * Retreive lable
 80:      *
 81:      * @return string
 82:      */
 83:     public function getLabel()
 84:     {
 85:         $label = $this->getAttribute()->getFrontendLabel();
 86:         if (($label === null) || $label == '') {
 87:             $label = $this->getAttribute()->getAttributeCode();
 88:         }
 89: 
 90:         return $label;
 91:     }
 92: 
 93:     /**
 94:      * Retreive attribute value
 95:      *
 96:      * @param $object
 97:      * @return mixed
 98:      */
 99:     public function getValue(Varien_Object $object)
100:     {
101:         $value = $object->getData($this->getAttribute()->getAttributeCode());
102:         if (in_array($this->getConfigField('input'), array('select','boolean'))) {
103:             $valueOption = $this->getOption($value);
104:             if (!$valueOption) {
105:                 $opt     = Mage::getModel('eav/entity_attribute_source_boolean');
106:                 $options = $opt->getAllOptions();
107:                 if ($options) {
108:                     foreach ($options as $option) {
109:                         if ($option['value'] == $value) {
110:                             $valueOption = $option['label'];
111:                         }
112:                     }
113:                 }
114:             }
115:             $value = $valueOption;
116:         } elseif ($this->getConfigField('input') == 'multiselect') {
117:             $value = $this->getOption($value);
118:             if (is_array($value)) {
119:                 $value = implode(', ', $value);
120:             }
121:         }
122: 
123:         return $value;
124:     }
125: 
126:     /**
127:      * Checks if attribute is visible on frontend
128:      *
129:      * @return boolean
130:      */
131:     public function isVisible()
132:     {
133:         return $this->getConfigField('frontend_visible');
134:     }
135: 
136:     /**
137:      * Retrieve frontend class
138:      *
139:      * @return string
140:      */
141:     public function getClass()
142:     {
143:         $out    = array();
144:         $out[]  = $this->getAttribute()->getFrontendClass();
145:         if ($this->getAttribute()->getIsRequired()) {
146:             $out[]  = 'required-entry';
147:         }
148: 
149:         $inputRuleClass = $this->_getInputValidateClass();
150:         if ($inputRuleClass) {
151:              $out[] = $inputRuleClass;
152:         }
153:         if (!empty($out)) {
154:             $out = implode(' ', $out);
155:         } else {
156:             $out = '';
157:         }
158:         return $out;
159:     }
160: 
161:      /**
162:      * Return validate class by attribute input validation rule
163:      *
164:      * @return string|false
165:      */
166:     protected function _getInputValidateClass()
167:     {
168:         $class          = false;
169:         $validateRules  = $this->getAttribute()->getValidateRules();
170:         if (!empty($validateRules['input_validation'])) {
171:             switch ($validateRules['input_validation']) {
172:                 case 'alphanumeric':
173:                     $class = 'validate-alphanum';
174:                     break;
175:                 case 'numeric':
176:                     $class = 'validate-digits';
177:                     break;
178:                 case 'alpha':
179:                     $class = 'validate-alpha';
180:                     break;
181:                 case 'email':
182:                     $class = 'validate-email';
183:                     break;
184:                 case 'url':
185:                     $class = 'validate-url';
186:                     break;
187:                 default:
188:                     $class = false;
189:                     break;
190:             }
191:         }
192:         return $class;
193:     }
194: 
195:     /**
196:      * Reireive config field
197:      *
198:      * @param string $fieldName
199:      * @return mixed
200:      */
201:     public function getConfigField($fieldName)
202:     {
203:         return $this->getAttribute()->getData('frontend_' . $fieldName);
204:     }
205: 
206:     /**
207:      * Get select options in case it's select box and options source is defined
208:      *
209:      * @return array
210:      */
211:     public function getSelectOptions()
212:     {
213:         return $this->getAttribute()->getSource()->getAllOptions();
214:     }
215: 
216:     /**
217:      * Retreive option by option id
218:      *
219:      * @param int $optionId
220:      * @return mixed|boolean
221:      */
222:     public function getOption($optionId)
223:     {
224:         $source = $this->getAttribute()->getSource();
225:         if ($source) {
226:             return $source->getOptionText($optionId);
227:         }
228:         return false;
229:     }
230: 
231:     /**
232:      * Retrieve Input Renderer Class
233:      *
234:      * @return string
235:      */
236:     public function getInputRendererClass() {
237:         $className = $this->getAttribute()->getData('frontend_input_renderer');
238:         if ($className) {
239:             return Mage::getConfig()->getBlockClassName($className);
240:         }
241:         return null;
242:     }
243: }
244: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0