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
module-catalog
Model
Product
TypeTransitionManager.php
Go to the documentation of this file.
1
<?php
9
namespace
Magento\Catalog\Model\Product
;
10
11
use
Magento\Catalog\Model\Product
;
12
use
Magento\Catalog\Model\Product\Type
;
13
14
class
TypeTransitionManager
15
{
21
protected
$compatibleTypes
;
22
26
protected
$weightResolver
;
27
32
public
function
__construct
(
33
\
Magento
\Catalog\Model\
Product
\Edit\WeightResolver
$weightResolver
,
34
array
$compatibleTypes
35
) {
36
$this->compatibleTypes =
$compatibleTypes
;
37
$this->weightResolver =
$weightResolver
;
38
}
39
46
public
function
processProduct
(
Product
$product
)
47
{
48
if
(in_array(
$product
->getTypeId(),
$this->compatibleTypes
)) {
49
$product
->setTypeInstance(
null
);
50
$productTypeId = $this->weightResolver->resolveProductHasWeight(
$product
)
51
?
Type::TYPE_SIMPLE
52
:
Type::TYPE_VIRTUAL
;
53
$product
->setTypeId($productTypeId);
54
}
55
}
56
}
Magento\Catalog\Model\Product\Type\TYPE_SIMPLE
const TYPE_SIMPLE
Definition:
Type.php:22
Magento\Catalog\Model\Product\TypeTransitionManager\$weightResolver
$weightResolver
Definition:
TypeTransitionManager.php:26
Magento\Catalog\Model\Product\TypeTransitionManager\processProduct
processProduct(Product $product)
Definition:
TypeTransitionManager.php:46
Magento\Catalog\Model\Product
Definition:
Product.php:42
Magento\Catalog\Model\Product\TypeTransitionManager\__construct
__construct(\Magento\Catalog\Model\Product\Edit\WeightResolver $weightResolver, array $compatibleTypes)
Definition:
TypeTransitionManager.php:32
Magento\Catalog\Model\Product
Definition:
ActionTest.php:6
Magento
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Catalog\Model\Product\Type\TYPE_VIRTUAL
const TYPE_VIRTUAL
Definition:
Type.php:26
Magento\Catalog\Model\Product\TypeTransitionManager\$compatibleTypes
$compatibleTypes
Definition:
TypeTransitionManager.php:21
Magento\Catalog\Model\Product\TypeTransitionManager
Definition:
TypeTransitionManager.php:14
Magento\Catalog\Model\Product\Type
Definition:
AbstractTypeTest.php:7