@@ -90,6 +90,13 @@ class ProductDataMapper implements BatchDataMapperInterface
90
90
*/
91
91
private $ filterableAttributeTypes ;
92
92
93
+ /**
94
+ * @var string[]
95
+ */
96
+ private $ sortableCaseSensitiveAttributes = [
97
+ 'name ' ,
98
+ ];
99
+
93
100
/**
94
101
* @param Builder $builder
95
102
* @param FieldMapperInterface $fieldMapper
@@ -99,6 +106,7 @@ class ProductDataMapper implements BatchDataMapperInterface
99
106
* @param array $excludedAttributes
100
107
* @param array $sortableAttributesValuesToImplode
101
108
* @param array $filterableAttributeTypes
109
+ * @param array $sortableCaseSensitiveAttributes
102
110
*/
103
111
public function __construct (
104
112
Builder $ builder ,
@@ -108,7 +116,8 @@ public function __construct(
108
116
DataProvider $ dataProvider ,
109
117
array $ excludedAttributes = [],
110
118
array $ sortableAttributesValuesToImplode = [],
111
- array $ filterableAttributeTypes = []
119
+ array $ filterableAttributeTypes = [],
120
+ array $ sortableCaseSensitiveAttributes = []
112
121
) {
113
122
$ this ->builder = $ builder ;
114
123
$ this ->fieldMapper = $ fieldMapper ;
@@ -122,6 +131,10 @@ public function __construct(
122
131
$ this ->dataProvider = $ dataProvider ;
123
132
$ this ->attributeOptionsCache = [];
124
133
$ this ->filterableAttributeTypes = $ filterableAttributeTypes ;
134
+ $ this ->sortableCaseSensitiveAttributes = array_merge (
135
+ $ this ->sortableCaseSensitiveAttributes ,
136
+ $ sortableCaseSensitiveAttributes
137
+ );
125
138
}
126
139
127
140
/**
@@ -298,6 +311,12 @@ function (string $valueId) {
298
311
$ attributeValues = [$ productId => implode (' ' , $ attributeValues )];
299
312
}
300
313
314
+ if (in_array ($ attribute ->getAttributeCode (), $ this ->sortableCaseSensitiveAttributes )) {
315
+ foreach ($ attributeValues as $ key => $ attributeValue ) {
316
+ $ attributeValues [$ key ] = strtolower ($ attributeValue );
317
+ }
318
+ }
319
+
301
320
return $ attributeValues ;
302
321
}
303
322
0 commit comments