1

I have a custom product collection and products inside this collection has variety of colors. I want to retrieve all the colors available inside this product collection and store it in array.

$layer = $this->getLayer();
$productCollection = $layer->getProductCollection();
$productCollection->addAttributeToFilter(
       'entity_id',
       ['in' => $querydata->getData()]
);

Is there a way to do this?

0
$layer = $this->getLayer();
$productCollection = $layer->getProductCollection();
$productCollection->addAttributeToFilter(
   'entity_id',
   ['in' => $querydata->getData()]
);

Use below code:

$productCollection->getColumnValues('color'); // your field name
| 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.