0

How to remove the field from where the condition in magento 2?

in error log : Column not found: 1054 Unknown column 'show_in_custom_assistance' in 'where clause'.

$collection = $this->_autoSearchCollection->create();
    $collection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());
    $collection->addAttributeToSelect('*')
    ->setStoreToFilter($storeid)
    ->addStoreFilter($storeid)
    ->addSearchFilter($search_arr)
    ->addMinimalPrice()
    ->addUrlRewrite()
    ->addTaxPercents();
    $collection->addCategoryFilter($category);
    // echo $collection->getSelect();

    return $collection;

I have tried the $collection->removeAttributeToSelect('show_in_custom_assistance'); and $collection->removeFieldFromSelect('show_in_custom_assistance'); but didn't worked.

1

I found the solution myself. Just make the attribute not searchable so that the attribute will not come in the search filter.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.