0

enter image description herein the magento admin panel, if we go for Orders section

and if we click on one order, we can see the Product name and sku at the bottom.

i want to add 2 more attributes to the order section.

please help me to find solution.

thanks in advance.

3 Answers 3

5

You didn't specify the Magento version but here is the solution for CE 1.8.1.0 (might also work for others):

The product name and SKU are output in app/design/adminhtml/default/default/template/sales/items/column/name.phtml. You will find a variable $_item which is an object of the class Mage_Sales_Model_Order_Item.

If you want to output data which is saved in the order item, you can directly use the order item:

<?php echo $this->escapeHtml($_item->getSomeValue()) ?>

If you need data which is only saved in the product itself, you can get the product and echo its value:

<?php echo $_item->getProduct()->getDescription(); ?>

Be aware that the same template is used for other pages like the invoice, shipment page and so on and there may be different templates for other product types.

5
  • thanks a lot, i only posted question.... i got the solution.... you are a life saver.... Feb 14, 2015 at 15:37
  • I follwed your solution, it's worked in one site, when i tried same solution in another site, it's strange that it's not working in another site. both site are 1.9 version.... any idea why it's not working in another site? Feb 16, 2015 at 5:40
  • 1
    If it's working on one site and not on the other my first suspicion would be that some site-specific extension / adjustment either changes the behaviour or the template of this grid. You could check if your template file is really used at this position and which data the order item / product contains. You can also check if you find out more by debugging the store. If you don't find the reason you could post that as a new question given you have some information to work with for the users here. Feb 16, 2015 at 7:50
  • hi, it's really strange, but i edited here too : app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml file. than i got result.... thanks a lot again.... Feb 17, 2015 at 4:59
  • please help me to display on invoice page.... Mar 16, 2015 at 13:25
1

you need to adjust app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml This is the table you are looking for. Add what ever you want to add here :)

2
  • hi, you are right.... i did it.... Feb 17, 2015 at 5:09
  • please help me to display on invoice page.... Mar 16, 2015 at 13:25
-1

This works great. However if the product is variable it will not work. I Need a barcode "EAN" to be displayed as attribute. It works as single products but show empty as variable.

<?php echo $_item->getProduct()->getEan(); ?>

How to solve that?

1
  • if you post new question with these details, you may get solution soon..... Apr 3, 2017 at 11:00

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.