{"action":"created","issue":{"url":"https://api.github.com/repos/magento/magento2/issues/6575","repository_url":"https://api.github.com/repos/magento/magento2","labels_url":"https://api.github.com/repos/magento/magento2/issues/6575/labels{/name}","comments_url":"https://api.github.com/repos/magento/magento2/issues/6575/comments","events_url":"https://api.github.com/repos/magento/magento2/issues/6575/events","html_url":"https://github.com/magento/magento2/issues/6575","id":176255691,"number":6575,"title":"Magento 2.1 Customer address attribute is not saved into database","user":{"login":"Bartlomiejsz","id":9566840,"avatar_url":"https://avatars1.githubusercontent.com/u/9566840?v=3","gravatar_id":"","url":"https://api.github.com/users/Bartlomiejsz","html_url":"https://github.com/Bartlomiejsz","followers_url":"https://api.github.com/users/Bartlomiejsz/followers","following_url":"https://api.github.com/users/Bartlomiejsz/following{/other_user}","gists_url":"https://api.github.com/users/Bartlomiejsz/gists{/gist_id}","starred_url":"https://api.github.com/users/Bartlomiejsz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bartlomiejsz/subscriptions","organizations_url":"https://api.github.com/users/Bartlomiejsz/orgs","repos_url":"https://api.github.com/users/Bartlomiejsz/repos","events_url":"https://api.github.com/users/Bartlomiejsz/events{/privacy}","received_events_url":"https://api.github.com/users/Bartlomiejsz/received_events","type":"User","site_admin":false},"labels":[{"id":374015207,"url":"https://api.github.com/repos/magento/magento2/labels/Customer","name":"Customer","color":"1d76db","default":false},{"id":161563561,"url":"https://api.github.com/repos/magento/magento2/labels/needs%20update","name":"needs update","color":"b60205","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2016-09-11T17:53:40Z","updated_at":"2017-03-03T16:32:05Z","closed_at":"2016-10-10T07:48:32Z","body":"### Preconditions\n1. Magento 2.1.1\n### Steps to reproduce\n1. Add new custom attribute via `InstallData.php` with `install` function content:\n   \n   ```\n    /** @var \\Magento\\Customer\\Setup\\CustomerSetup $customerSetup */\n     $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);\n   \n     $attributesInfo = [\n         'company_info' => [\n             'label' => 'Company Info',\n             'type' => 'static',\n             'input' => 'textarea',\n             'position' => 65,\n             'visible' => true,\n             'system' => false,\n             'user_defined' => false,\n             'required' => false,\n             'validate_rules' => 'a:1:{s:15:\"max_text_length\";i:500;}'\n         ],\n         'telephone_secondary' => [\n             'label' => 'Secondary Phone Number',\n             'type' => 'static',\n             'input' => 'text',\n             'position' => 125,\n             'visible' => true,\n             'system' => false,\n             'user_defined' => false,\n             'required' => false,\n         ]\n     ];\n   \n     $columns = [\n         'company_info' => [\n             'type' => Table::TYPE_TEXT,\n             'nullable' => true,\n             'default' => null,\n             'comment' => 'Company Info',\n         ],\n         'telephone_secondary' => [\n             'type' => Table::TYPE_TEXT,\n             'nullable' => true,\n             'default' => null,\n             'length' => 255,\n             'comment' => 'Secondary Phone Number',\n         ]\n     ];\n   \n     $tableNames = [\n         'customer_address_entity',\n         'quote_address',\n         'sales_order_address'\n     ];\n   \n     foreach ($attributesInfo as $attributeCode => $attributeParams) {\n         $customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams);\n         $customerSetup->getEavConfig()->getAttribute('customer_address', $attributeCode)\n             ->setData('attribute_set_id', AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS)\n             ->setData('used_in_forms', [\n                 'customer_address_edit',\n                 'customer_register_address',\n                 'adminhtml_customer_address'\n             ])\n             ->save();\n     }\n   \n     $connection = $setup->getConnection();\n     foreach ($tableNames as $tableName) {\n         foreach ($columns as $name => $definition) {\n             $connection->addColumn($tableName, $name, $definition);\n         }\n     }\n   ```\n2. Add `fieldset.xml` with following content:\n\n```\n<?xml version=\"1.0\"?>\n\n<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n        xsi:noNamespaceSchemaLocation=\"urn:magento:framework:DataObject/etc/fieldset.xsd\">\n    <scope id=\"global\">\n        <fieldset id=\"customer_address\">\n            <field name=\"company_info\">\n                <aspect name=\"create\" />\n                <aspect name=\"update\" />\n                <aspect name=\"to_quote_address\" />\n            </field>\n            <field name=\"telephone_secondary\">\n                <aspect name=\"create\" />\n                <aspect name=\"update\" />\n                <aspect name=\"to_quote_address\" />\n            </field>\n        </fieldset>\n        <fieldset id=\"sales_convert_order_address\">\n            <field name=\"company_info\">\n                <aspect name=\"to_quote_address\" />\n            </field>\n            <field name=\"telephone_secondary\">\n                <aspect name=\"to_quote_address\" />\n            </field>\n        </fieldset>\n        <fieldset id=\"sales_convert_quote_address\">\n            <field name=\"company_info\">\n                <aspect name=\"to_order_address\" />\n                <aspect name=\"to_customer_address\" />\n            </field>\n            <field name=\"telephone_secondary\">\n                <aspect name=\"to_order_address\" />\n                <aspect name=\"to_customer_address\" />\n            </field>\n        </fieldset>\n        <fieldset id=\"sales_copy_order_billing_address\">\n            <field name=\"company_info\">\n                <aspect name=\"to_order\" />\n            </field>\n            <field name=\"telephone_secondary\">\n                <aspect name=\"to_order\" />\n            </field>\n        </fieldset>\n        <fieldset id=\"order_address\">\n            <field name=\"company_info\">\n                <aspect name=\"to_customer_address\" />\n            </field>\n            <field name=\"telephone_secondary\">\n                <aspect name=\"to_customer_address\" />\n            </field>\n        </fieldset>\n    </scope>\n</config>\n```\n1. Go to checkout\n2. Insert data for new address (custom attributes are visible - that is correct)\n3. Go to billing step\n### Expected result\n1. Custom attributes values should be saved into database\n### Actual result\n1. Attributes values are not saved\n"},"comment":{"url":"https://api.github.com/repos/magento/magento2/issues/comments/284001692","html_url":"https://github.com/magento/magento2/issues/6575#issuecomment-284001692","issue_url":"https://api.github.com/repos/magento/magento2/issues/6575","id":284001692,"user":{"login":"EspertoMagento","id":8995116,"avatar_url":"https://avatars1.githubusercontent.com/u/8995116?v=3","gravatar_id":"","url":"https://api.github.com/users/EspertoMagento","html_url":"https://github.com/EspertoMagento","followers_url":"https://api.github.com/users/EspertoMagento/followers","following_url":"https://api.github.com/users/EspertoMagento/following{/other_user}","gists_url":"https://api.github.com/users/EspertoMagento/gists{/gist_id}","starred_url":"https://api.github.com/users/EspertoMagento/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EspertoMagento/subscriptions","organizations_url":"https://api.github.com/users/EspertoMagento/orgs","repos_url":"https://api.github.com/users/EspertoMagento/repos","events_url":"https://api.github.com/users/EspertoMagento/events{/privacy}","received_events_url":"https://api.github.com/users/EspertoMagento/received_events","type":"User","site_admin":false},"created_at":"2017-03-03T16:32:05Z","updated_at":"2017-03-03T16:32:05Z","body":"@Bartlomiejsz I think that my problem is in the InstallData.php. I use this method that is a little different from your. In my there isn't the code\r\n`$columns = [\r\n\t\t\t  'codice_fiscale' => [\r\n\t\t\t\t  'type' => Table::TYPE_TEXT,\r\n\t\t\t\t  'nullable' => true,\r\n\t\t\t\t  'default' => null,\r\n\t\t\t\t  'length' => 255,\r\n\t\t\t\t  'comment' => 'Codice Fiscale',\r\n\t\t\t  ]\r\n\t\t  ];\r\n\r\n\t\t  $tableNames = [\r\n\t\t\t  'customer_address_entity',\r\n\t\t\t  'quote_address',\r\n\t\t\t  'sales_order_address'\r\n\t\t  ];\r\n\t\t  \r\n\t\t  $connection = $setup->getConnection();\r\n\t\t  foreach ($tableNames as $tableName) {\r\n\t\t\t  foreach ($columns as $name => $definition) {\r\n\t\t\t\t  $connection->addColumn($tableName, $name, $definition);\r\n\t\t\t  }\r\n\t\t  }`\r\n\r\nI post here my code of InstallData.php\r\n\r\n`<?php\r\n\r\nnamespace EspertoMagento\\MyAttribute\\Setup;\r\n\r\nuse Magento\\Customer\\Setup\\CustomerSetupFactory;\r\nuse Magento\\Eav\\Model\\Entity\\Attribute\\SetFactory as AttributeSetFactory;\r\nuse Magento\\Framework\\Setup\\InstallDataInterface;\r\nuse Magento\\Framework\\Setup\\ModuleContextInterface;\r\nuse Magento\\Framework\\Setup\\ModuleDataSetupInterface;\r\n \r\n/**\r\n * @codeCoverageIgnore\r\n */\r\nclass InstallData implements InstallDataInterface\r\n{\r\n    \r\n    /**\r\n     * @var CustomerSetupFactory\r\n     */\r\n    protected $customerSetupFactory;\r\n    \r\n    /**\r\n     * @var AttributeSetFactory\r\n     */\r\n    private $attributeSetFactory;\r\n    \r\n    /**\r\n     * @param CustomerSetupFactory $customerSetupFactory\r\n     * @param AttributeSetFactory $attributeSetFactory\r\n     */\r\n    public function __construct(\r\n        CustomerSetupFactory $customerSetupFactory,\r\n        AttributeSetFactory $attributeSetFactory\r\n    ) {\r\n        $this->customerSetupFactory = $customerSetupFactory;\r\n        $this->attributeSetFactory = $attributeSetFactory;\r\n    }\r\n \r\n    \r\n    /**\r\n     * {@inheritdoc}\r\n     */\r\n    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)\r\n    {\r\n        \r\n        /** @var CustomerSetup $customerSetup */\r\n        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);\r\n        \r\n        $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer_address');\r\n        $attributeSetId = $customerEntity->getDefaultAttributeSetId();\r\n        \r\n        /** @var $attributeSet AttributeSet */\r\n        $attributeSet = $this->attributeSetFactory->create();\r\n        $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);\r\n        \r\n        $customerSetup->addAttribute('customer_address', 'my_attribute_code', [\r\n            'type' => 'varchar',\r\n            'label' => 'My Attribute Label',\r\n            'input' => 'text',\r\n            'required' => false,\r\n            'visible_on_front' => true,\r\n            'visible' => true,\r\n            'user_defined' => false,\r\n            'sort_order' => 1000,\r\n            'position' => 1000,\r\n            'system' => 0,\r\n            'is_used_in_grid' => true,\r\n\t    'is_visible_in_grid' => true,\r\n\t    'is_filterable_in_grid' => true,\r\n\t    'is_searchable_in_grid' => true\r\n        ]);\r\n        \r\n        $attribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'my_attribute_code')->addData([\r\n            'attribute_set_id' => $attributeSetId,\r\n            'attribute_group_id' => $attributeGroupId,\r\n            'used_in_forms' => ['adminhtml_customer_address', 'customer_address_edit', 'customer_register_address']\r\n        ]);\r\n        \r\n        $attribute->save();\r\n\r\n    }\r\n}`"}}
{"actor":{"display_login":"EspertoMagento"}}