I want to add result count in search url. The default url is like domain.com/catalogsearch/result/?q=queries
But I want add result count in url like,
`domain.com/catalogsearch/result/?q=queries&count=50`
I tried with below event observer
controller_action_layout_render_before_catalogsearch_result_index
and Observer.php
<?php
class PackgeName_ModuleName_Model_Observer {
// the product list block name in layout
const RESULT_BLOCK_NAME = 'search_result_list';
public function loadResult(Varien_Event_Observer $observer) {
$currentUrl = Mage::helper ( 'core/url' )->getCurrentUrl ();
$block = Mage::app ()->getLayout ()->getBlock ( self::RESULT_BLOCK_NAME );
if ($block) {
$collection = $block->getLoadedProductCollection ();
/**
* @var Mage_Catalog_Model_Product $product
*/
$count = $collection->getSize ();
$resultUrl = $currentUrl . '&count=' . $count;
if ($resultUrl) {
Mage::app ()->getResponse ()->setRedirect ( $resultUrl );
exit (); // stop everything else
}
}
}
}
But the problem is its again triggered. So it go to endless loop. Any Idea's to fix this issue or Is there any way to achieve this ? Please help me..