Mage_GoogleBase_Model_Attribute Class Reference

Inheritance diagram for Mage_GoogleBase_Model_Attribute:

Mage_Core_Model_Abstract Varien_Object

List of all members.

Public Member Functions

 getAllowedAttributes ($setId)
 getGbaseAttributeType ($attribute)

Protected Member Functions

 _construct ()
 _isAllowedAttribute ($attribute)

Protected Attributes

 $_ignoredAttributeCodes
 $_ignoredAttributeTypes = array('hidden', 'media_image', 'image', 'gallery')


Detailed Description

Definition at line 34 of file Attribute.php.


Member Function Documentation

_construct (  )  [protected]

Enter description here...

Reimplemented from Varien_Object.

Definition at line 54 of file Attribute.php.

00055     {
00056         $this->_init('googlebase/attribute');
00057     }

_isAllowedAttribute ( attribute  )  [protected]

Check if attribute allowed

Parameters:
Mage_Eav_Model_Entity_Attribute_Abstract $attribute
array $attributes
Returns:
boolean

Definition at line 88 of file Attribute.php.

00089     {
00090         return !in_array($attribute->getFrontendInput(), $this->_ignoredAttributeTypes)
00091                && !in_array($attribute->getAttributeCode(), $this->_ignoredAttributeCodes)
00092                && $attribute->getFrontendLabel() != "";
00093     }

getAllowedAttributes ( setId  ) 

Definition at line 59 of file Attribute.php.

00060     {
00061         $attributes = Mage::getModel('catalog/product')->getResource()
00062                 ->loadAllAttributes()
00063                 ->getSortedAttributes($setId);
00064 
00065         $result = array();
00066         foreach ($attributes as $attribute) {
00067             /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
00068             if ($attribute->isInSet($setId) && $this->_isAllowedAttribute($attribute)) {
00069                 $list[$attribute->getAttributeId()] = $attribute;
00070                 $titles[$attribute->getAttributeId()] = $attribute->getFrontendLabel();
00071             }
00072         }
00073         asort($titles);
00074         $result = array();
00075         foreach ($titles as $attributeId => $label) {
00076             $result[$attributeId] = $list[$attributeId];
00077         }
00078         return $result;
00079     }

getGbaseAttributeType ( attribute  ) 

Return Google Base Attribute Type By Product Attribute

Parameters:
Mage_Catalog_Model_Resource_Eav_Attribute $attribute
Returns:
string Google Base Attribute Type

Definition at line 101 of file Attribute.php.

00102     {
00103         $typesMapping = array(
00104 //            'date'       => 'dateTime',
00105             'price'      => 'floatUnit',
00106             'decimal'    => 'numberUnit',
00107         );
00108         if (isset($typesMapping[$attribute->getFrontendInput()])) {
00109             return $typesMapping[$attribute->getFrontendInput()];
00110         } elseif (isset($typesMapping[$attribute->getBackendType()])) {
00111             return $typesMapping[$attribute->getBackendType()];
00112         } else {
00113             return Mage_GoogleBase_Model_Service_Item::DEFAULT_ATTRIBUTE_TYPE;
00114         }
00115     }


Member Data Documentation

$_ignoredAttributeCodes [protected]

Initial value:

 array(
        'custom_design','custom_design_from','custom_design_to','custom_layout_update',
        'gift_message_available','news_from_date','news_to_date','options_container',
        'price_view','sku_type'
    )

Definition at line 41 of file Attribute.php.

$_ignoredAttributeTypes = array('hidden', 'media_image', 'image', 'gallery') [protected]

Definition at line 52 of file Attribute.php.


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

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