protected function _getProductCollection()
        $tagModel = $this->tagTagFactory->create();
        $this->_productCollection = $this->_productCollection
           // ->addMinimalPrice()

      $this->_productCollection->addAttributeToFilter('status', ['in' => 
      return $this->_productCollection;

I am trying to get $this->_productCollection->getSize() which doesnot reflect proper result.

  • Did you want count of product? – Kamlesh Solanki Apr 4 at 7:18
  • Yes by using getSize() – Parthavi Apr 4 at 7:19
  • Without using ->addTagFilter($this->getTag()->getId()) and check ` $this->_productCollection->getSize()` give proper value and or use $this->_productCollection->count() getting proper data – Amit Bera Apr 4 at 7:32
  • @AmitBera i remove ->addTagFilter($this->getTag()->getId()) but not working and i want to get value using getSize() for toolbar data – Parthavi Apr 4 at 8:42
  • @AmitBera Can u please suggest me another solution – Parthavi Apr 4 at 9:21

Have you tried $this->_productCollection->count()

  • Yes tried but still not working. Can u suggest me some way to use getSelectCountSql() – Parthavi Apr 5 at 4:27
  • @Parthavi is the collection returning any results? count() should give you the number of results returned by the collection. Can you please edit your post to include your entire class file. I'd like to see the constructor. – NSwanson7 Apr 5 at 13:20

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.