Magento 2 add a field to front account information tabHow to call a model method from controller in Magento2I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?main.CRITICAL: Plugin class doesn't existWhy Magento2 set entity_type_id statically at CategorySetup, CustomerSetupMagentoCustomerModelCustomer::__construct() must be an instance of MagentoFrameworkModelContextI have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridMagento 2 Create dynamic array From different Model Collection to use in multi select in gridMagento 2.3 Can't view module's front end page output?Magento 2 How to upgrade existing custom customer address attribute?Magento2 REST API get all customers details
Re-entry to Germany after vacation using blue card
Philosophical question on logistic regression: why isn't the optimal threshold value trained?
"The cow" OR "a cow" OR "cows" in this context
Why do games have consumables?
A Note on N!
Checks user level and limit the data before saving it to mongoDB
Phrase for the opposite of "foolproof"
How to have a sharp product image?
Does tea made with boiling water cool faster than tea made with boiled (but still hot) water?
How much cash can I safely carry into the USA and avoid civil forfeiture?
Apply MapThread to all but one variable
How come there are so many candidates for the 2020 Democratic party presidential nomination?
How to pronounce 'c++' in Spanish
Aliens crash on Earth and go into stasis to wait for technology to fix their ship
Which big number is bigger?
How did Captain America manage to do this?
Should the Death Curse affect an undead PC in the Tomb of Annihilation adventure?
How to not starve gigantic beasts
Elements other than carbon that can form many different compounds by bonding to themselves?
How to display Aura JS Errors Lightning Out
Implications of cigar-shaped bodies having rings?
Rivers without rain
Is the claim "Employers won't employ people with no 'social media presence'" realistic?
Critique of timeline aesthetic
Magento 2 add a field to front account information tab
How to call a model method from controller in Magento2I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?main.CRITICAL: Plugin class doesn't existWhy Magento2 set entity_type_id statically at CategorySetup, CustomerSetupMagentoCustomerModelCustomer::__construct() must be an instance of MagentoFrameworkModelContextI have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridMagento 2 Create dynamic array From different Model Collection to use in multi select in gridMagento 2.3 Can't view module's front end page output?Magento 2 How to upgrade existing custom customer address attribute?Magento2 REST API get all customers details
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to add a custom text field to the edit account information page on frontend customer dashboard, so i tried to create a module
like this in
VendorNameModuleNameSetupInstallData.php
namespace VendorNameModuleNameSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
/**
* EAV setup factory
*
* @var EavSetupFactory
*/
private $eavSetupFactory;
/**
* Init
*
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.0.0') < 0)
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$customerSetup = $objectManager->create('WetagInvoiceEmailSetupCustomerSetup');
$customerSetup->installAttributes($customerSetup);
And in
VendorNameModuleNameSetupCustomerSetup.php
<?php
namespace VendorNameModuleNameSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
)
$this -> eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
public function installAttributes($customerSetup)
$this -> installCustomerAttributes($customerSetup);
$this -> installCustomerAddressAttributes($customerSetup);
public function installCustomerAttributes($customerSetup)
$customerSetup -> addAttribute(MagentoCustomerModelCustomer::ENTITY,
'invoice_email',
[
'label' => 'invoice email',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'varchar',
'input' => 'text',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'invoice_email')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['customer_account_edit']) -> save();
public function installCustomerAddressAttributes($customerSetup)
public function getEavConfig()
return $this -> eavConfig;
The attribute is added on backend but not on frontend, I saw a post saying to override Magento template, so how to do it, if some one give me the steps to follow to display the field on customer account edit page on front.
magento2 module attributes customer frontend
add a comment |
I'm trying to add a custom text field to the edit account information page on frontend customer dashboard, so i tried to create a module
like this in
VendorNameModuleNameSetupInstallData.php
namespace VendorNameModuleNameSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
/**
* EAV setup factory
*
* @var EavSetupFactory
*/
private $eavSetupFactory;
/**
* Init
*
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.0.0') < 0)
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$customerSetup = $objectManager->create('WetagInvoiceEmailSetupCustomerSetup');
$customerSetup->installAttributes($customerSetup);
And in
VendorNameModuleNameSetupCustomerSetup.php
<?php
namespace VendorNameModuleNameSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
)
$this -> eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
public function installAttributes($customerSetup)
$this -> installCustomerAttributes($customerSetup);
$this -> installCustomerAddressAttributes($customerSetup);
public function installCustomerAttributes($customerSetup)
$customerSetup -> addAttribute(MagentoCustomerModelCustomer::ENTITY,
'invoice_email',
[
'label' => 'invoice email',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'varchar',
'input' => 'text',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'invoice_email')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['customer_account_edit']) -> save();
public function installCustomerAddressAttributes($customerSetup)
public function getEavConfig()
return $this -> eavConfig;
The attribute is added on backend but not on frontend, I saw a post saying to override Magento template, so how to do it, if some one give me the steps to follow to display the field on customer account edit page on front.
magento2 module attributes customer frontend
1
Yes, you need to override the template (phtml).
– Amit Bera♦
Apr 22 at 17:43
@AmitBera please how and which file i'm magento newbie
– tarek fellah
Apr 22 at 18:46
add a comment |
I'm trying to add a custom text field to the edit account information page on frontend customer dashboard, so i tried to create a module
like this in
VendorNameModuleNameSetupInstallData.php
namespace VendorNameModuleNameSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
/**
* EAV setup factory
*
* @var EavSetupFactory
*/
private $eavSetupFactory;
/**
* Init
*
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.0.0') < 0)
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$customerSetup = $objectManager->create('WetagInvoiceEmailSetupCustomerSetup');
$customerSetup->installAttributes($customerSetup);
And in
VendorNameModuleNameSetupCustomerSetup.php
<?php
namespace VendorNameModuleNameSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
)
$this -> eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
public function installAttributes($customerSetup)
$this -> installCustomerAttributes($customerSetup);
$this -> installCustomerAddressAttributes($customerSetup);
public function installCustomerAttributes($customerSetup)
$customerSetup -> addAttribute(MagentoCustomerModelCustomer::ENTITY,
'invoice_email',
[
'label' => 'invoice email',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'varchar',
'input' => 'text',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'invoice_email')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['customer_account_edit']) -> save();
public function installCustomerAddressAttributes($customerSetup)
public function getEavConfig()
return $this -> eavConfig;
The attribute is added on backend but not on frontend, I saw a post saying to override Magento template, so how to do it, if some one give me the steps to follow to display the field on customer account edit page on front.
magento2 module attributes customer frontend
I'm trying to add a custom text field to the edit account information page on frontend customer dashboard, so i tried to create a module
like this in
VendorNameModuleNameSetupInstallData.php
namespace VendorNameModuleNameSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
/**
* EAV setup factory
*
* @var EavSetupFactory
*/
private $eavSetupFactory;
/**
* Init
*
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.0.0') < 0)
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$customerSetup = $objectManager->create('WetagInvoiceEmailSetupCustomerSetup');
$customerSetup->installAttributes($customerSetup);
And in
VendorNameModuleNameSetupCustomerSetup.php
<?php
namespace VendorNameModuleNameSetup;
use MagentoEavModelConfig;
use MagentoEavModelEntitySetupContext;
use MagentoEavSetupEavSetup;
use MagentoFrameworkAppCacheInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelResourceModelEntityAttributeGroupCollectionFactory;
class CustomerSetup extends EavSetup
protected $eavConfig;
public function __construct(
ModuleDataSetupInterface $setup,
Context $context,
CacheInterface $cache,
CollectionFactory $attrGroupCollectionFactory,
Config $eavConfig
)
$this -> eavConfig = $eavConfig;
parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
public function installAttributes($customerSetup)
$this -> installCustomerAttributes($customerSetup);
$this -> installCustomerAddressAttributes($customerSetup);
public function installCustomerAttributes($customerSetup)
$customerSetup -> addAttribute(MagentoCustomerModelCustomer::ENTITY,
'invoice_email',
[
'label' => 'invoice email',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'varchar',
'input' => 'text',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'invoice_email')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['customer_account_edit']) -> save();
public function installCustomerAddressAttributes($customerSetup)
public function getEavConfig()
return $this -> eavConfig;
The attribute is added on backend but not on frontend, I saw a post saying to override Magento template, so how to do it, if some one give me the steps to follow to display the field on customer account edit page on front.
magento2 module attributes customer frontend
magento2 module attributes customer frontend
edited Apr 22 at 18:14
Pawan
2,2912721
2,2912721
asked Apr 22 at 17:41
tarek fellahtarek fellah
164
164
1
Yes, you need to override the template (phtml).
– Amit Bera♦
Apr 22 at 17:43
@AmitBera please how and which file i'm magento newbie
– tarek fellah
Apr 22 at 18:46
add a comment |
1
Yes, you need to override the template (phtml).
– Amit Bera♦
Apr 22 at 17:43
@AmitBera please how and which file i'm magento newbie
– tarek fellah
Apr 22 at 18:46
1
1
Yes, you need to override the template (phtml).
– Amit Bera♦
Apr 22 at 17:43
Yes, you need to override the template (phtml).
– Amit Bera♦
Apr 22 at 17:43
@AmitBera please how and which file i'm magento newbie
– tarek fellah
Apr 22 at 18:46
@AmitBera please how and which file i'm magento newbie
– tarek fellah
Apr 22 at 18:46
add a comment |
0
active
oldest
votes
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%2f270988%2fmagento-2-add-a-field-to-front-account-information-tab%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f270988%2fmagento-2-add-a-field-to-front-account-information-tab%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
1
Yes, you need to override the template (phtml).
– Amit Bera♦
Apr 22 at 17:43
@AmitBera please how and which file i'm magento newbie
– tarek fellah
Apr 22 at 18:46