1

Just to it like below code : Inject this below class in your construct: protected $productRepository; public function __construct( \Magento\Catalog\Api\ProductRepositoryInterface $productRepository ) { $this->productRepository = $productRepository; } And use this below code : $product = $this->productRepository->getById('product-id'); $...


1

You can try this. Let's say that $category is the instance of the current category; $collection = $category->getProductCollection()->addAttributeToSelect(['manufacturer', 'color']); $manufacturers = []; $colors = []; foreach ($collection as $product) { $manufacturer = $product->getData('manufacturer'); if ($manufacturer && !isset($...


Only top voted, non community-wiki answers of a minimum length are eligible