I am working on module in which I need to add a custom attribute to the Order Entity but as I tried and failed I found out that Orders Entity is no longer using EAV attributes (or at least EAV table). Is there any way to use custom attribute to filter Orders ?

I am using Magento 1.7.2

1 Answer 1


Installer (Some/Module/sql/some_module_setup/mysql4-install-0.1.0.php):

/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
//add real field to orders table
    ->addColumn($installer->getTable('sales/order'), 'some_attribute', array(
    'LENGTH' => 255,
    'NULLABLE' => true,
    'COMMENT' => 'Some Attribute Definition'

Filter Collection:

$collection = Mage::getModel('sales/order')
            ->addFieldToFilter('some_attribute', 'some_value');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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