public function testGetAttributes() { $attributes = $this->_model->getAttributes(); $this->assertArrayHasKey('name', $attributes); $this->assertArrayHasKey('custom_design', $attributes); $attributes = $this->_model->getAttributes(true); $this->assertArrayHasKey('name', $attributes); $this->assertArrayNotHasKey('custom_design', $attributes); }
/** * Catalog category initialize after loading * * @param Mage_Catalog_Model_Category $model * @return void */ public function catalogCategoryLoadAfter($model) { if (!$model->getId()) { return; } if (!$this->_role->hasExclusiveCategoryAccess($model->getPath())) { $model->unlockAttributes(); $attributes = $model->getAttributes(); $hasWebsites = count($this->_role->getWebsiteIds()) > 0; $hasStoreAccess = $this->_role->hasStoreAccess($model->getResource()->getStoreId()); foreach ($attributes as $attribute) { /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */ if ($attribute->isScopeGlobal() || $attribute->isScopeWebsite() && !$hasWebsites || !$hasStoreAccess) { $model->lockAttribute($attribute->getAttributeCode()); } } $model->setProductsReadonly(true); $model->setPermissionsReadonly(true); $model->setOptimizationReadonly(true); $model->setIsDeleteable(false); if (!$this->_role->hasStoreAccess($model->getResource()->getStoreId())) { $model->setIsReadonly(true); } } }