Questions tagged [addattributetofilter]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
20 views

Magento 2: addAttributeToFilter not working when filtering by ID

Exception #0 (Magento\Framework\Exception\LocalizedException): The "id" attribute name is invalid. Reset the name and try again. Here is my code ... \Magento\Catalog\Model\ResourceModel\...
1
vote
2answers
61 views

addAttributeToFilter for Multislect Attribute Update Query Magento 2

I have Multiselect product attribute and i want to filter product by that attribute. Currently i am using below code, $productCollection = $this->getLayer()->getProductCollection(); $...
0
votes
0answers
27 views

Filter product collection with nested OR/AND statements

I want to make a query as below WHERE manageStock = 0 OR (manageStock = 1 AND productStatus != 0) OR (manageStock = 1 AND backorderStatus = 1) but I can't use $collection->getSelect()->where() ...
0
votes
3answers
31 views

Magento 2 addAttributeToFilter not adding to SQL

I'm trying to get a list of products with a custom attribute set a certain way. Right now only one product should be returned, however it's returning the whole catalog. It seems like my added ...
0
votes
2answers
106 views

Set order for product Collection in magento2

I am filtering product collection like below. $productSkuString = 'O, C, D, A, F, S'; $productSkus = explode(', ', $productSkuString); $collection = $this->collectionFactory-&...
0
votes
1answer
121 views

Magento 1.9 addAttributeToFilter() returning 0 products

I have the following code where i want product collection filtered with custom attribute. typeid = $data['categoryId']; $pagesize = $data['limit']; $pageno = $data['page']; Mage::app()-&...
19
votes
3answers
46k views

Multi Conditionals (OR and AND inside AND) in addAttributeToFilter

How to create a multi-condition in addAttributeToFilter? I want result in a SQL query like this (image attached) : WHERE ((`e`.`news_from_date` > '2013-09-12') OR (`e`.`news_to_date` < '2013-...