Q:

Anyone know how to access the magento gift card sku in transactional email template?

I had a custom utility task that allowed users to choose an image to accompany the gift card notice that is sent to the recipient when a gift card is purchased at the magento run shop. In the template, there is an assortment of variables available so you can customize the email that is sent. However, in order to add the correct image, I need to have access to the gift card sku number since my method for handling this was to simply create many gift cards and apply separate images for each one, then use javascript to swap the sku numbers when the user clicks the images. Simple enough.
In the app/code/core/Enterprise/GiftCard/Model/Observer.php file, the variables are set:
                $templateData = array(
                    'name'                   => $item->getProductOptionByCode('giftcard_recipient_name'),
                    'email'                  => $item->getProductOptionByCode('giftcard_recipient_email'),
                    'sender_name_with_email' => $sender,
                    'sender_name'            => $senderName,
                    'gift_message'           => $item->getProductOptionByCode('giftcard_message'),
                    'giftcards'              => $codeList->toHtml(),
                    'balance'                => $balance,
                    'is_multiple_codes'      => 1 < $goodCodes,
                    'store'                  => $order->getStore(),
                    'store_name'             => $order->getStore()->getName(), // @deprecated after 1.4.0.0-beta1
                    'is_redeemable'          => $isRedeemable,
                );

So I could add the product sku to this array and it would be available in the template system. Problem is, I don't know where to trace this back to even know how to get the Sku. I assume it is somehow available in the $item var, but magento has no documentation on this particular case and I can't guess since there is no method for testing. The email script is activated when the card is purchased so I can't just click a "Send test" button to see what comes out in the email that is sent to the user. The preview button dismisses variables.
Anyone happen to know about this? Possibly something like $item->getSku()
Any input helps.
Thanks

A:

That snippet is from the method Enterprise_GiftCard_Model_Observer::generateGiftCardAccounts() which is registered as a handler for sales_order_save_after event. That event is passed the same 'order' object as the "new order placed" emails have. You can experiment by altering that email template and triggering a new email by resending from the order page in admin.
$item->getSku() is almost certainly right.

