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
Category
Attribute
Source
Sortby.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Catalog\Model\Category\Attribute\Source
;
7
13
class
Sortby
extends
\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
14
{
20
protected
$_catalogConfig
;
21
27
public
function
__construct
(\
Magento
\Catalog\Model\
Config
$catalogConfig)
28
{
29
$this->_catalogConfig = $catalogConfig;
30
}
31
37
protected
function
_getCatalogConfig
()
38
{
39
return
$this->_catalogConfig
;
40
}
41
45
public
function
getAllOptions
()
46
{
47
if
($this->_options ===
null
) {
48
$this->_options = [[
'label'
=>
__
(
'Position'
),
'value'
=>
'position'
]];
49
foreach
($this->
_getCatalogConfig
()->getAttributesUsedForSortBy() as
$attribute
) {
50
$this->_options[] = [
51
'label'
=>
__
(
$attribute
[
'frontend_label'
]),
52
'value'
=>
$attribute
[
'attribute_code'
],
53
];
54
}
55
}
56
return
$this->_options
;
57
}
58
}
Magento\Eav\Model\Entity\Attribute\Source\AbstractSource\$_options
$_options
Definition:
AbstractSource.php:32
$attribute
$attribute
Definition:
attribute_set_with_image_attribute.php:41
Magento\Catalog\Model\Category\Attribute\Source\Sortby\_getCatalogConfig
_getCatalogConfig()
Definition:
Sortby.php:37
Magento\Catalog\Model\Category\Attribute\Source\Sortby\$_catalogConfig
$_catalogConfig
Definition:
Sortby.php:20
__
__()
Definition:
__.php:13
Magento\Catalog\Model\Category\Attribute\Source
Definition:
Layout.php:6
Magento\Catalog\Model\Category\Attribute\Source\Sortby\getAllOptions
getAllOptions()
Definition:
Sortby.php:45
Magento
Magento\Catalog\Model\Category\Attribute\Source\Sortby\__construct
__construct(\Magento\Catalog\Model\Config $catalogConfig)
Definition:
Sortby.php:27
Magento\Catalog\Model\Category\Attribute\Source\Sortby
Definition:
Sortby.php:13
Magento\Eav\Model\Config
Definition:
Config.php:18