示例#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;
 }
示例#2
0
 /**
  * Check attribute availability for super product creation
  *
  * @param  Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @return bool
  */
 public function canUseAttribute(Mage_Catalog_Model_Resource_Eav_Attribute $attribute)
 {
     return $attribute->getIsGlobal() == Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL && $attribute->getIsVisible() && $attribute->getIsConfigurable() && $attribute->usesSource() && $attribute->getIsUserDefined();
 }