0
votes

I am creating a custom module for magento to add a "Sync" button in the admin html orders list . i made a start in creating my module and i will show you my files, i just started with creating modules.

Problem: The button is not showing up anywhere in the adminhtml


app/code/local/Module/Parcel/Block/Adminhtml/Sales/Order/View.php

<?php
class Module_Parcel_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View 
{
    public function  __construct() {

        parent::__construct();

        $this->_addButton('button_id', array(
            'label'     => Mage::helper('xxx')->__('Some action'),
            'onclick'   => 'jsfunction(this.id)',
            'class'     => 'go'
        ), 0, 100, 'header', 'header');
    }
}
?>

app/code/local/Module/Parcel/Etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Module_Parcel>
            <version>0.0.1</version>
        </Module_Parcel>
    </modules>
    <global>
        <blocks>
             <adminhtml>
                <rewrite>
                    <sales_order_view>Module_Parcel_Block_Adminhtml_Sales_Order_View</sales_order_view>
                </rewrite>
            </adminhtml>
        </blocks>
    </global>
</config>  

app/Module_Parcel.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Module_Parcel>
            <active>true</active>
            <codePool>local</codePool>
        </Module_Parcel>
    </modules>
</config>
2

2 Answers

1
votes

_addButton accepts 5 parameters, you pass 6. Try

$this->_addButton('button_id', array(
        'label'     => Mage::helper('adminhtml')->__('Some action'),
        'onclick'   => 'jsfunction(this.id)',
        'class'     => 'go'
    ), 0, 100, 'header');
0
votes

Also your block file name should start with capital letter, app/code/local/Module/Parcel/Block/Adminhtml/Sales/Order/View.php instead of app/code/local/Module/Parcel/Block/Adminhtml/Sales/Order/view.php