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
customer_non_default_website_id.php
Go to the documentation of this file.
1
<?php
12
$website
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(\
Magento
\Store\Model\Website::class);
13
$website
->setName(
'new Website'
)->setCode(
'newwebsite'
)->save();
14
15
$websiteId
=
$website
->getId();
16
$storeManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()
17
->get(\
Magento
\Store\Model\StoreManager::class);
18
$storeManager
->reinitStores();
19
$customer
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
20
\
Magento
\Customer\Model\Customer::class
21
);
23
$customer
->setWebsiteId(
24
$websiteId
25
)->setId(
26
1
27
)->setEntityTypeId(
28
1
29
)->setAttributeSetId(
30
1
31
)->setEmail(
32
'
[email protected]
'
33
)->setPassword(
34
'password'
35
)->setGroupId(
36
1
37
)->setStoreId(
38
$website
->getStoreId()
39
)->setIsActive(
40
1
41
)->setFirstname(
42
'Firstname'
43
)->setLastname(
44
'Lastname'
45
)->setDefaultBilling(
46
1
47
)->setDefaultShipping(
48
1
49
);
50
$customer
->isObjectNew(
true
);
51
53
$addressOne
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
54
\
Magento
\Customer\Model\Address::class
55
);
56
$addressOneData
= [
57
'firstname'
=>
'Firstname'
,
58
'lastname'
=>
'LastName'
,
59
'street'
=> [
'test street'
],
60
'city'
=>
'test city'
,
61
'country_id'
=>
'US'
,
62
'postcode'
=>
'01001'
,
63
'telephone'
=>
'+7000000001'
,
64
'entity_id'
=> 1,
65
];
66
$addressOne
->setData(
$addressOneData
);
67
$customer
->addAddress(
$addressOne
);
68
70
$addressTwo
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
71
\
Magento
\Customer\Model\Address::class
72
);
73
$addressTwoData
= [
74
'firstname'
=>
'test firstname'
,
75
'lastname'
=>
'test lastname'
,
76
'street'
=> [
'test street'
],
77
'city'
=>
'test city'
,
78
'country_id'
=>
'US'
,
79
'postcode'
=>
'01001'
,
80
'telephone'
=>
'+7000000001'
,
81
'entity_id'
=> 2,
82
];
83
$addressTwo
->setData(
$addressTwoData
);
84
$customer
->addAddress(
$addressTwo
);
85
87
$addressThree
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
88
\
Magento
\Customer\Model\Address::class
89
);
90
$addressThreeData
= [
91
'firstname'
=>
'removed firstname'
,
92
'lastname'
=>
'removed lastname'
,
93
'street'
=> [
'removed street'
],
94
'city'
=>
'removed city'
,
95
'country_id'
=>
'US'
,
96
'postcode'
=>
'01001'
,
97
'telephone'
=>
'+7000000001'
,
98
'entity_id'
=> 3,
99
];
100
$addressThree
->setData(
$addressThreeData
);
101
$customer
->addAddress(
$addressThree
);
102
$customer
->save();
$storeManager
$storeManager
Definition:
customer_non_default_website_id.php:16
$addressThreeData
$addressThreeData
Definition:
customer_non_default_website_id.php:90
$addressTwoData
$addressTwoData
Definition:
customer_non_default_website_id.php:73
$customer
$customer
Definition:
customer_non_default_website_id.php:19
Magento
$addressTwo
$addressTwo
Definition:
customer_non_default_website_id.php:70
$addressThree
$addressThree
Definition:
customer_non_default_website_id.php:87
$website
$website
Definition:
customer_non_default_website_id.php:12
$addressOne
$addressOne
Definition:
customer_non_default_website_id.php:53
$websiteId
$websiteId
Definition:
customer_non_default_website_id.php:15
$addressOneData
$addressOneData
Definition:
customer_non_default_website_id.php:56
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125