0

I try to load collection with specific attributes this way:

    $collection = $this->productCollectionFactory->create();
    $collection->addAttributeToSelect('entity_id')->addAttributeToSelect('name');

It adds to _selectAttributes field with these two attributes, but when I try to load items - nothing changed, all items have all fields... So, it's same as addAttributeToSelect('*')

What should i do to resolve this issue?

0

may be try $collection->setStoreId(2) (narrow collection to your store) or/and ->addAttributeToFilter('name', 'FOONAME')

|improve this answer|||||
-1
 $collection = $this->_productCollectionFactory->create();
 $collection->getSelect()
    ->reset(\Zend_Db_Select::COLUMNS)
    ->columns(['entity_id', 'sku']);
|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.