File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ private function addFilterGroupToCollection(
85
85
}
86
86
}
87
87
88
+ $ this ->checkFromTo ($ fields , $ conditions );
89
+
88
90
if ($ fields ) {
89
91
$ collection ->addFieldToFilter ($ fields , $ conditions );
90
92
}
@@ -125,4 +127,26 @@ private function getFieldMapping($field)
125
127
{
126
128
return $ this ->fieldMapping [$ field ] ?? $ field ;
127
129
}
130
+
131
+ /**
132
+ * Check filtergoup for type from & to
133
+ *
134
+ * @param string[] $fields
135
+ * @param array<string[]> $conditions
136
+ * @return void
137
+ */
138
+ private function checkFromTo (&$ fields , &$ conditions )
139
+ {
140
+ $ _fields = array_unique ($ fields );
141
+ $ _conditions = [];
142
+ foreach ($ conditions as $ condition ) {
143
+ $ _conditions [array_key_first ($ condition )] = array_first ($ condition );
144
+ }
145
+ if ((count ($ _fields ) == 1 ) && (count ($ _conditions ) == 2 )
146
+ && isset ($ _conditions ['from ' ]) && isset ($ _conditions ['to ' ])
147
+ ) {
148
+ $ fields = $ _fields ;
149
+ $ conditions = [$ _conditions ];
150
+ }
151
+ }
128
152
}
You can’t perform that action at this time.
0 commit comments