@@ -93,6 +93,7 @@ public function applyLogToCollection(
93
93
$ skipIds = []
94
94
) {
95
95
$ idFieldName = $ collection ->getResource ()->getIdFieldName ();
96
+ $ predefinedStoreIds = ($ collection ->getStoreId () === null ) ?: [$ collection ->getStoreId ()];
96
97
97
98
$ derivedSelect = $ this ->getConnection ()
98
99
->select ()
@@ -103,7 +104,7 @@ public function applyLogToCollection(
103
104
->where ('event_type_id = ? ' , (int ) $ eventTypeId )
104
105
->where ('subject_id = ? ' , (int ) $ eventSubjectId )
105
106
->where ('subtype = ? ' , (int ) $ subtype )
106
- ->where ('store_id IN(?) ' , $ this ->getCurrentStoreIds ())
107
+ ->where ('store_id IN(?) ' , $ this ->getCurrentStoreIds ($ predefinedStoreIds ))
107
108
->group ('object_id ' );
108
109
109
110
if ($ skipIds ) {
@@ -132,13 +133,11 @@ public function getCurrentStoreIds(array $predefinedStoreIds = null)
132
133
{
133
134
$ stores = [];
134
135
// get all or specified stores
135
- if ($ this ->_storeManager ->getStore ()->getId () == 0 ) {
136
- if (null !== $ predefinedStoreIds ) {
137
- $ stores = $ predefinedStoreIds ;
138
- } else {
139
- foreach ($ this ->_storeManager ->getStores () as $ store ) {
140
- $ stores [] = $ store ->getId ();
141
- }
136
+ if ($ predefinedStoreIds !== null ) {
137
+ $ stores = $ predefinedStoreIds ;
138
+ } else if ($ this ->_storeManager ->getStore ()->getId () == 0 ) {
139
+ foreach ($ this ->_storeManager ->getStores () as $ store ) {
140
+ $ stores [] = $ store ->getId ();
142
141
}
143
142
} else {
144
143
// get all stores, required by configuration in current store scope
0 commit comments