Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
- $installer->startSetup();
- $installer->addAttribute('order', 'erp_associated_ids', array(
- 'user_defined' => true,
- 'type' => 'varchar',
- 'backend' => 'mycompany_mymodule/adminhtml_system_config_backend_csv',
- 'label' => 'Associated Order IDs',
- 'input' => 'text',
- 'source' => '',
- 'visible' => true,
- 'required' => false,
- 'default' => '',
- 'frontend' => '',
- 'unique' => false,
- 'note' => 'CSV of order IDs'
- ));
- $installer->endSetup();
- class Mycompany_Mymodule_Model_Adminhtml_System_Config_Backend_Csv extends Mage_Core_Model_Config_Data {
- protected function _afterLoad()
- {
- if (is_string($this->getValue())) {
- $value = $this->getValue();
- $this->setValue(empty($value) ? false : explode(',', $value));
- }
- }
- protected function _beforeSave()
- {
- if (is_array($this->getValue())) {
- $this->setValue(implode(',', $this->getValue()));
- }
- }
- }
- Mage::getModel('sales/order')
- ->load(25)
- ->setErpAssociatedIds(array('12345', '98765'))
- ->save();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement