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
Eav
_files
attribute_group_for_search.php
Go to the documentation of this file.
1
<?php
7
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
8
12
$entityTypeId
=
$objectManager
->create(\
Magento
\Eav\Model\Entity\Type::class)
13
->loadByCode(
'catalog_product'
)
14
->getId();
15
17
$attributeSet
=
$objectManager
->create(\
Magento
\Eav\Model\Entity\Attribute\Set::class);
18
$attributeSet
->setData([
19
'attribute_set_name'
=>
'attribute_set_1_for_search'
,
20
'entity_type_id'
=>
$entityTypeId
,
21
'sort_order'
=> 100,
22
]);
23
$attributeSet
->validate();
24
$attributeSet
->save();
25
29
$attributeGroupData
= [
30
[
31
'attribute_set_id'
=>
$attributeSet
->getAttributeSetId(),
32
'sort_order'
=> 10,
33
'attribute_group_code'
=>
'attribute_group_1_for_search'
,
34
'default_id'
=> 1,
35
],
36
[
37
'attribute_set_id'
=>
$attributeSet
->getAttributeSetId(),
38
'sort_order'
=> 20,
39
'attribute_group_code'
=>
'attribute_group_2_for_search'
,
40
'default_id'
=> 0,
41
],
42
[
43
'attribute_set_id'
=>
$attributeSet
->getAttributeSetId(),
44
'sort_order'
=> 30,
45
'attribute_group_code'
=>
'attribute_group_3_for_search'
,
46
'default_id'
=> 0,
47
],
48
];
49
50
foreach
(
$attributeGroupData
as
$data
) {
52
$attributeGroup
=
$objectManager
->create(\
Magento
\Eav\Model\Entity\Attribute\Group::class);
53
$attributeGroup
->setData(
$data
);
54
$attributeGroup
->save();
55
}
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$attributeGroupData
$attributeGroupData
Definition:
attribute_group_for_search.php:29
Magento
$attributeSet
$attributeSet
Definition:
attribute_group_for_search.php:17
$entityTypeId
$entityTypeId
Definition:
attribute_group_for_search.php:12
$objectManager
$objectManager
Definition:
attribute_group_for_search.php:7
$attributeGroup
$attributeGroup
Definition:
attribute_set_with_renamed_group.php:40
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125