3

I want to add a custom column in the product table that is displayed while placing order from magento admin panel .

I want something similar as shown in image

A help will be appreciated

3
  • You need to override the admin grid controller for product Apr 20 '15 at 10:10
  • This table has js code that works with it - column count and their order matter there. If you add a column you will have to override a lot of core functionality Apr 20 '15 at 13:32
  • Are you attempting to DISPLAY a field / attribute that already exists for Products in Magento or are you trying to ADD a field that DOESN'T exist and then DISPLAY it here on the on the Sales > Order > Create New Order Admin View Apr 24 '15 at 2:30
3

Make a field in database table "sales_flat_order_item" like "statetax" enter image description here

In your module config file. add this code

<events>
        <checkout_submit_all_after>
            <observers>
                <test_taxgenerate_model_observer>
                    <type>singleton</type>
                    <class>Test_Taxgenerate_Model_Observer</class>
                    <method>setorderstatetax</method>
                </test_taxgenerate_model_observer>
            </observers>
        </checkout_submit_all_after>
    </events>

And make observer file.

class Test_Taxgenerate_Model_Observer extends Varien_Object{
public function setorderstatetax(Varien_Event_Observer $observer)
{
    $quote = $observer->getEvent()->getQuote();
    $i=0;
    foreach ($quote->getAllVisibleItems() as $quoteitem) {
       $quotetax[$i]['statetax'] = $quoteitem->getStatetax();
       $i++;
    }
    $order = $observer->getEvent()->getOrder();
    $j=0;
    foreach($order->getAllVisibleItems() as $item){
        $item->setStatetax($quotetax[$j]['statetax']);
        $item->save();
        $j++;
    }
}

}

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.