Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8162323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:40:53+00:00 2026-06-06T18:40:53+00:00

I’m having difficulty retrieving the giftcard code and amount used on an order. For

  • 0

I’m having difficulty retrieving the giftcard code and amount used on an order. For example in Mage/Sales/Model/Order/Pdf/Abstract.php, there is a piece of code that works with a Sales/Order model. i.e.

($order instanceof Mage_Sales_Model_Order) is true in the PDF example

or

$order = Mage::getModel('sales/order')->load($orderID); in another example

In the invoice PDF that gets printed, the total section shows the gift card that was used as well as coupon code that was used. The coupon code can be obtained by $order->getCouponCode().

How do I get the giftcard code and amount from $order? I’ve tried

$order->getGiftcertCode();
$order->getGiftcertAmount();

but these don’t return anything. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:40:54+00:00Added an answer on June 6, 2026 at 6:40 pm

    There’s probably a few ways to do this, but I haven’t had to do it before so just from looking at the sales_flat_order table in the Magento database, I can see that there are a number of fields that you can use to reference different gift card amounts:

    base_gift_cards_amount
    gift_cards_amount
    base_gift_cards_invoiced
    gift_cards_invoiced
    base_gift_cards_refunded
    gift_cards_refunded
    

    These can be accessed with the following calls:

    $order->getBaseGiftCardsAmount();
    $order->getGiftCardsAmount();
    $order->getBaseGiftCardsInvoiced();
    $order->getGiftCardsInvoiced();
    $order->getBaseGiftCardsRefunded();
    $order->getGiftCardsRefunded();
    

    The one you want to use is probably $order->getGiftCardsAmount()

    In order to get the gift card details, they are stored as a serialised array in the “gift_cards” column of the above table. So to get that array, call

    $cards = unserialize($order->getGiftCards());
    

    print_r $cards and you’ll see something like this:

    Array
    (
        [0] => Array
             (
                 [i] => 1
                 [c] => {{Gift Card Code}}
                 [a] => {{Gift Card Amount}}
                 [ba] => {{Gift Card Base Amount}}
             )
    
    )
    

    so

    foreach ($cards as $card) {
        echo "Code: " . $card['c'] . "\n";
        echo "Amount: " . $card['a'] . "\n";
    }
    

    should work just fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
i got an object with contents of html markup in it, for example: string
I'm having trouble keeping the paragraph square between the quote marks. In firefox the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.