$collection = Mage::getResourceModel('catalog/product_collection');
$collection->addAttributeToSelect('name','your-attribute');
$collection->addAttributeToFilter('your-attribute', array('eq' => 'attr-value'));
or
$category = Mage::getModel('catalog/category')->load($categoryId);
$collection = Mage::getModel('catalog/product')->getCollection()
->addCategoryFilter($category);
How can I achieve in Magento2.0
I want to filter the product collection by category id, custom category attribute(store id, customer group id).
I have create two custom attribute for category in Magento admin for Store and customer segmentation, I provide the options as Multiselect in the following way,
for store selection(in the dropdown, all store created come dynamically ).
for segmentation selection(in the dropdown, all customer group created come dynamically )
Now i want to filter product collection on the basis of attribute filter(store id, customer group id)
The github issue tracker is intended for technical issues only.
Please refer to the forums or magento stack exchange for technical questions. In your case probably the programming questions forum would be the most appropriate.
Please feel free to reopen this issue if you think you have encountered a bug in Magento 2.
I want to narrow the search in the following way,
http://magento2.magestore.com/rest/V1/products/search?searchCriteria[filterGroups][][filters][][field]=sku&searchCriteria[filterGroups][][filters][][value]=WH01&searchcriteria[filter_groups][][filters][][condition_type]=eq
http://magento2.magestore.com/rest/V1/categories/24/search?
searchCriteria[filterGroups][][filters][][field]=url_key&
searchCriteria[filterGroups][][filters][][value]=women&
searchCriteria[filterGroups][][filters][][condition_type]=eq
http://www.example.com/rest/V1/categories/24/products/search?
searchCriteria[filterGroups][][filters][][field]=custom_segmentation&searchCriteria[filterGroups][][filters][][value]=3,4&searchCriteria[filterGroups][][filters][][condition_type]=eq
so how should i filter the collection on the basis of magento attributes, custom attributes.
@gg24 As @daim2k5 mentioned in closing this, please post such programing related questions either on the Magento Stack Exchange or the Programming Forum. We are trying to keep the GitHub issue tracker focused on issues (aka bugs) with the Magento 2 platform. Thanks!
Most helpful comment
@gg24 As @daim2k5 mentioned in closing this, please post such programing related questions either on the Magento Stack Exchange or the Programming Forum. We are trying to keep the GitHub issue tracker focused on issues (aka bugs) with the Magento 2 platform. Thanks!