Output Total Active Products in Magento Category Toolbar

Output Total Active Products in Magento Category Toolbar

Martin Starkie eCommerce, Server Side & Web Technical

Magento Website Designers Lancashire

A Lancashire client recently asked us to perform some Magento web development work to extend the functionality and customer user experience on their category pages. They had a large number of products in each top level category and wanted to display the total number of products to give the customer a better visual on how many products there were rather than using the product limit and scrolling through each page. Our solution was to output the total active products in the Magento category toolbar.

To do this we simply added the snippet of code (shown below) towards the bottom of your toolbar.phtml file in template / catalog / product / list
Tested in Magento CE 1.9.2.0.


Magento - output total active products in category toolbar
<label><?php echo $this->__('out of') ?><?php
$_category = Mage::getModel('catalog/category')->load(Mage::registry('current_category')->getId());$_product = $_category->getProductCollection();$_product->setVisibility(array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH, Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG));$_product->addFieldToFilter('status',Mage_Catalog_Model_Product_Status::STATUS_ENABLED);echo $_product->count();?></label>

Wealth of Experience

We have a wealth of experience and knowledge of the principles of eCommerce design to ensure you get the right balance of product imagery, content and functionality to maximise sales.

If we can help you with your Magento Webdesign, please contact us for a friendly chat.

Contact us!

Share this Post