문제

How to get product collection by multiple attributes?

Magento 2.0

도움이 되었습니까?

해결책

You can use

Magento\Catalog\Model\ProductFactory;

to get product collection and filter by multiple attribute like this:

$productCollection = $this->_productFactory->create()->getCollection()->addAttributeToSelect('*')->addFieldToFilter('sku',array('eq' => $styleCode));

Use "Dependency Injection" method to implement this, Please reply if need more clarification,

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top