Magento 2.2.x - How to create customer radio and checkbox button attributeHow to set value for radio button...
A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?
Is there a weight limit to Feather Fall?
How can my powered armor quickly replace its ceramic plates?
Why was Lupin comfortable with saying Voldemort's name?
Quickly creating a sparse array
Why avoid shared user accounts?
Why are the books in the Game of Thrones citadel library shelved spine inwards?
Removing disk while game is suspended
Why would space fleets be aligned?
A curious equality of integrals involving the prime counting function?
Can a hotel cancel a confirmed reservation?
Why is it that Bernie Sanders is always called a "socialist"?
How can a school be getting an epidemic of whooping cough if most of the students are vaccinated?
What is a good reason for every spaceship to carry a weapon on board?
How does Leonard in "Memento" remember reading and writing?
Why don't hotels mount air conditioning units outside the rooms?
What to look for when criticizing poetry?
Publishing research using outdated methods
How would an AI self awareness kill switch work?
Why did Luke use his left hand to shoot?
Non-Cancer terminal illness that can affect young (age 10-13) girls?
Play Zip, Zap, Zop
Can a person refuse a presidential pardon?
In Linux what happens if 1000 files in a directory are moved to another location while another 300 files were added to the source directory?
Magento 2.2.x - How to create customer radio and checkbox button attribute
How to set value for radio button in EAV attribute of product type?Adding custom attribute to customer registration formHow to add price for the customer group and add it to the customer registration pageMagento2 adding radio buttons in customoptionsCreate customer custom attribute with input type checkbox, multiselect, and radio Magento 2Get custom attribute dropdown/multiselect options label and value in Magento 2How to force the customer to choose “Yes” in an “Yes/No” attribute?How to add a button to the Customer Edit Page within the admin?Magento 2.2. Customer Custom AttributeHow to create a custom field in Magento 2 user registration?Magento 2 how to create custom field in user registration page
want to show radio button and checkbox in customer registration page and admin panel... I need exactly radio button and checkbox... But most of the friends mentioned in his/her blog on 'input'=>'boollean', it's not fulfilling my requirement.... Can anyone help me to create the custom customer attribute as radio and checkbox?
magento2 customer
add a comment |
want to show radio button and checkbox in customer registration page and admin panel... I need exactly radio button and checkbox... But most of the friends mentioned in his/her blog on 'input'=>'boollean', it's not fulfilling my requirement.... Can anyone help me to create the custom customer attribute as radio and checkbox?
magento2 customer
If you are trying to add attribute via install/upgrade data script then you can add value for "input" to required type. It could be 'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' give a try and let me know if it helps..
– Himmat Paliwal
Nov 23 '18 at 6:54
'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' it's not working
– Ajithkumar
Nov 23 '18 at 10:23
I had a check and found that 'input'=>'boollean' is also creating a checkbox but some additional css added by magento team to get customized look. You can overwrite that css for your particular pages in case..
– Himmat Paliwal
Nov 23 '18 at 13:14
see the following i think this is exactly what you need magento.stackexchange.com/questions/263675/…
– iqbal malik
30 mins ago
add a comment |
want to show radio button and checkbox in customer registration page and admin panel... I need exactly radio button and checkbox... But most of the friends mentioned in his/her blog on 'input'=>'boollean', it's not fulfilling my requirement.... Can anyone help me to create the custom customer attribute as radio and checkbox?
magento2 customer
want to show radio button and checkbox in customer registration page and admin panel... I need exactly radio button and checkbox... But most of the friends mentioned in his/her blog on 'input'=>'boollean', it's not fulfilling my requirement.... Can anyone help me to create the custom customer attribute as radio and checkbox?
magento2 customer
magento2 customer
edited Nov 23 '18 at 10:22
Ajithkumar
asked Nov 23 '18 at 6:41
AjithkumarAjithkumar
13711
13711
If you are trying to add attribute via install/upgrade data script then you can add value for "input" to required type. It could be 'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' give a try and let me know if it helps..
– Himmat Paliwal
Nov 23 '18 at 6:54
'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' it's not working
– Ajithkumar
Nov 23 '18 at 10:23
I had a check and found that 'input'=>'boollean' is also creating a checkbox but some additional css added by magento team to get customized look. You can overwrite that css for your particular pages in case..
– Himmat Paliwal
Nov 23 '18 at 13:14
see the following i think this is exactly what you need magento.stackexchange.com/questions/263675/…
– iqbal malik
30 mins ago
add a comment |
If you are trying to add attribute via install/upgrade data script then you can add value for "input" to required type. It could be 'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' give a try and let me know if it helps..
– Himmat Paliwal
Nov 23 '18 at 6:54
'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' it's not working
– Ajithkumar
Nov 23 '18 at 10:23
I had a check and found that 'input'=>'boollean' is also creating a checkbox but some additional css added by magento team to get customized look. You can overwrite that css for your particular pages in case..
– Himmat Paliwal
Nov 23 '18 at 13:14
see the following i think this is exactly what you need magento.stackexchange.com/questions/263675/…
– iqbal malik
30 mins ago
If you are trying to add attribute via install/upgrade data script then you can add value for "input" to required type. It could be 'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' give a try and let me know if it helps..
– Himmat Paliwal
Nov 23 '18 at 6:54
If you are trying to add attribute via install/upgrade data script then you can add value for "input" to required type. It could be 'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' give a try and let me know if it helps..
– Himmat Paliwal
Nov 23 '18 at 6:54
'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' it's not working
– Ajithkumar
Nov 23 '18 at 10:23
'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' it's not working
– Ajithkumar
Nov 23 '18 at 10:23
I had a check and found that 'input'=>'boollean' is also creating a checkbox but some additional css added by magento team to get customized look. You can overwrite that css for your particular pages in case..
– Himmat Paliwal
Nov 23 '18 at 13:14
I had a check and found that 'input'=>'boollean' is also creating a checkbox but some additional css added by magento team to get customized look. You can overwrite that css for your particular pages in case..
– Himmat Paliwal
Nov 23 '18 at 13:14
see the following i think this is exactly what you need magento.stackexchange.com/questions/263675/…
– iqbal malik
30 mins ago
see the following i think this is exactly what you need magento.stackexchange.com/questions/263675/…
– iqbal malik
30 mins ago
add a comment |
1 Answer
1
active
oldest
votes
Create Extension and your setup file below
here
customer=>namespace & Attribute=>Extension name
namespace CustomerAttributeSetup;
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,
'dropdown',
[
'label' => 'Radio Button',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'int',
'input' => 'select',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'dropdown')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'checkout_register', 'customer_account_create', 'customer_account_edit', 'adminhtml_checkout']) -> save();
$customerSetup -> addAttribute(MagentoCustomerModelCustomer::ENTITY,
'multiple',
[
'label' => 'Multiple',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'multiple')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'checkout_register', 'customer_account_create', 'customer_account_edit', 'adminhtml_checkout']) -> save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
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%2f251031%2fmagento-2-2-x-how-to-create-customer-radio-and-checkbox-button-attribute%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
Create Extension and your setup file below
here
customer=>namespace & Attribute=>Extension name
namespace CustomerAttributeSetup;
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,
'dropdown',
[
'label' => 'Radio Button',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'int',
'input' => 'select',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'dropdown')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'checkout_register', 'customer_account_create', 'customer_account_edit', 'adminhtml_checkout']) -> save();
$customerSetup -> addAttribute(MagentoCustomerModelCustomer::ENTITY,
'multiple',
[
'label' => 'Multiple',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'multiple')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'checkout_register', 'customer_account_create', 'customer_account_edit', 'adminhtml_checkout']) -> save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
add a comment |
Create Extension and your setup file below
here
customer=>namespace & Attribute=>Extension name
namespace CustomerAttributeSetup;
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,
'dropdown',
[
'label' => 'Radio Button',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'int',
'input' => 'select',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'dropdown')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'checkout_register', 'customer_account_create', 'customer_account_edit', 'adminhtml_checkout']) -> save();
$customerSetup -> addAttribute(MagentoCustomerModelCustomer::ENTITY,
'multiple',
[
'label' => 'Multiple',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'multiple')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'checkout_register', 'customer_account_create', 'customer_account_edit', 'adminhtml_checkout']) -> save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
add a comment |
Create Extension and your setup file below
here
customer=>namespace & Attribute=>Extension name
namespace CustomerAttributeSetup;
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,
'dropdown',
[
'label' => 'Radio Button',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'int',
'input' => 'select',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'dropdown')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'checkout_register', 'customer_account_create', 'customer_account_edit', 'adminhtml_checkout']) -> save();
$customerSetup -> addAttribute(MagentoCustomerModelCustomer::ENTITY,
'multiple',
[
'label' => 'Multiple',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'multiple')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'checkout_register', 'customer_account_create', 'customer_account_edit', 'adminhtml_checkout']) -> save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
Create Extension and your setup file below
here
customer=>namespace & Attribute=>Extension name
namespace CustomerAttributeSetup;
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,
'dropdown',
[
'label' => 'Radio Button',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'int',
'input' => 'select',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'dropdown')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'checkout_register', 'customer_account_create', 'customer_account_edit', 'adminhtml_checkout']) -> save();
$customerSetup -> addAttribute(MagentoCustomerModelCustomer::ENTITY,
'multiple',
[
'label' => 'Multiple',
'system' => 0,
'position' => 100,
'sort_order' =>100,
'visible' => true,
'note' => '',
'type' => 'varchar',
'input' => 'multiselect',
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
'backend' => 'MagentoEavModelEntityAttributeBackendArrayBackend',
]
);
$customerSetup -> getEavConfig() -> getAttribute('customer', 'multiple')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'checkout_register', 'customer_account_create', 'customer_account_edit', 'adminhtml_checkout']) -> save();
}
public function installCustomerAddressAttributes($customerSetup) {
}
public function getEavConfig() {
return $this -> eavConfig;
}
}
edited 34 mins ago
Ketan Borada
341738
341738
answered Jan 2 at 13:04
Rakesh DongaRakesh Donga
1,278316
1,278316
add a comment |
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%2f251031%2fmagento-2-2-x-how-to-create-customer-radio-and-checkbox-button-attribute%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
If you are trying to add attribute via install/upgrade data script then you can add value for "input" to required type. It could be 'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' give a try and let me know if it helps..
– Himmat Paliwal
Nov 23 '18 at 6:54
'input' => 'image', 'input' => 'text','input' => 'radio', 'input' => 'checkbox' it's not working
– Ajithkumar
Nov 23 '18 at 10:23
I had a check and found that 'input'=>'boollean' is also creating a checkbox but some additional css added by magento team to get customized look. You can overwrite that css for your particular pages in case..
– Himmat Paliwal
Nov 23 '18 at 13:14
see the following i think this is exactly what you need magento.stackexchange.com/questions/263675/…
– iqbal malik
30 mins ago