Skip to content

Commit 8d5a20f

Browse files
committed
MAGETWO-75526: Products Rule based on a attribute value does not display products in the front-end
- Modified canAttributeHaveDefaultValue method;
1 parent 0e6eb87 commit 8d5a20f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/code/Magento/Rule/Model/Condition/Sql/Builder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ public function attachConditionToCollection(
212212
// Select ::where method adds braces even on empty expression
213213
$collection->getSelect()->where($whereExpression);
214214
}
215+
$this->productCollection = null;
215216
}
216217

217218
/**
@@ -228,9 +229,10 @@ private function canAttributeHaveDefaultValue($attributeCode)
228229
// It's not exceptional case as we want to check if we have such attribute or not
229230
$attribute = null;
230231
}
231-
$storeId = $this->productCollection->getStoreId();;
232-
$defaultStoreId = $this->productCollection->getDefaultStoreId();
232+
$isNotDefaultStoreUsed = $this->productCollection !== null
233+
? (int)$this->productCollection->getStoreId() !== (int) $this->productCollection->getDefaultStoreId()
234+
: false;
233235

234-
return $storeId != $defaultStoreId && $attribute !== null && !$attribute->isScopeGlobal();
236+
return $isNotDefaultStoreUsed && $attribute !== null && !$attribute->isScopeGlobal();
235237
}
236238
}

0 commit comments

Comments
 (0)