Thursday, September 24, 2015

Add custom block to new creditmemo in admin

Here is a block class which adds a new test row to create new credit memo screen in Magento 1.6.

It is important to use
            $this->getParentBlock()
instead of just
            $this



class Gogi_Cmsubtotals_Block_Cmsubtotal extends Mage_Sales_Block_Order_Totals
{
    protected $_code = 'credit';

    public function initTotals()
    {

        parent::initTotals();
     


       
            $this->getParentBlock()->addTotal(
                new Varien_Object(
                    array(
                        'code' => "cmsubtotal",
                        'value' => 14,
                        'base_value' => 14,
                        'label' => "CM SUBTOTAL",
                    )
                ));
       
        return $this;
    }

 

}

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...