0

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 Answers 2

1

_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');
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.