File tree 2 files changed +22
-2
lines changed
Catalog/Model/ResourceModel/Eav
CatalogWidget/Model/Rule/Condition
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,17 @@ public function afterSave()
230
230
return parent ::afterSave ();
231
231
}
232
232
233
+ /**
234
+ * Is attribute enabled for flat indexing
235
+ *
236
+ * @return bool
237
+ */
238
+ public function isEnabledInFlat ()
239
+ {
240
+ return $ this ->_isEnabledInFlat ();
241
+ }
242
+
243
+
233
244
/**
234
245
* Is attribute enabled for flat indexing
235
246
*
Original file line number Diff line number Diff line change @@ -119,8 +119,17 @@ public function addToCollection($collection)
119
119
$ attribute = $ this ->getAttributeObject ();
120
120
121
121
if ($ collection ->isEnabledFlat ()) {
122
- $ alias = array_keys ($ collection ->getSelect ()->getPart ('from ' ))[0 ];
123
- $ this ->joinedAttributes [$ attribute ->getAttributeCode ()] = $ alias . '. ' . $ attribute ->getAttributeCode ();
122
+ if ($ attribute ->isEnabledInFlat ()) {
123
+ $ alias = array_keys ($ collection ->getSelect ()->getPart ('from ' ))[0 ];
124
+ $ this ->joinedAttributes [$ attribute ->getAttributeCode ()] = $ alias . '. ' . $ attribute ->getAttributeCode ();
125
+ } else {
126
+ $ alias = 'at_ ' . $ attribute ->getAttributeCode ();
127
+ if (!in_array ($ alias , array_keys ($ collection ->getSelect ()->getPart ('from ' )))) {
128
+ $ collection ->joinAttribute ($ attribute ->getAttributeCode (), 'catalog_product/ ' .$ attribute ->getAttributeCode (), 'entity_id ' );
129
+ }
130
+
131
+ $ this ->joinedAttributes [$ attribute ->getAttributeCode ()] = $ alias . '.value ' ;
132
+ }
124
133
return $ this ;
125
134
}
126
135
You can’t perform that action at this time.
0 commit comments