custom customer attribute value not storing in database magento 2Multiselect attribute not saving in Magento 2.3.0Customer Attribute Value not Option_IDMagento2: How to add pre defined data (installData.php) for Custom Modulemain.CRITICAL: Plugin class doesn't existcustom Customer attribute value not save while customer registerMagento2: get custom customer attribute valueI have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridMagento offline custom Payment method with drop down listmagento 2.2.5: Adding Custom Attribute to Customer Edit Form in AdminMagento Custom Customer Attribute IssueMagento 2 How to upgrade existing custom customer address attribute?
Term for the "extreme-extension" version of a straw man fallacy?
What Brexit proposals are on the table in the indicative votes on the 27th of March 2019?
Lay out the Carpet
System.debug(JSON.Serialize(o)) Not longer shows full string
Integer addition + constant, is it a group?
Is the destination of a commercial flight important for the pilot?
Anatomically Correct Strange Women In Ponds Distributing Swords
CREATE opcode: what does it really do?
Go Pregnant or Go Home
Is HostGator storing my password in plaintext?
Opposite of a diet
Sequence of Tenses: Translating the subjunctive
How does the UK government determine the size of a mandate?
Are student evaluations of teaching assistants read by others in the faculty?
How long to clear the 'suck zone' of a turbofan after start is initiated?
Purchasing a ticket for someone else in another country?
Failed to fetch jessie backports repository
Is there a good way to store credentials outside of a password manager?
Why are there no referendums in the US?
Type int? vs type int
India just shot down a satellite from the ground. At what altitude range is the resulting debris field?
How easy is it to start Magic from scratch?
Increase performance creating Mandelbrot set in python
Fastening aluminum fascia to wooden subfascia
custom customer attribute value not storing in database magento 2
Multiselect attribute not saving in Magento 2.3.0Customer Attribute Value not Option_IDMagento2: How to add pre defined data (installData.php) for Custom Modulemain.CRITICAL: Plugin class doesn't existcustom Customer attribute value not save while customer registerMagento2: get custom customer attribute valueI have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridMagento offline custom Payment method with drop down listmagento 2.2.5: Adding Custom Attribute to Customer Edit Form in AdminMagento Custom Customer Attribute IssueMagento 2 How to upgrade existing custom customer address attribute?
<?php
namespace VendorModuleSetup;
use MagentoFrameworkDBDdlTable;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoCustomerSetupCustomerSetupFactory;
use MagentoQuoteSetupQuoteSetup;
use MagentoQuoteSetupQuoteSetupFactory;
use MagentoSalesSetupSalesSetup;
use MagentoSalesSetupSalesSetupFactory;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoEavModelEntityAttributeSetFactory as AttributeSetFactory;
use MagentoCustomerApiCustomerMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
/**
* @var CustomerSetupFactory
*/
private $customerSetupFactory;
/**
* @var SalesSetupFactory
*/
private $salesSetupFactory;
/**
* @var QuoteSetupFactory
*/
private $quoteSetupFactory;
private $attributeSetFactory;
public $customer_attribute_used_in_forms = ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address','customer_account_create','customer_address_edit','customer_register_address'];
private $eavSetupFactory;
public function __construct(
CustomerSetupFactory $customerSetupFactory,
SalesSetupFactory $salesSetupFactory,
QuoteSetupFactory $quoteSetupFactory,
MagentoEavSetupEavSetupFactory $eavSetupFactory,
MagentoEavModelConfig $eavConfig,
AttributeSetFactory $attributeSetFactory
)
$this->customerSetupFactory = $customerSetupFactory;
$this->salesSetupFactory = $salesSetupFactory;
$this->quoteSetupFactory = $quoteSetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
$this->attributeSetFactory = $attributeSetFactory;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$installer = $setup;
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.3.6') < 0)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode', [
'type' => 'varchar',
'label' => 'PINCODE',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'pincode');
$attribute = $customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
]);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile', [
'type' => 'varchar',
'label' => 'Mobile',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'mobile');
$attribute = $customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
]);
$attribute->save();
Here pincode attribute not storing in db,can you please guide me.after editing from individual customer its not loading the data.
magento2 database customer-attribute
add a comment |
<?php
namespace VendorModuleSetup;
use MagentoFrameworkDBDdlTable;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoCustomerSetupCustomerSetupFactory;
use MagentoQuoteSetupQuoteSetup;
use MagentoQuoteSetupQuoteSetupFactory;
use MagentoSalesSetupSalesSetup;
use MagentoSalesSetupSalesSetupFactory;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoEavModelEntityAttributeSetFactory as AttributeSetFactory;
use MagentoCustomerApiCustomerMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
/**
* @var CustomerSetupFactory
*/
private $customerSetupFactory;
/**
* @var SalesSetupFactory
*/
private $salesSetupFactory;
/**
* @var QuoteSetupFactory
*/
private $quoteSetupFactory;
private $attributeSetFactory;
public $customer_attribute_used_in_forms = ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address','customer_account_create','customer_address_edit','customer_register_address'];
private $eavSetupFactory;
public function __construct(
CustomerSetupFactory $customerSetupFactory,
SalesSetupFactory $salesSetupFactory,
QuoteSetupFactory $quoteSetupFactory,
MagentoEavSetupEavSetupFactory $eavSetupFactory,
MagentoEavModelConfig $eavConfig,
AttributeSetFactory $attributeSetFactory
)
$this->customerSetupFactory = $customerSetupFactory;
$this->salesSetupFactory = $salesSetupFactory;
$this->quoteSetupFactory = $quoteSetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
$this->attributeSetFactory = $attributeSetFactory;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$installer = $setup;
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.3.6') < 0)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode', [
'type' => 'varchar',
'label' => 'PINCODE',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'pincode');
$attribute = $customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
]);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile', [
'type' => 'varchar',
'label' => 'Mobile',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'mobile');
$attribute = $customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
]);
$attribute->save();
Here pincode attribute not storing in db,can you please guide me.after editing from individual customer its not loading the data.
magento2 database customer-attribute
hi guys please update the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
add a comment |
<?php
namespace VendorModuleSetup;
use MagentoFrameworkDBDdlTable;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoCustomerSetupCustomerSetupFactory;
use MagentoQuoteSetupQuoteSetup;
use MagentoQuoteSetupQuoteSetupFactory;
use MagentoSalesSetupSalesSetup;
use MagentoSalesSetupSalesSetupFactory;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoEavModelEntityAttributeSetFactory as AttributeSetFactory;
use MagentoCustomerApiCustomerMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
/**
* @var CustomerSetupFactory
*/
private $customerSetupFactory;
/**
* @var SalesSetupFactory
*/
private $salesSetupFactory;
/**
* @var QuoteSetupFactory
*/
private $quoteSetupFactory;
private $attributeSetFactory;
public $customer_attribute_used_in_forms = ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address','customer_account_create','customer_address_edit','customer_register_address'];
private $eavSetupFactory;
public function __construct(
CustomerSetupFactory $customerSetupFactory,
SalesSetupFactory $salesSetupFactory,
QuoteSetupFactory $quoteSetupFactory,
MagentoEavSetupEavSetupFactory $eavSetupFactory,
MagentoEavModelConfig $eavConfig,
AttributeSetFactory $attributeSetFactory
)
$this->customerSetupFactory = $customerSetupFactory;
$this->salesSetupFactory = $salesSetupFactory;
$this->quoteSetupFactory = $quoteSetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
$this->attributeSetFactory = $attributeSetFactory;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$installer = $setup;
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.3.6') < 0)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode', [
'type' => 'varchar',
'label' => 'PINCODE',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'pincode');
$attribute = $customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
]);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile', [
'type' => 'varchar',
'label' => 'Mobile',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'mobile');
$attribute = $customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
]);
$attribute->save();
Here pincode attribute not storing in db,can you please guide me.after editing from individual customer its not loading the data.
magento2 database customer-attribute
<?php
namespace VendorModuleSetup;
use MagentoFrameworkDBDdlTable;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoCustomerSetupCustomerSetupFactory;
use MagentoQuoteSetupQuoteSetup;
use MagentoQuoteSetupQuoteSetupFactory;
use MagentoSalesSetupSalesSetup;
use MagentoSalesSetupSalesSetupFactory;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoEavModelEntityAttributeSetFactory as AttributeSetFactory;
use MagentoCustomerApiCustomerMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
/**
* @var CustomerSetupFactory
*/
private $customerSetupFactory;
/**
* @var SalesSetupFactory
*/
private $salesSetupFactory;
/**
* @var QuoteSetupFactory
*/
private $quoteSetupFactory;
private $attributeSetFactory;
public $customer_attribute_used_in_forms = ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address','customer_account_create','customer_address_edit','customer_register_address'];
private $eavSetupFactory;
public function __construct(
CustomerSetupFactory $customerSetupFactory,
SalesSetupFactory $salesSetupFactory,
QuoteSetupFactory $quoteSetupFactory,
MagentoEavSetupEavSetupFactory $eavSetupFactory,
MagentoEavModelConfig $eavConfig,
AttributeSetFactory $attributeSetFactory
)
$this->customerSetupFactory = $customerSetupFactory;
$this->salesSetupFactory = $salesSetupFactory;
$this->quoteSetupFactory = $quoteSetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
$this->attributeSetFactory = $attributeSetFactory;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$installer = $setup;
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.3.6') < 0)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode', [
'type' => 'varchar',
'label' => 'PINCODE',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'pincode');
$attribute = $customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
]);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile', [
'type' => 'varchar',
'label' => 'Mobile',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'mobile');
$attribute = $customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
]);
$attribute->save();
Here pincode attribute not storing in db,can you please guide me.after editing from individual customer its not loading the data.
magento2 database customer-attribute
magento2 database customer-attribute
asked yesterday
hitesh balpandehitesh balpande
3819
3819
hi guys please update the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
add a comment |
hi guys please update the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
hi guys please update the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
hi guys please update the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
add a comment |
1 Answer
1
active
oldest
votes
I am not really sure about how your code works but I have modified it the way you want it to work.
Please try below code:
<?php
namespace VendorModuleSetup;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoCustomerSetupCustomerSetupFactory;
use MagentoQuoteSetupQuoteSetupFactory;
use MagentoSalesSetupSalesSetupFactory;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoEavModelEntityAttributeSetFactory as AttributeSetFactory;
use MagentoCustomerApiCustomerMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
/**
* @var CustomerSetupFactory
*/
private $customerSetupFactory;
/**
* @var SalesSetupFactory
*/
private $salesSetupFactory;
/**
* @var QuoteSetupFactory
*/
private $quoteSetupFactory;
/**
* @var AttributeSetFactory
*/
private $attributeSetFactory;
/**
* @var array
*/
public $customer_attribute_used_in_forms = ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address','customer_account_create','customer_address_edit','customer_register_address'];
/**
* @var MagentoEavSetupEavSetupFactory
*/
private $eavSetupFactory;
/**
* UpgradeData constructor.
* @param CustomerSetupFactory $customerSetupFactory
* @param SalesSetupFactory $salesSetupFactory
* @param QuoteSetupFactory $quoteSetupFactory
* @param MagentoEavSetupEavSetupFactory $eavSetupFactory
* @param MagentoEavModelConfig $eavConfig
* @param AttributeSetFactory $attributeSetFactory
*/
public function __construct(
CustomerSetupFactory $customerSetupFactory,
SalesSetupFactory $salesSetupFactory,
QuoteSetupFactory $quoteSetupFactory,
MagentoEavSetupEavSetupFactory $eavSetupFactory,
MagentoEavModelConfig $eavConfig,
AttributeSetFactory $attributeSetFactory
)
$this->customerSetupFactory = $customerSetupFactory;
$this->salesSetupFactory = $salesSetupFactory;
$this->quoteSetupFactory = $quoteSetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
$this->attributeSetFactory = $attributeSetFactory;
/**
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$installer = $setup;
$installer->startSetup();
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.3.6') < 0)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode', [
'type' => 'varchar',
'label' => 'PINCODE',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'pincode');
$customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
])->save();;
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile', [
'type' => 'varchar',
'label' => 'Mobile',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'mobile');
$customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
])->save();
$installer->endSetup();
And let me know if ever you'll get an error.
1
my code is working fine and updated the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267386%2fcustom-customer-attribute-value-not-storing-in-database-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I am not really sure about how your code works but I have modified it the way you want it to work.
Please try below code:
<?php
namespace VendorModuleSetup;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoCustomerSetupCustomerSetupFactory;
use MagentoQuoteSetupQuoteSetupFactory;
use MagentoSalesSetupSalesSetupFactory;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoEavModelEntityAttributeSetFactory as AttributeSetFactory;
use MagentoCustomerApiCustomerMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
/**
* @var CustomerSetupFactory
*/
private $customerSetupFactory;
/**
* @var SalesSetupFactory
*/
private $salesSetupFactory;
/**
* @var QuoteSetupFactory
*/
private $quoteSetupFactory;
/**
* @var AttributeSetFactory
*/
private $attributeSetFactory;
/**
* @var array
*/
public $customer_attribute_used_in_forms = ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address','customer_account_create','customer_address_edit','customer_register_address'];
/**
* @var MagentoEavSetupEavSetupFactory
*/
private $eavSetupFactory;
/**
* UpgradeData constructor.
* @param CustomerSetupFactory $customerSetupFactory
* @param SalesSetupFactory $salesSetupFactory
* @param QuoteSetupFactory $quoteSetupFactory
* @param MagentoEavSetupEavSetupFactory $eavSetupFactory
* @param MagentoEavModelConfig $eavConfig
* @param AttributeSetFactory $attributeSetFactory
*/
public function __construct(
CustomerSetupFactory $customerSetupFactory,
SalesSetupFactory $salesSetupFactory,
QuoteSetupFactory $quoteSetupFactory,
MagentoEavSetupEavSetupFactory $eavSetupFactory,
MagentoEavModelConfig $eavConfig,
AttributeSetFactory $attributeSetFactory
)
$this->customerSetupFactory = $customerSetupFactory;
$this->salesSetupFactory = $salesSetupFactory;
$this->quoteSetupFactory = $quoteSetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
$this->attributeSetFactory = $attributeSetFactory;
/**
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$installer = $setup;
$installer->startSetup();
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.3.6') < 0)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode', [
'type' => 'varchar',
'label' => 'PINCODE',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'pincode');
$customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
])->save();;
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile', [
'type' => 'varchar',
'label' => 'Mobile',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'mobile');
$customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
])->save();
$installer->endSetup();
And let me know if ever you'll get an error.
1
my code is working fine and updated the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
add a comment |
I am not really sure about how your code works but I have modified it the way you want it to work.
Please try below code:
<?php
namespace VendorModuleSetup;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoCustomerSetupCustomerSetupFactory;
use MagentoQuoteSetupQuoteSetupFactory;
use MagentoSalesSetupSalesSetupFactory;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoEavModelEntityAttributeSetFactory as AttributeSetFactory;
use MagentoCustomerApiCustomerMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
/**
* @var CustomerSetupFactory
*/
private $customerSetupFactory;
/**
* @var SalesSetupFactory
*/
private $salesSetupFactory;
/**
* @var QuoteSetupFactory
*/
private $quoteSetupFactory;
/**
* @var AttributeSetFactory
*/
private $attributeSetFactory;
/**
* @var array
*/
public $customer_attribute_used_in_forms = ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address','customer_account_create','customer_address_edit','customer_register_address'];
/**
* @var MagentoEavSetupEavSetupFactory
*/
private $eavSetupFactory;
/**
* UpgradeData constructor.
* @param CustomerSetupFactory $customerSetupFactory
* @param SalesSetupFactory $salesSetupFactory
* @param QuoteSetupFactory $quoteSetupFactory
* @param MagentoEavSetupEavSetupFactory $eavSetupFactory
* @param MagentoEavModelConfig $eavConfig
* @param AttributeSetFactory $attributeSetFactory
*/
public function __construct(
CustomerSetupFactory $customerSetupFactory,
SalesSetupFactory $salesSetupFactory,
QuoteSetupFactory $quoteSetupFactory,
MagentoEavSetupEavSetupFactory $eavSetupFactory,
MagentoEavModelConfig $eavConfig,
AttributeSetFactory $attributeSetFactory
)
$this->customerSetupFactory = $customerSetupFactory;
$this->salesSetupFactory = $salesSetupFactory;
$this->quoteSetupFactory = $quoteSetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
$this->attributeSetFactory = $attributeSetFactory;
/**
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$installer = $setup;
$installer->startSetup();
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.3.6') < 0)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode', [
'type' => 'varchar',
'label' => 'PINCODE',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'pincode');
$customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
])->save();;
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile', [
'type' => 'varchar',
'label' => 'Mobile',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'mobile');
$customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
])->save();
$installer->endSetup();
And let me know if ever you'll get an error.
1
my code is working fine and updated the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
add a comment |
I am not really sure about how your code works but I have modified it the way you want it to work.
Please try below code:
<?php
namespace VendorModuleSetup;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoCustomerSetupCustomerSetupFactory;
use MagentoQuoteSetupQuoteSetupFactory;
use MagentoSalesSetupSalesSetupFactory;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoEavModelEntityAttributeSetFactory as AttributeSetFactory;
use MagentoCustomerApiCustomerMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
/**
* @var CustomerSetupFactory
*/
private $customerSetupFactory;
/**
* @var SalesSetupFactory
*/
private $salesSetupFactory;
/**
* @var QuoteSetupFactory
*/
private $quoteSetupFactory;
/**
* @var AttributeSetFactory
*/
private $attributeSetFactory;
/**
* @var array
*/
public $customer_attribute_used_in_forms = ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address','customer_account_create','customer_address_edit','customer_register_address'];
/**
* @var MagentoEavSetupEavSetupFactory
*/
private $eavSetupFactory;
/**
* UpgradeData constructor.
* @param CustomerSetupFactory $customerSetupFactory
* @param SalesSetupFactory $salesSetupFactory
* @param QuoteSetupFactory $quoteSetupFactory
* @param MagentoEavSetupEavSetupFactory $eavSetupFactory
* @param MagentoEavModelConfig $eavConfig
* @param AttributeSetFactory $attributeSetFactory
*/
public function __construct(
CustomerSetupFactory $customerSetupFactory,
SalesSetupFactory $salesSetupFactory,
QuoteSetupFactory $quoteSetupFactory,
MagentoEavSetupEavSetupFactory $eavSetupFactory,
MagentoEavModelConfig $eavConfig,
AttributeSetFactory $attributeSetFactory
)
$this->customerSetupFactory = $customerSetupFactory;
$this->salesSetupFactory = $salesSetupFactory;
$this->quoteSetupFactory = $quoteSetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
$this->attributeSetFactory = $attributeSetFactory;
/**
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$installer = $setup;
$installer->startSetup();
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.3.6') < 0)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode', [
'type' => 'varchar',
'label' => 'PINCODE',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'pincode');
$customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
])->save();;
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile', [
'type' => 'varchar',
'label' => 'Mobile',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'mobile');
$customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
])->save();
$installer->endSetup();
And let me know if ever you'll get an error.
I am not really sure about how your code works but I have modified it the way you want it to work.
Please try below code:
<?php
namespace VendorModuleSetup;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoCustomerSetupCustomerSetupFactory;
use MagentoQuoteSetupQuoteSetupFactory;
use MagentoSalesSetupSalesSetupFactory;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoEavModelEntityAttributeSetFactory as AttributeSetFactory;
use MagentoCustomerApiCustomerMetadataInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
/**
* @var CustomerSetupFactory
*/
private $customerSetupFactory;
/**
* @var SalesSetupFactory
*/
private $salesSetupFactory;
/**
* @var QuoteSetupFactory
*/
private $quoteSetupFactory;
/**
* @var AttributeSetFactory
*/
private $attributeSetFactory;
/**
* @var array
*/
public $customer_attribute_used_in_forms = ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address','customer_account_create','customer_address_edit','customer_register_address'];
/**
* @var MagentoEavSetupEavSetupFactory
*/
private $eavSetupFactory;
/**
* UpgradeData constructor.
* @param CustomerSetupFactory $customerSetupFactory
* @param SalesSetupFactory $salesSetupFactory
* @param QuoteSetupFactory $quoteSetupFactory
* @param MagentoEavSetupEavSetupFactory $eavSetupFactory
* @param MagentoEavModelConfig $eavConfig
* @param AttributeSetFactory $attributeSetFactory
*/
public function __construct(
CustomerSetupFactory $customerSetupFactory,
SalesSetupFactory $salesSetupFactory,
QuoteSetupFactory $quoteSetupFactory,
MagentoEavSetupEavSetupFactory $eavSetupFactory,
MagentoEavModelConfig $eavConfig,
AttributeSetFactory $attributeSetFactory
)
$this->customerSetupFactory = $customerSetupFactory;
$this->salesSetupFactory = $salesSetupFactory;
$this->quoteSetupFactory = $quoteSetupFactory;
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
$this->attributeSetFactory = $attributeSetFactory;
/**
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$installer = $setup;
$installer->startSetup();
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.3.6') < 0)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
$attributeSetId = $customerEntity->getDefaultAttributeSetId();
$attributeSet = $this->attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode', [
'type' => 'varchar',
'label' => 'PINCODE',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'pincode');
$customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'pincode')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
])->save();;
$customerSetup->addAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile', [
'type' => 'varchar',
'label' => 'Mobile',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'sort_order' => 1000,
'position' => 1000,
'system' => 0,
]);
$eavSetup->addAttributeToSet(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
null,
'mobile');
$customerSetup->getEavConfig()->getAttribute(MagentoCustomerModelCustomer::ENTITY, 'mobile')
->addData([
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer','customer_address_edit','adminhtml_customer_address', 'customer_register_address','customer_account_edit', 'customer_account_create']
])->save();
$installer->endSetup();
And let me know if ever you'll get an error.
answered yesterday
magefmsmagefms
2,0722426
2,0722426
1
my code is working fine and updated the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
add a comment |
1
my code is working fine and updated the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
1
1
my code is working fine and updated the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
my code is working fine and updated the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267386%2fcustom-customer-attribute-value-not-storing-in-database-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
hi guys please update the same version for module.xml with UpgradeData.php then its fine
– hitesh balpande
yesterday