I had written a observer to trap product view page event and it is working fine.Now in that code i want to call a controller and pass the product id in it and render the custom view.phtml file, so how can i call that controller without changing my current browser url and render the view.phtml file on same url.
My Observer Code is Given Below
public function getProductView(Varien_Event_Observer $observer)
{
$resp = $observer->getEvent()->getFront()->getAction()->getRequest();
$requestUri = $resp->getRequestString();
if ($resp->getActionName() == 'noRoute'){
$requestUri = $resp->getRequestString();
$requestUri = ltrim($requestUri, '/');
$this->db = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "SELECT * FROM core_url_rewrite WHERE request_path like '%".$requestUri."%'";
$data = $this->db->fetchAll($sql);
// header("Location: " . Mage::getBaseUrl() . "customproduct/prodId=".$data[0]['product_id'], 301);
// exit;
//header('location:'.MAGE::getBaseurl()."customproduct",301);
//Edit: action not passed in to this event; passed in generic generate_blocks event
//Mage::getUrl('customproduct');
exit;
}
}