00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_Adminhtml_Catalog_Product_GroupController extends Mage_Adminhtml_Controller_Action
00036 {
00037 public function saveAction()
00038 {
00039 $model = Mage::getModel('eav/entity_attribute_group');
00040
00041 $model->setAttributeGroupName($this->getRequest()->getParam('attribute_group_name'))
00042 ->setAttributeSetId($this->getRequest()->getParam('attribute_set_id'));
00043
00044 if( $model->itemExists() ) {
00045 Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Error while saving this group. Group with the same name already exists.'));
00046 } else {
00047 try {
00048 $model->save();
00049 } catch (Exception $e) {
00050 Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Error while saving this group. Please try again later.'));
00051 }
00052 }
00053 }
00054
00055 protected function _isAllowed()
00056 {
00057 return Mage::getSingleton('admin/session')->isAllowed('catalog/products');
00058 }
00059 }