how to create new backend_type like int ,decimal,datetime?How to create a new “Input Validation for Store Owner” option for attribute?Adding custom attribute to customer registration formCreate new customer attributesave order attributehow can I create a new admin page in magento2?Create new table with upgrade scripts in custom moduleConvert Price into Reward pointsHow to retrieve reward point amount for order using REST API in Magento 2How to add new field to Admin User Info in Magento 2?Display Reward Points on Product Page in Magento 2 EE
How to coordinate airplane tickets?
What is an equivalently powerful replacement spell for the Yuan-Ti's Suggestion spell?
How to find if SQL server backup is encrypted with TDE without restoring the backup
How to stretch the corners of this image so that it looks like a perfect rectangle?
Send out email when Apex Queueable fails and test it
How to travel to Japan while expressing milk?
Are British MPs missing the point, with these 'Indicative Votes'?
How obscure is the use of 令 in 令和?
Unlock My Phone! February 2018
How badly should I try to prevent a user from XSSing themselves?
Is "/bin/[.exe" a legitimate file? [Cygwin, Windows 10]
What historical events would have to change in order to make 19th century "steampunk" technology possible?
Why was Sir Cadogan fired?
Did 'Cinema Songs' exist during Hiranyakshipu's time?
How to compactly explain secondary and tertiary characters without resorting to stereotypes?
Is it "common practice in Fourier transform spectroscopy to multiply the measured interferogram by an apodizing function"? If so, why?
Is it possible to map the firing of neurons in the human brain so as to stimulate artificial memories in someone else?
What exactly is ineptocracy?
How to install cross-compiler on Ubuntu 18.04?
How seriously should I take size and weight limits of hand luggage?
How do I exit BASH while loop using modulus operator?
Finitely generated matrix groups whose eigenvalues are all algebraic
Getting extremely large arrows with tikzcd
Is there a hemisphere-neutral way of specifying a season?
how to create new backend_type like int ,decimal,datetime?
How to create a new “Input Validation for Store Owner” option for attribute?Adding custom attribute to customer registration formCreate new customer attributesave order attributehow can I create a new admin page in magento2?Create new table with upgrade scripts in custom moduleConvert Price into Reward pointsHow to retrieve reward point amount for order using REST API in Magento 2How to add new field to Admin User Info in Magento 2?Display Reward Points on Product Page in Magento 2 EE
I have seen Magento enterprise reward points module created new backend_type integer for following fields in eav_attribute
table.reward_points_balance_refunded
,reward_salesrule_points
.
How we can create new backend_type
and store into that particular table
magento2 attributes
New contributor
add a comment |
I have seen Magento enterprise reward points module created new backend_type integer for following fields in eav_attribute
table.reward_points_balance_refunded
,reward_salesrule_points
.
How we can create new backend_type
and store into that particular table
magento2 attributes
New contributor
add a comment |
I have seen Magento enterprise reward points module created new backend_type integer for following fields in eav_attribute
table.reward_points_balance_refunded
,reward_salesrule_points
.
How we can create new backend_type
and store into that particular table
magento2 attributes
New contributor
I have seen Magento enterprise reward points module created new backend_type integer for following fields in eav_attribute
table.reward_points_balance_refunded
,reward_salesrule_points
.
How we can create new backend_type
and store into that particular table
magento2 attributes
magento2 attributes
New contributor
New contributor
edited 17 hours ago
Raj Mohan R
1787
1787
New contributor
asked 17 hours ago
Siva KoduruSiva Koduru
1
1
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Two samples here using InstallData script
, you can add an attribute during or upon installation of your custom module.
Adding Product Attribute
<?php
namespace vendormoduleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'sample_attribute',
[
'type' => 'text',
'backend' => '',
'frontend' => '',
'label' => 'Sample Atrribute',
'input' => 'text',
'class' => '',
'source' => '',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => ''
]
);
Adding Customer Attribute
<?php
namespace vendormoduleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelConfig;
use MagentoCustomerModelCustomer;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory, Config $eavConfig)
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCustomerModelCustomer::ENTITY,
'sample_attribute',
[
'type' => 'varchar',
'label' => 'Sample Attribute',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'position' => 999,
'system' => 0,
]
);
$sampleAttribute = $this->eavConfig->getAttribute(Customer::ENTITY, 'sample_attribute');
// more used_in_forms ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address']
$sampleAttribute->setData(
'used_in_forms',
['adminhtml_customer']
);
$sampleAttribute->save();
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
);
);
Siva Koduru is a new contributor. Be nice, and check out our Code of Conduct.
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%2f268306%2fhow-to-create-new-backend-type-like-int-decimal-datetime%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
Two samples here using InstallData script
, you can add an attribute during or upon installation of your custom module.
Adding Product Attribute
<?php
namespace vendormoduleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'sample_attribute',
[
'type' => 'text',
'backend' => '',
'frontend' => '',
'label' => 'Sample Atrribute',
'input' => 'text',
'class' => '',
'source' => '',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => ''
]
);
Adding Customer Attribute
<?php
namespace vendormoduleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelConfig;
use MagentoCustomerModelCustomer;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory, Config $eavConfig)
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCustomerModelCustomer::ENTITY,
'sample_attribute',
[
'type' => 'varchar',
'label' => 'Sample Attribute',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'position' => 999,
'system' => 0,
]
);
$sampleAttribute = $this->eavConfig->getAttribute(Customer::ENTITY, 'sample_attribute');
// more used_in_forms ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address']
$sampleAttribute->setData(
'used_in_forms',
['adminhtml_customer']
);
$sampleAttribute->save();
add a comment |
Two samples here using InstallData script
, you can add an attribute during or upon installation of your custom module.
Adding Product Attribute
<?php
namespace vendormoduleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'sample_attribute',
[
'type' => 'text',
'backend' => '',
'frontend' => '',
'label' => 'Sample Atrribute',
'input' => 'text',
'class' => '',
'source' => '',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => ''
]
);
Adding Customer Attribute
<?php
namespace vendormoduleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelConfig;
use MagentoCustomerModelCustomer;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory, Config $eavConfig)
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCustomerModelCustomer::ENTITY,
'sample_attribute',
[
'type' => 'varchar',
'label' => 'Sample Attribute',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'position' => 999,
'system' => 0,
]
);
$sampleAttribute = $this->eavConfig->getAttribute(Customer::ENTITY, 'sample_attribute');
// more used_in_forms ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address']
$sampleAttribute->setData(
'used_in_forms',
['adminhtml_customer']
);
$sampleAttribute->save();
add a comment |
Two samples here using InstallData script
, you can add an attribute during or upon installation of your custom module.
Adding Product Attribute
<?php
namespace vendormoduleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'sample_attribute',
[
'type' => 'text',
'backend' => '',
'frontend' => '',
'label' => 'Sample Atrribute',
'input' => 'text',
'class' => '',
'source' => '',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => ''
]
);
Adding Customer Attribute
<?php
namespace vendormoduleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelConfig;
use MagentoCustomerModelCustomer;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory, Config $eavConfig)
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCustomerModelCustomer::ENTITY,
'sample_attribute',
[
'type' => 'varchar',
'label' => 'Sample Attribute',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'position' => 999,
'system' => 0,
]
);
$sampleAttribute = $this->eavConfig->getAttribute(Customer::ENTITY, 'sample_attribute');
// more used_in_forms ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address']
$sampleAttribute->setData(
'used_in_forms',
['adminhtml_customer']
);
$sampleAttribute->save();
Two samples here using InstallData script
, you can add an attribute during or upon installation of your custom module.
Adding Product Attribute
<?php
namespace vendormoduleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
$this->eavSetupFactory = $eavSetupFactory;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'sample_attribute',
[
'type' => 'text',
'backend' => '',
'frontend' => '',
'label' => 'Sample Atrribute',
'input' => 'text',
'class' => '',
'source' => '',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => ''
]
);
Adding Customer Attribute
<?php
namespace vendormoduleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoEavModelConfig;
use MagentoCustomerModelCustomer;
class InstallData implements InstallDataInterface
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory, Config $eavConfig)
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCustomerModelCustomer::ENTITY,
'sample_attribute',
[
'type' => 'varchar',
'label' => 'Sample Attribute',
'input' => 'text',
'required' => false,
'visible' => true,
'user_defined' => true,
'position' => 999,
'system' => 0,
]
);
$sampleAttribute = $this->eavConfig->getAttribute(Customer::ENTITY, 'sample_attribute');
// more used_in_forms ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address']
$sampleAttribute->setData(
'used_in_forms',
['adminhtml_customer']
);
$sampleAttribute->save();
answered 17 hours ago
magefmsmagefms
2,2302426
2,2302426
add a comment |
add a comment |
Siva Koduru is a new contributor. Be nice, and check out our Code of Conduct.
Siva Koduru is a new contributor. Be nice, and check out our Code of Conduct.
Siva Koduru is a new contributor. Be nice, and check out our Code of Conduct.
Siva Koduru is a new contributor. Be nice, and check out our Code of Conduct.
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%2f268306%2fhow-to-create-new-backend-type-like-int-decimal-datetime%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