Example #1
0
 /**
  * Get SQL for get record count
  *
  * @return \Magento\Framework\DB\Select
  */
 public function getSelectCountSql()
 {
     if ($this->getIsCustomerMode()) {
         $this->_renderFilters();
         $unionSelect = clone $this->getSelect();
         $unionSelect->reset(\Zend_Db_Select::ORDER);
         $unionSelect->reset(\Zend_Db_Select::LIMIT_COUNT);
         $unionSelect->reset(\Zend_Db_Select::LIMIT_OFFSET);
         $countSelect = clone $this->getSelect();
         $countSelect->reset();
         $countSelect->from(array('a' => $unionSelect), 'COUNT(*)');
     } else {
         $countSelect = parent::getSelectCountSql();
     }
     return $countSelect;
 }