Exemplo n.º 1
0
 /**
  * Define if attribute should be visible for passed user type
  *
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @param string $userType
  * @return bool
  */
 protected function _isAttributeVisible(Mage_Catalog_Model_Resource_Eav_Attribute $attribute, $userType)
 {
     $isAttributeVisible = false;
     if ($userType == Mage_Api2_Model_Auth_User_Admin::USER_TYPE) {
         $isAttributeVisible = $attribute->getIsVisible();
     } else {
         $systemAttributesForNonAdmin = array('sku', 'name', 'short_description', 'description', 'tier_price', 'meta_title', 'meta_description', 'meta_keyword');
         if ($attribute->getIsUserDefined()) {
             $isAttributeVisible = $attribute->getIsVisibleOnFront();
         } else {
             if (in_array($attribute->getAttributeCode(), $systemAttributesForNonAdmin)) {
                 $isAttributeVisible = true;
             }
         }
     }
     return (bool) $isAttributeVisible;
 }