0

I am trying to add a quantity to return to stock data to the credit memo item.

form

I have made 2 install scripts. One adds a column to the database

<?php
$installer = $this;
$installer->startSetup();

$installer->run("
  ALTER TABLE sales_flat_creditmemo_item ADD returned_to_stock INT(10);
");

$installer->endSetup();

?>

The second one has to add an attribute to the item so that I can use methods like setReturnToStock(value)

<?php
$installer = Mage::getResourceModel('sales/setup', 'sales_setup');

$installer->startSetup();

$installer->addAttribute('creditmemo_item', 'returned_to_stock', array('type' => 'int', 'grid' => true));


$installer->endSetup();

?>

The SQL runs just fine, the second script also runs without errors, but when I log a memo item the new field is not there. So I am guessing it doesn't work.

How do I check:

1)The correct syntax for the addAttribute('creditmemo_item'

2)If the attribute has been added or if it didn't work to be 100% sure

0

Turns out I didn't need an attribute after all. Just had problems ovverriding the controller thats why the functionality didn't work. Fixed by including the original controller.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.