public function getLastPageNum() { if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) { return parent::getLastPageNum(); } $collection = $this->getCollection(); if (!method_exists($collection, 'checkSearchaniseResult') || !$collection->checkSearchaniseResult()) { return parent::getLastPageNum(); } $collectionSize = (int) $collection->getSearchaniseRequest()->getTotalProduct(); $limit = (int) $this->getLimit(); if (0 === $collectionSize) { return 1; } elseif ($limit) { return ceil($collectionSize / $limit); } return 1; }