Mage_Tax_Model_Class_Source_Product Class Reference

Inheritance diagram for Mage_Tax_Model_Class_Source_Product:

Mage_Eav_Model_Entity_Attribute_Source_Abstract Mage_Eav_Model_Entity_Attribute_Source_Interface

List of all members.

Public Member Functions

 getAllOptions ($withEmpty=false)
 getOptionText ($value)
 toOptionArray ()
 getFlatColums ()
 getFlatUpdateSelect ($store)


Detailed Description

Definition at line 28 of file Product.php.


Member Function Documentation

getAllOptions ( withEmpty = false  ) 

Definition at line 30 of file Product.php.

00031     {
00032         if (is_null($this->_options)) {
00033             $this->_options = Mage::getResourceModel('tax/class_collection')
00034                 ->addFieldToFilter('class_type', 'PRODUCT')
00035                 ->load()
00036                 ->toOptionArray();
00037         }
00038 
00039         $options = $this->_options;
00040         array_unshift($options, array('value'=>'0', 'label'=>Mage::helper('tax')->__('None')));
00041         if ($withEmpty) {
00042             array_unshift($options, array('value'=>'', 'label'=>Mage::helper('tax')->__('-- Please Select --')));
00043         }
00044         return $options;
00045     }

getFlatColums (  ) 

Get Column(s) names for flat data building

Returns:
array

Reimplemented from Mage_Eav_Model_Entity_Attribute_Source_Abstract.

Definition at line 75 of file Product.php.

00076     {
00077         $columns = array();
00078         $columns[$this->getAttribute()->getAttributeCode()] = array(
00079             'type'      => 'int',
00080             'unsigned'  => false,
00081             'is_null'   => true,
00082             'default'   => null,
00083             'extra'     => null
00084         );
00085         return $columns;
00086    }

getFlatUpdateSelect ( store  ) 

Retrieve Select for update Attribute value in flat table

Parameters:
int $store
Returns:
Varien_Db_Select|null

Reimplemented from Mage_Eav_Model_Entity_Attribute_Source_Abstract.

Definition at line 94 of file Product.php.

00095     {
00096         return Mage::getResourceModel('eav/entity_attribute_option')
00097             ->getFlatUpdateSelect($this->getAttribute(), $store, false);
00098     }

getOptionText ( value  ) 

Get a text for option value

Parameters:
string|integer $value
Returns:
string

Reimplemented from Mage_Eav_Model_Entity_Attribute_Source_Abstract.

Definition at line 53 of file Product.php.

00054     {
00055         $options = $this->getAllOptions(false);
00056 
00057         foreach ($options as $item) {
00058             if ($item['value'] == $value) {
00059                 return $item['label'];
00060             }
00061         }
00062         return false;
00063     }

toOptionArray (  ) 

Definition at line 65 of file Product.php.

00066     {
00067         return $this->getAllOptions();
00068     }


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

Generated on Sat Jul 4 17:24:54 2009 for Magento by  doxygen 1.5.8