2

I am a newbie in Magento development.

Do you know how to add a new row to totals in admin order view to show the resulting computation of subtotal + shipping?

I create path folder with Sketchkode/Totalgst/etc/config.xml

<config>
   <global>
      <blocks>
        <adminhtml>
        <rewrite>
             <sales_order_totals>Sketchkode_Totalgst_Block_Adminhtml_Sales_Order_Totals</sales_order_totals>
      </rewrite>
      </adminhtml>
   </blocks>
</global>

After I create Based on config Sketchkode/Totalgst/Block/Adminhtml/Sales/Order/Totals.php

<?php
  class Sketchkode_Totalgst_Block_Adminhtml_Sales_Order_Totals extends Mage_Adminhtml_Block_Sales_Order_Totals{
     /**
     * Initialize order totals array
     *
     * @return Mage_Sales_Block_Order_Totals
      */
     protected function _initTotals()
     {

      parent::_initTotals();
       $order_id=$this->getOrder()->getId(); 


     $amount=5; 

    if ($amount) {
        $this->addTotalBefore(new Varien_Object(array(
            'code'      => 'fee',
            'value'     => $amount,
            'base_value'=> $amount,
            'label'     => $this->helper('sales')->__('Fee'),
        ), array('shipping', 'tax')));
 }

    return $this;
   }
}

I get blank Order Totals

enter image description here

0

There were be three possible problem of That

  1. You missed spelled the directory name
  2. cache problem (delete the cache)
  3. 'code' => 'fee', your code is already used by other ext so changes it something unique code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.