Skip to main content

Posts

Showing posts with the label collection

Magetno 2 get the products collection filter by attributes with or condition

how to get product collection with filters? I'm use magento 2 . So i'm trying to get in product collection with filter multiple attributes with or condition for custom search use below product collection object if your wring any blocks if not use object manager and create product collection object use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollection; $productcollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection'); $collection = $this->_productCollection                                     ->create()                                     ->addFieldToSelect('*')                                     ->addAttributeToFilter(                                     array(                                             array('attribute' => 'name', array('like' => '%'.$queryString.'%')),                                             array('attribu