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
Weee
_files
fixed_product_attribute.php
Go to the documentation of this file.
1
<?php
7
declare(strict_types=1);
8
9
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
10
12
$attributeSet
=
$objectManager
->create(\
Magento
\Eav\Model\Entity\Attribute\Set::class);
13
14
$entityType
=
$objectManager
->create(\
Magento
\Eav\Model\Entity\Type::class)->loadByCode(
'catalog_product'
);
15
$defaultSetId
=
$objectManager
->create(\
Magento
\Catalog\Model\Product::class)->getDefaultAttributeSetid();
16
17
$attributeGroupId
=
$attributeSet
->getDefaultGroupId(
$entityType
->getDefaultAttributeSetId());
18
19
$attributeData
= [
20
'entity_type_id'
=>
$entityType
->getId(),
21
'attribute_code'
=>
'fixed_product_attribute'
,
22
'backend_model'
=>
'Magento\Weee\Model\Attribute\Backend\Weee\Tax'
,
23
'is_required'
=> 0,
24
'is_user_defined'
=> 1,
25
'is_static'
=> 1,
26
'attribute_set_id'
=>
$defaultSetId
,
27
'attribute_group_id'
=>
$attributeGroupId
,
28
];
29
31
$attribute
=
$objectManager
->create(\
Magento
\Eav\Model\Entity\Attribute::class);
32
$attribute
->setData(
$attributeData
);
33
$attribute
->save();
$attributeGroupId
$attributeGroupId
Definition:
fixed_product_attribute.php:17
$entityType
$entityType
Definition:
fixed_product_attribute.php:14
Magento
$attribute
$attribute
Definition:
fixed_product_attribute.php:31
$attributeSet
$attributeSet
Definition:
fixed_product_attribute.php:12
$defaultSetId
$defaultSetId
Definition:
fixed_product_attribute.php:15
$objectManager
$objectManager
Definition:
fixed_product_attribute.php:9
$attributeData
$attributeData
Definition:
fixed_product_attribute.php:19
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125