Magento pagination product total display issue

Hi all,

I’m running Magento v1.7.0.2.

Let’s say there are 14 products associated with a particular category. If I click on that category, Magento does the pagination correctly and shows the first 8 products, with 3 products per row. It also says “Items 1 to 8 of 8 total”.

If I click on the second page, it correctly shows me 6 products, 3 per row. This time it says “Items 9 to 14 of 6 total”.

Can someone please help me fix this issue and have it reading “Items 1 to 8 of 14 total” and Items 9 to 14 of 14 total” respectively? I have no idea which PHP/XML file to edit and what changes to make.

Many thanks
kbitAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kbitAuthor Commented:
In Toolbar.php and Pager.php I've changed

    public function getTotalNum()
    {
        return $this->getCollection()->getSize();
    }

Open in new window


to

    public function getTotalNum()
    {
        return $this->getCollection()->count();
    }

Open in new window


and flushed the cache but still no change.
0
kbitAuthor Commented:
Here's how I think I solved it:

app/design/frontend/default/THEME_NAME/template/catalog/product/list/toolbar.phtml

change

<p class="amount">
    <?php if($this->getLastPageNum()>1): ?>
	<?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
    <?php else: ?>
	<strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
    <?php endif; ?>
</p>

Open in new window

to
<p class="amount">
    <?php if($this->getLastPageNum()>1): ?>

	<?php $_helper = $this->helper('catalog/output');?>
	<?php $_category_detail=Mage::registry('current_category');?>
	<?php $_category_detail->getName();?>
	<?php $_category_detail->getId(); ?>

	<?php $products_count = Mage::getModel('catalog/category')->load($_category_detail->getId())
		->getProductCount(); ?>            


	<?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $products_count) ?>
    <?php else: ?>
	<strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
    <?php endif; ?>
</p>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
E-Commerce

From novice to tech pro — start learning today.