1

I'm trying to create two Order Attributes in Magento 1.9.1.0.

I have the following in my custom module install script;

$installer = $this;
$installer->startSetup();

$installer->addAttribute(
    'order',
    'ordersync_status_code',
    array(
        'type' => 'varchar',
        'backend_type' => 'varchar',
        'label' => 'Order Sync Status Code',
        'visible' => true,
        'required' => false,
        'user_defined' => false,
        'searchable' => true,
        'filterable' => true,
        'comparable' => true,
        'default' => ''
    )
);
$installer->addAttribute(
    'order',
    'ordersync_status_text',
    array(
        'type' => 'varchar',
        'backend_type' => 'varchar',
        'label' => 'Order Sync Status Text',
        'visible' => true,
        'required' => false,
        'user_defined' => false,
        'searchable' => true,
        'filterable' => true,
        'comparable' => true,
        'default'=> ''
    )
);
$installer->endSetup();

After install, I can see that two rows have been added to the sales_flat_order table for the above to attributes.

However, I can't see them in the eav_attribute table. Should I be able to see them here? I would have thought so. :/

The purpose of the fields; I don't intend these to be editable when viewing or editing an order. They will simply hold some values that will be updated when orders are sent to a third party - so I simply need to present the data when viewing the sales order grid and the order itself.

Thanks.

0

This should be a comment however I don't have enough reputation for that.

The attributes should show up in the eav_attribute table. It's possible that Magento already thinks that your module has already been installed and it is not running your installer. I would delete your module entry from the core_resource table to have your module run the installer again.

1
  • Thank you. Tried that a few times but doesn't seem to have worked. :( The module setup shows in the core_resource table and some other aspects of the custom module have installed fine (such as showing a column on the sales grid for the content of the new attribute). Aug 4 '17 at 8:44

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.