List Model

It is a method to get the total number of items for the data set.

  • return integer - The total number of items available in the data set.
public function getTotal()
{
// Get a storage key.
$store = $this->getStoreId('getTotal');

// Try to load the data from internal storage.
if (isset($this->cache[$store]))
{
return $this->cache[$store];
}

try
{
// Load the total and add the total to the internal cache.
$this->cache[$store] = (int) $this->_getListCount($this->_getListQuery());
}
catch (\RuntimeException $e)
{
$this->setError($e->getMessage());

return false;
}

return $this->cache[$store];
}