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

  • Home
  • SEARCH
  • 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 8833813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:52:18+00:00 2026-06-14T08:52:18+00:00

I need to customize the Credit Memo page to store whether or not an

  • 0

I need to customize the Credit Memo page to store whether or not an item was returned to stock.

I’ve identified the Observer in:

app\code\core\Mage\CatalogInventory\Model\Observer.php
refundOrderInventory()

which gets triggered when the admin submits the credit memo with the ‘Return to Stock’ checkbox ticked. So I know I can add my own observer to write/save something.

But I cant figure out how to add an extra attribute to the Credit Memo product items.

Could anyone give me some pointers?

UPDATE:
I can also add the extra Returned to Stock table cell by editing:

app\design\adminhtml\default\default\template\sales\order\creditmemo\view\items.phtml

and

app\design\adminhtml\default\default\template\sales\order\creditmemo\view\items\renderer\default.phtml

To give me this:
custom column added to credit memo product attributes

I’ve hardcoded the “YES” value you see in there. I need to find some way of making this a writeable/readable credit-memo product attribute.

  • 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-14T08:52:19+00:00Added an answer on June 14, 2026 at 8:52 am

    You will want to add the attribute and column to your creditmemo item entity, in an install script. Make sure to have your setup class to be Mage_Eav_Model_Entity_Setup as there is no addAttribute() function in Mage_Core_Model_Resource_Setup.

    $installer->addAttribute('creditmemo_item', 'returned_to_stock', array('type' => 'int', 'grid' => true, 'source' => 'adminhtml/system_config_source_yesno'));
    $installer->getConnection()->addColumn($installer->getTable('sales/creditmemo_item'), 'returned_to_stock', 'TINYINT(1) unsigned DEFAULT 0');
    

    Then, in your observer (please don’t modify the observer you listed there), set the value to be true, like so (I just copied the function you listed, and modified it slightly to demonstrate my point):

    public function refundOrderInventory($observer)
    {
        $creditmemo = $observer->getEvent()->getCreditmemo();
        $items = array();
        foreach ($creditmemo->getAllItems() as $item) {
            $return = false;
            if ($item->hasBackToStock()) {
                if ($item->getBackToStock() && $item->getQty()) {
                    $return = true;
                }
            } elseif (Mage::helper('cataloginventory')->isAutoReturnEnabled()) {
                $return = true;
            }
            if ($return) {
                $item->setReturnedToStock(1);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to customize the Not found in ExternalContext as a Resource page. I
I need to customize iReport sources.. (not creating plugin) Currently i am using iReport
i need to customize the page that user sees at url: user/%user/orders/%uc_order i tried
I want to create a theme, and I also need to customize about:home page.
I need to customize other's code, so I found they used Mage::getSingleton('core/session')->getMyCustomBlockInfo(); in Order.php
In my app i have a slider which i need to customize. I have
I need to customize the android.widget.Gallery . Where can I download the source code?
I'm setting up a new Django app and need to customize the Admin for
In an iPhone app, I need to customize the look of a UINavigationController class.
i am doing xml serialization but i need to customize the output. my code

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.