Is it possible to retrieve data from the observer and then display it on the page through custom block? I'm displaying some products in the home page of Magento through my custom block. I've created a custom observer which listens to the event when the product is clicked. The below code in Observer.php gets the product's data which was clicked on, for example the ID and the Name of the product. When I use Mage::log($pName) for example I can see the clicked product's Name appear in the system.log file. So that's all good. What I want to do next is get the exact same product data from this Observer file and pass it on to my block file so I could use the data in block file. For displaying the product which was clicked on in other block. Right now I have two blocks. One is responsible for all products display and the other one should only show the product which was clicked on. That's why I need to get the data to my block from the Observer.
Observer.php
public function getProductData($observer)
{
$product = $observer->getProduct();
$pId = $product->getId();
$pName = $product->getName();
//Mage::log($pId);
//Mage::log($pName);
}
Block file
public function recommended()
{
//code to retrieve data from observer goes here
//and then priting the data out
}
Phtml file
<?php
$this->recommended();
?>