Oh snap! You are using an old version of browser. Update your browser to get new awesome features. Click for more details.

Magento Add new column in Sales Order View Items in Admin


Hi Friend's :)

how to add column in Sales Order View Items part For More details, Please Refer  to Screenshot and see the new column highlighted in Red. Please feel free to get in touch

Step : 1

open file app/design/adminhtml/default/default/template/sales/order/view/items.phtml for adding the table header

another replace this. 

<?php $_order = $this->getOrder() ?>
<div class="grid np">
  <div class="hor-scroll">
    <table cellspacing="0" class="data order-tables">
        <col />
        <col width="1" />
        <col width="1" />
        <col width="1" />
        <col width="1" />
        <col width="1" />
        <col width="1" />
        <col width="1" />
        <col width="1" />
        <col width="1" />
        <col width="1" />
        <thead>
            <tr class="headings">
                <th><?php echo $this->helper('sales')->__('Product') ?></th>
                <th><span class="nobr"><?php echo $this->helper('sales')->__('Sku') ?></span></th>
                <th><span class="nobr"><?php echo $this->helper('sales')->__('Item Status') ?></span></th>
                <th><span class="nobr"><?php echo $this->helper('sales')->__('Original Price') ?></span></th>
                <th><?php echo $this->helper('sales')->__('Price') ?></th>
                <th class="a-center"><?php echo $this->helper('sales')->__('Qty') ?></th>
                <th><?php echo $this->helper('sales')->__('Subtotal') ?></th>
                <th><span class="nobr"><?php echo $this->helper('sales')->__('Tax Amount') ?></span></th>
                <th><span class="nobr"><?php echo $this->helper('sales')->__('Tax Percent') ?></span></th>
                <th><span class="nobr"><?php echo $this->helper('sales')->__('Discount Amount') ?></span></th>
                <th class="last"><span class="nobr"><?php echo $this->helper('sales')->__('Row Total') ?></span></th>
            </tr>
        </thead>
        <?php $_items = $this->getItemsCollection() ?>
        <?php $i=0;foreach ($_items as $_item):?>
            <?php if ($_item->getParentItem()) continue; else $i++;?>
            <tbody class="<?php echo $i%2?'even':'odd' ?>">
                <?php echo $this->getItemHtml($_item) ?>
                <?php echo $this->getItemExtraInfoHtml($_item) ?>
            </tbody>
        <?php endforeach; ?>
    </table>
  </div>
</div>
<br />

Step : 2
open file app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml for filling the column with data.

another replace this.

<?php $_item = $this->getItem() ?>
<?php $this->setPriceDataObject($_item) ?>
<tr<?php if (!$this->canDisplayGiftmessage()): ?> class="border"<?php endif; ?>>
    <td>
        <?php if ($this->canDisplayContainer()): ?>
        <div id="<?php echo $this->getHtmlId() ?>" class="item-container">
        <?php endif; ?>
        <div class="item-text">
            <?php echo $this->getColumnHtml($_item, 'name') ?>
        </div>
        <?php if ($this->canDisplayContainer()): ?>
        </div>
        <?php endif ?>
    </td>
    <td class="a-center"><?php echo $_item->getSku() ?></td>
    <td class="a-center"><?php echo $_item->getStatus() ?></td>
    <td class="a-right"><?php echo $this->displayPriceAttribute('original_price') ?></td>
    <td class="a-right">
        <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
            <span class="price-excl-tax">
                <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
                    <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
                <?php endif; ?>

                <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
                    <?php
                    echo $this->displayPrices(
                        $_item->getBasePrice()+$_item->getBaseWeeeTaxAppliedAmount()+$_item->getBaseWeeeTaxDisposition(),
                        $_item->getPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()
                    );
                    ?>
                <?php else: ?>
                    <?php echo $this->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
                <?php endif; ?>


                <?php if (Mage::helper('weee')->getApplied($_item)): ?>
                    <br />
                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></small></span>
                        <?php endforeach; ?>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php endif; ?>

                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <br />
                        <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br />
                        <?php
                        echo $this->displayPrices(
                            $_item->getBasePrice()+$_item->getBaseWeeeTaxAppliedAmount()+$_item->getBaseWeeeTaxDisposition(),
                            $_item->getPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()
                        );
                        ?>
                        </span>
                    <?php endif; ?>
                <?php endif; ?>
            </span>
            <br />
        <?php endif; ?>
        <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
            <span class="price-incl-tax">
                <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
                    <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
                <?php endif; ?>
                <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
                <?php $_baseIncl = $this->helper('checkout')->getBasePriceInclTax($_item); ?>

                <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
                    <?php echo $this->displayPrices($_baseIncl+$_item->getBaseWeeeTaxAppliedAmount(), $_incl+$_item->getWeeeTaxAppliedAmount()); ?>
                <?php else: ?>
                    <?php echo $this->displayPrices($_baseIncl-$_item->getBaseWeeeTaxDisposition(), $_incl-$_item->getWeeeTaxDisposition()) ?>
                <?php endif; ?>

                <?php if (Mage::helper('weee')->getApplied($_item)): ?>
                    <br />
                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></small></span>
                        <?php endforeach; ?>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php endif; ?>

                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <br />
                        <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->displayPrices($_baseIncl+$_item->getBaseWeeeTaxAppliedAmount(), $_incl+$_item->getWeeeTaxAppliedAmount()); ?></span>
                    <?php endif; ?>
                <?php endif; ?>
            </span>
        <?php endif; ?>

    </td>
    <td><?php echo $this->getColumnHtml($_item, 'qty') ?></td>

    <td class="a-right">
        <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
            <span class="price-excl-tax">
                <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
                    <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
                <?php endif; ?>

                <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
                    <?php
                    echo $this->displayPrices(
                        $_item->getBaseRowTotal()+$_item->getBaseWeeeTaxAppliedRowAmount()+$_item->getBaseWeeeTaxRowDisposition(),
                        $_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()
                    );
                    ?>
                <?php else: ?>
                    <?php echo $this->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
                <?php endif; ?>


                <?php if (Mage::helper('weee')->getApplied($_item)): ?>
                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></small></span>
                        <?php endforeach; ?>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php endif; ?>

                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <br />
                        <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br />
                        <?php
                        echo $this->displayPrices(
                            $_item->getBaseRowTotal()+$_item->getBaseWeeeTaxAppliedRowAmount()+$_item->getBaseWeeeTaxRowDisposition(),
                            $_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()
                        );
                        ?>
                        </span>
                    <?php endif; ?>
                <?php endif; ?>
            </span>
            <br />
        <?php endif; ?>
        <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
            <span class="price-incl-tax">
                <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
                    <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
                <?php endif; ?>
                <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
                <?php $_baseIncl = $this->helper('checkout')->getBaseSubtotalInclTax($_item); ?>
                <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
                    <?php echo $this->displayPrices($_baseIncl+$_item->getBaseWeeeTaxAppliedRowAmount(), $_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
                <?php else: ?>
                    <?php echo $this->displayPrices($_baseIncl-$_item->getBaseWeeeTaxRowDisposition(), $_incl-$_item->getWeeeTaxRowDisposition()) ?>
                <?php endif; ?>


                <?php if (Mage::helper('weee')->getApplied($_item)): ?>

                    <br />
                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></small></span>
                        <?php endforeach; ?>
                    <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
                        <small>
                        <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
                            <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
                        <?php endforeach; ?>
                        </small>
                    <?php endif; ?>

                    <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
                        <br /><span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->displayPrices($_baseIncl+$_item->getBaseWeeeTaxAppliedRowAmount(), $_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
                    <?php endif; ?>
                <?php endif; ?>
            </span>
        <?php endif; ?>
    </td>
    <td class="a-right"><?php echo $this->displayPriceAttribute('tax_amount') ?></td>
    <td class="a-right"><?php echo $this->displayTaxPercent($_item) ?></td>
    <td class="a-right"><?php echo $this->displayPriceAttribute('discount_amount') ?></td>
    <td class="a-right last">
        <?php echo $this->displayPrices(
            $_item->getBaseRowTotal() + $_item->getBaseTaxAmount() + $_item->getBaseHiddenTaxAmount() + $_item->getBaseWeeeTaxAppliedRowAmount() - $_item->getBaseDiscountAmount(),
            $_item->getRowTotal() + $_item->getTaxAmount() + $_item->getHiddenTaxAmount() + $_item->getWeeeTaxAppliedRowAmount() - $_item->getDiscountAmount()
        ); ?>
    </td>
</tr>


i have add only three line
items.phtml
1. <col width="1" />
2. <th><span class="nobr"><?php echo $this->helper('sales')->__('Sku') ?></span></th>

default.phtml
3. <td class="a-center"><?php echo $_item->getSku() ?></td>

And clear cache and refresh browser you have view column in iteams part








4 comments

  1. HI there i need to show custom dropdown attribute in the admin column how can i do that?

    ReplyDelete
  2. I do agree with all the ideas you have presented in your post. They’re really convincing and will certainly work. Still, the posts are very short for newbies. Could you please extend them a little from next time?..Keep this great work
    magento development company in bangalore 

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Thanks very much! You saved my life!

    ReplyDelete