I know that it is not safe to modify the core, so i want to extend a class. My need is to add a new button. In the image below you can see where:
So, I created a module for that. I think the idea is that my module is triggered when I clicked on a attribute set. I have absoluty no idea how to do that. I tried smth like this: config.xml content:
<?xml version="1.0"?>
<config>
<modules>
<Netgr_Gradd>
<version>1.0.0</version>
</Netgr_Gradd>
</modules>
<global>
<blocks>
<netgr_gradd>
<class>Netgr_Gradd_Block</class>
</netgr_gradd>
<adminhtml>
<rewrite>
<catalog_product_attribute_set_main>Netgr_Gradd_Block_Adminhtml_Addgroup</catalog_product_attribute_set_main>
</rewrite>
</adminhtml>
</blocks>
</global>
</config>
After in controllers/AddgroupController.php content is :
<?php
class Netgr_Gradd_Adminhtml_AddgroupController extends Mage_Adminhtml_Controller_Action
{
public function indexAction(){
echo 11111;
}
}
Here I tried to extend from the core class, the function that adds a new button, but with no result. Can anyone help me with this ?
The content of adminthml.xml is:
<?xml version="1.0"?>
<config>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<netgr_gradd before ="Mage_Adminhtml">Netgr_Gradd_Adminhtml</netgr_gradd>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
and this is the content from Block/Adminhtml/Addgroup.php:
class Netgr_Gradd_Block_Adminhtml_Addgroup extends Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main
{
public function __construct() {
parent::_prepareLayout();
$this->_addButton('button_id', array(
'label' => Mage::helper('xxx')->__('Some action'),
'onclick' => 'jsfunction(this.id)',
'class' => 'go'
), 0, 100, 'header', 'header');
}
}