Problem solved but with the help of java-script function.
To add your fields on order view page we need to do :
- Add layout in your config file:
<adminhtml>
<layout>
<updates>
<customattribute>
<file>customattribute.xml</file>
</customattribute>
</updates>
</layout>
</adminhtml>
- Add design layout for adminhtml "app/design/adminhtml/default/default/layout/customattribute.xml"
<layout version="0.1.0">
<adminhtml_sales_order_view>
<reference name="order_items">
<block type="customattribute/prototal" name="order_item_extra_info" template="customattribute/productdesign.phtml"/>
</reference>
</adminhtml_sales_order_view>
</layout>
- Add template File "app/design/adminhtml/default/default/template/customattribute/productdesign.phtml". Please do the format of file placing some sample code.
<?php
$_item = $this->getItem();
$sku = $_item->getSku();
echo '<div style="display:none;" id="id_order_item_'.$_item->getID().'"> <strong>'.$this->helper('sales')->__('Artwork ID').':</strong>'.$_item->getArtworkID().'</div>'; ?>
<script>
function codeAddress<?php echo $_item->getID(); ?>() {
var html = document.getElementById('id_order_item_<?php echo $_item->getID(); ?>').innerHTML;
var elem = document.getElementById('order_item_<?php echo $_item->getID(); ?>').children[0].innerHTML;
document.getElementById('order_item_<?php echo $_item->getID(); ?>').children[0].innerHTML = elem+html;
}
codeAddress<?php echo $_item->getID(); ?>();
</script>
- For getting Item in your template file you need define a block "CustomAttribute/Block/Adminhtml/Prototal.php"
class NameSpace_ModuleName_Block_Prototal extends
Mage_Core_Block_Template
{
public function setItem(Varien_Object $item) {
$this->setData('item', $item);
return $this;
}
public function getItem() {
return $this->_getData('item');
}
}
Please comment someone found any issue or problem.