Skip to content

Commit

Permalink
Enforce indexation of status attribute for products.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainruaud authored and Aurélien FOUCRET committed Mar 13, 2018
1 parent 4d565e4 commit 77c88ee
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,24 @@ public function loadChildrens($productIds, $storeId)
return $children;
}

/**
* Allow to filter an attribute collection on attributes that are indexed into the search engine.
* Overriden to enforce "status" attribute indexing for products.
*
* @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection $attributeCollection Attribute Collection
*
* @return \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection
*/
public function addIndexedFilterToAttributeCollection(
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection $attributeCollection
) {
$attributeCollection = parent::addIndexedFilterToAttributeCollection($attributeCollection);

$attributeCollection->getSelect()->orWhere("attribute_code = 'status'");

return $attributeCollection;
}

/**
* Retrieve Product Emulator (Magento Object) by type identifier.
*
Expand Down

0 comments on commit 77c88ee

Please sign in to comment.