Guest User

Untitled

a guest
Jan 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. <?php
  2. $installer = $this;
  3. $installer->startSetup();
  4.  
  5. $installer->addAttribute("quote_address", "com_id", array("type"=>"varchar"));
  6. $installer->addAttribute("sales_flat_quote_address", "com_id", array("type"=>"varchar"));
  7.  
  8. $installer->addAttribute('customer_address', 'com_id', array(
  9. 'type' => 'varchar',
  10. 'input' => 'text',
  11. 'label' => 'COM ID',
  12. 'visible' => true,
  13. 'required' => false,
  14. 'unique' => false,
  15. 'sort_order' => 75, // Positions of the other attributes are listed in
  16. 'position' => 75, // Mage_Customer_Model_Resource_Setup
  17. 'backend' => true,
  18. 'frontend' => false,
  19. 'visible_on_front' => false,
  20. 'used_for_price_rules' => true,
  21. 'adminhtml_only' => true,
  22. )
  23. );
  24.  
  25. $attribute = Mage::getSingleton('eav/config')->getAttribute('customer_address', 'com_id');
  26.  
  27. $used_in_forms=array();
  28.  
  29. $used_in_forms[]='adminhtml_customer_address';
  30. $used_in_forms[]='customer_register_address';
  31. $used_in_forms[]='customer_address_edit';
  32. $attribute->setData('used_in_forms', $used_in_forms)
  33. ->setData('is_used_for_customer_segment', true)
  34. ->setData('is_system', 0)
  35. ->setData('is_user_defined', 1)
  36. ->setData('is_visible', 0)
  37. ->setData('sort_order', 100)
  38. ;
  39. $attribute->save();
  40.  
  41. //Go to the Magento admin panel -> System -> Configuration -> Customer configuration -> Address templates and add the new attribute to the templates
  42.  
  43. $installer->endSetup();
  44.  
  45. Error in file: "/var/www/vhosts/app/code/local/Module/sql/module_setup/mysql4-install-1.0.1.php" - Wrong entity ID
  46.  
  47. Trace:
  48. #0 /var/www/vhosts/app/code/core/Mage/Core/Model/Resource/Setup.php(644): Mage::exception('Mage_Core', 'Error in file: ...')
  49. #1 /var/www/vhosts/app/code/core/Mage/Core/Model/Resource/Setup.php(421): Mage_Core_Model_Resource_Setup->_modifyResourceDb('install', '', '1.0.1')
  50. #2 /var/www/vhosts/app/code/core/Mage/Core/Model/Resource/Setup.php(327): Mage_Core_Model_Resource_Setup->_installResourceDb('1.0.1')
  51. #3 /var/www/vhosts/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
  52. #4 /var/www/vhosts/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
  53. #5 /var/www/vhosts/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
  54. #6 /var/www/vhosts/app/Mage.php(685): Mage_Core_Model_App->run(Array)
  55. #7 /var/www/vhosts/index.php(88): Mage::run('', 'store')
  56. #8 {main}
Add Comment
Please, Sign In to add comment