0

I want to get all the products available on the current category page I tried this code

 public function getProduct()
{
        $check = $this->_registry->registry('current_category')->getProductCollection();
        return $check->getAllIds();

now this code is working good for non-configurable products but in cofigurable products it show a null Array. I just want to get all the Products on the current categories. Thanks in advance

0
public function getCategory()
{
    $check = $this->_registry->registry('current_category')->getProductCollection();
    $category = $this->categoryFactory->create()->load(    $check);
    return $category;
}

public function getProductCollection()
{
     return $this->getCategory()->getProductCollection()->addAttributeToSelect('*'); 
}

It's working.

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.