Skip to content

Commit 2143ca2

Browse files
committed
Fix for blog post store filter
1 parent bcb0c49 commit 2143ca2

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Model/ResourceModel/Post/Collection.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@ public function addStoreFilter($store, $withAdmin = true)
147147
}
148148

149149
if (!$this->getFlag('store_filter_added')) {
150+
$this->setFlag('store_filter_added', 1);
151+
152+
if (is_array($store)) {
153+
foreach ($store as $k => $v) {
154+
if ($k == 'like') {
155+
if (is_object($v) && $v instanceof \Zend_Db_Expr && (string)$v == "'%0%'") {
156+
return $this;
157+
} else {
158+
$this->addFilter('store', $store, 'public');
159+
return $this;
160+
}
161+
}
162+
}
163+
}
164+
150165
if ($store instanceof \Magento\Store\Model\Store) {
151166
$this->_storeId = $store->getId();
152167
$store = [$store->getId()];
@@ -165,8 +180,9 @@ public function addStoreFilter($store, $withAdmin = true)
165180
$store[] = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
166181
}
167182

183+
168184
$this->addFilter('store', ['in' => $store], 'public');
169-
$this->setFlag('store_filter_added', 1);
185+
170186
}
171187
return $this;
172188
}

0 commit comments

Comments
 (0)