Magento Asked by Rajeev Singh on October 2, 2021
I am trying to exclude child products from search. Say I have a bundle product B1 with ‘xyz’ name and it has a child with name ‘abc’. Now searching for ‘abc’ in frontend also gives the product B1 in search results.
What I need is If I search ‘abc’ then I should not get product B1 in the search results.
I have tried following solutions but they are related to magento 1
CatalogSearch – exclude child product names from fulltext
https://stackoverflow.com/questions/19907666/magento-search-result-excluding-tthe-child-products
In magento2.3.2 I did not find Mage_CatalogSearch_Model_Resource_Fulltext::_rebuildStoreIndex function.
ofcourse I looked for this inside vendor/magento/module-catalog-search/Model/ResourceModel/Fulltext.php
But I found a similar function that I felt is doing the reindexing part.function is next() It is located in
vendormagentomodule-catalog-searchModelIndexerFulltextActionIndexIterator.php
I tried commenting the following line as suggested in above solutions
// $productChildren = $this->productRelations[$productData['entity_id']];
// if ($productChildren) {
// foreach ($productChildren as $productChildId) {
// if (isset($this->productAttributes[$productChildId])) {
// $productChildAttr = $this->productAttributes[$productChildId];
// if (!isset($productChildAttr[$this->status->getId()])
// || !in_array($productChildAttr[$this->status->getId()], $this->statusIds)
// ) {
// continue;
// }
// $hasChildren = true;
// $productIndex[$productChildId] = $productChildAttr;
// }
// }
// }
cleaned cache, reindexed, but still getting results based on child products. Any suggestion how I can achieve this.
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP