Sep 23, 2014
kalpesh

Magento: Show gift card details in admin order page

Magento display gift card details (code and amount) in Order View page of admin panel. When customer uses gift card in their order Magento does not display gift card code and amount details in admin panel which makes it tough to know. Customer can pay partially through gift card which makes even tougher as Magento only shows payment information of other method and not gift card amount deductions.

Below code will show you an additional block in magento admin panel with Gift Card details. If gift card is not used in an order, the block will simply no shown.

Open the file app/design/adminhtml/default/default/template/sales/order/view/edit.phtml

Add the below lines of code anywhere you want the gift card block to appear. I have used it after Account Information block.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php $cards = unserialize($_order->getGiftCards());
        if($cards!='' && count($cards)>0) { ?>
<div class="box-left">
    <div class="entry-edit">
        <div class="entry-edit-head">
            <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Gift Cards') ?></h4>
        </div>
        <div class="fieldset">
            <div class="hor-scroll">
                <table cellspacing="0" class="form-list">
                <?php foreach ($cards as $card) { ?>
                <tr>
                    <td class="label"><label><?php echo Mage::helper('sales')->__('Giftcard Code') ?></label></td>
                    <td class="value">
                        <div style="font-weight:bold"><?php echo $card['c'];?></div>
                    </td>
                </tr>
                <tr>
                    <td class="label"><label><?php echo Mage::helper('sales')->__('Giftcard Amount') ?></label></td>
                    <td class="value">
                        <div style="font-weight:bold"><?php echo $card['a'];?></div>
                    </td>
                </tr>
                <?php }?>
                </table>
            </div>
        </div>
    </div>
</div>
<?php }?>

Leave a comment

 

Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!

Certifications