File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
app/code/Magento/Catalog/Helper/Product Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,11 @@ class ProductList
29
29
* @var \Magento\Framework\App\Config\ScopeConfigInterface
30
30
*/
31
31
protected $ scopeConfig ;
32
- protected $ coreRegistry ;
32
+
33
+ /**
34
+ * @var \Magento\Framework\Registry
35
+ */
36
+ private $ coreRegistry ;
33
37
34
38
/**
35
39
* Default limits per page
@@ -43,10 +47,10 @@ class ProductList
43
47
*/
44
48
public function __construct (
45
49
\Magento \Framework \App \Config \ScopeConfigInterface $ scopeConfig ,
46
- \Magento \Framework \Registry $ coreRegistry
50
+ \Magento \Framework \Registry $ coreRegistry = null
47
51
) {
48
52
$ this ->scopeConfig = $ scopeConfig ;
49
- $ this ->coreRegistry = $ coreRegistry ;
53
+ $ this ->coreRegistry = $ coreRegistry ?: \ Magento \ Framework \ App \ObjectManager:: getInstance ()-> get (\ Magento \ Framework \Registry::class) ;
50
54
}
51
55
52
56
/**
@@ -102,8 +106,7 @@ public function getDefaultSortField()
102
106
{
103
107
$ currentCategory = $ this ->coreRegistry ->registry ('current_category ' );
104
108
if ($ currentCategory ) {
105
- $ currentCategorySortBy = $ currentCategory ->getDefaultSortBy ();
106
- return $ currentCategorySortBy ;
109
+ return $ currentCategory ->getDefaultSortBy ();
107
110
}
108
111
109
112
return $ this ->scopeConfig ->getValue (
You can’t perform that action at this time.
0 commit comments