Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Customer
_files
attribute_user_defined_address_custom_attribute.php
Go to the documentation of this file.
1
<?php
7
$model
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(\
Magento
\Customer\Model\Attribute::class);
8
$model
->setName(
9
'custom_attribute1'
10
)->setEntityTypeId(
11
2
12
)->setAttributeSetId(
13
2
14
)->setAttributeGroupId(
15
1
16
)->setFrontendInput(
17
'text'
18
)->setFrontendLabel(
19
'custom_attribute_frontend_label'
20
)->setIsUserDefined(
21
1
22
);
23
$model
->save();
24
25
$model2
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(\
Magento
\Customer\Model\Attribute::class);
26
$model2
->setName(
27
'custom_attribute2'
28
)->setEntityTypeId(
29
2
30
)->setAttributeSetId(
31
2
32
)->setAttributeGroupId(
33
1
34
)->setFrontendInput(
35
'text'
36
)->setFrontendLabel(
37
'custom_attribute_frontend_label'
38
)->setIsUserDefined(
39
1
40
);
41
$model2
->save();
42
44
$setupResource
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
45
\
Magento
\Customer\Setup\CustomerSetup::class
46
);
47
48
$data
= [[
'form_code'
=>
'customer_address_edit'
,
'attribute_id'
=>
$model
->getAttributeId()]];
49
$setupResource
->getSetup()->getConnection()->insertMultiple(
50
$setupResource
->getSetup()->getTable(
'customer_form_attribute'
),
51
$data
52
);
53
54
$data2
= [[
'form_code'
=>
'customer_address_edit'
,
'attribute_id'
=>
$model2
->getAttributeId()]];
55
$setupResource
->getSetup()->getConnection()->insertMultiple(
56
$setupResource
->getSetup()->getTable(
'customer_form_attribute'
),
57
$data2
58
);
$setupResource
$setupResource
Definition:
attribute_user_defined_address_custom_attribute.php:44
$model
$model
Definition:
attribute_user_defined_address_custom_attribute.php:7
$data2
$data2
Definition:
attribute_user_defined_address_custom_attribute.php:54
$data
$data
Definition:
attribute_user_defined_address_custom_attribute.php:48
$model2
$model2
Definition:
attribute_user_defined_address_custom_attribute.php:25
Magento
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125