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
AttributesList.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Swatches\Model
;
7
8
use
Magento\ConfigurableProduct\Model\AttributesListInterface
;
9
14
class
AttributesList
implements
AttributesListInterface
15
{
19
protected
$collectionFactory
;
20
24
protected
$dataHelper
;
25
30
public
function
__construct
(
31
\
Magento
\Catalog\Model\
ResourceModel
\
Product
\
Attribute
\CollectionFactory
$collectionFactory
,
32
\
Magento
\Swatches\Helper\Data
$dataHelper
33
) {
34
$this->collectionFactory =
$collectionFactory
;
35
$this->dataHelper =
$dataHelper
;
36
}
37
44
public
function
getAttributes
($ids)
45
{
46
$collection
= $this->collectionFactory->create();
47
$collection
->addFieldToFilter(
'main_table.attribute_id'
, $ids);
48
$attributes
= [];
49
foreach
(
$collection
->getItems() as
$attribute
) {
50
$attributes
[] = [
51
'id'
=>
$attribute
->getId(),
52
'label'
=>
$attribute
->getFrontendLabel(),
53
'code'
=>
$attribute
->getAttributeCode(),
54
'options'
=>
$attribute
->getSource()->getAllOptions(
false
),
55
'canCreateOption'
=> !$this->dataHelper->isSwatchAttribute(
$attribute
),
56
];
57
}
58
return
$attributes
;
59
}
60
}
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
Magento\Swatches\Model\AttributesList\__construct
__construct(\Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $collectionFactory, \Magento\Swatches\Helper\Data $dataHelper)
Definition:
AttributesList.php:30
$attribute
$attribute
Definition:
attribute_set_with_image_attribute.php:41
Magento\Swatches\Model\AttributesList\$collectionFactory
$collectionFactory
Definition:
AttributesList.php:19
Magento\Swatches\Model\AttributesList\$dataHelper
$dataHelper
Definition:
AttributesList.php:24
Magento\Swatches\Model\AttributesList
Definition:
AttributesList.php:14
Magento\Swatches\Model\AttributesList\getAttributes
getAttributes($ids)
Definition:
AttributesList.php:44
Magento\Catalog\Model\Product
Definition:
Product.php:42
Magento
$attributes
$attributes
Definition:
matrix.phtml:13
Magento\Swatches\Model
Definition:
AttributeCreateTest.php:6
Magento\ConfigurableProduct\Model\AttributesListInterface
Definition:
AttributesListInterface.php:12
Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute
Definition:
Attribute.php:18
$collection
$collection
Definition:
catalog_category_with_apostrophe_rollback.php:17