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-swatches
Model
Plugin
Configurable.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Swatches\Model\Plugin
;
7
8
use
Magento\Catalog\Api\Data\ProductInterface
;
9
use
Magento\ConfigurableProduct\Model\Product\Type\Configurable
as
ConfigurableProductType
;
10
use
Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\Collection
;
11
12
class
Configurable
13
{
17
private
$eavConfig
;
18
22
private
$swatchHelper;
23
28
public
function
__construct
(
29
\
Magento
\Eav\Model\
Config
$eavConfig
,
30
\
Magento
\Swatches\Helper\
Data
$swatchHelper
31
) {
32
$this->eavConfig =
$eavConfig
;
33
$this->swatchHelper = $swatchHelper;
34
}
35
44
public
function
afterGetUsedProductCollection
(
45
ConfigurableProductType
$subject,
46
Collection
$result
,
47
ProductInterface
$product
48
) {
49
$swatchAttributes = [
'image'
];
50
foreach
($subject->getUsedProductAttributes(
$product
) as
$code
=>
$attribute
) {
51
if
(
$attribute
->getData(
'additional_data'
)
52
&& (
53
$this->swatchHelper->isVisualSwatch(
$attribute
) || $this->swatchHelper->isTextSwatch(
$attribute
)
54
)
55
) {
56
$swatchAttributes[] =
$code
;
57
}
58
}
59
$result
->addAttributeToSelect($swatchAttributes);
60
return
$result
;
61
}
62
}
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
$attribute
$attribute
Definition:
attribute_set_with_image_attribute.php:41
$eavConfig
$eavConfig
Definition:
configurable_attribute.php:10
Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\Collection
Definition:
Collection.php:17
Magento\Swatches\Model\Plugin
Definition:
Configurable.php:6
Magento\ConfigurableProduct\Model\Product\Type\Configurable
Definition:
AttributeTest.php:6
Magento
Magento\Swatches\Model\Plugin\Configurable\__construct
__construct(\Magento\Eav\Model\Config $eavConfig, \Magento\Swatches\Helper\Data $swatchHelper)
Definition:
Configurable.php:28
Magento\Catalog\Model\ResourceModel\Product\Link\Collection
Definition:
Collection.php:15
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\ConfigurableProduct\Model\Product\Type\Configurable
Definition:
Configurable.php:30
Magento\Swatches\Helper\Data
Definition:
Data.php:30
Magento\Framework\App\ResourceConnection\Config
Definition:
Config.php:14
Magento\Swatches\Model\Plugin\Configurable\afterGetUsedProductCollection
afterGetUsedProductCollection(ConfigurableProductType $subject, Collection $result, ProductInterface $product)
Definition:
Configurable.php:44
Magento\Catalog\Api\Data\ProductInterface
Definition:
ProductInterface.php:14
$code
$code
Definition:
info.phtml:12