Magento Show Poll Results

Add this code in order to show the poll results in de poll block (using this article):

In addition for the result add in poll.phtml:

if ($poll->isVoted($poll->getId()) == TRUE) {
//Template Block
echo $this->getLayout()->createBlock(‘core/template’)->setTemplate(‘poll/result.phtml’)->setAttribute(‘my_poll_id’, $poll->getId())->toHtml();
} else {

// add the rest of the poll script here


Further open results.phtml and add on top:

if(!isset($poll)) {
$poll = new Mage_Poll_Model_Poll();

$action = Mage::getUrl(‘poll/vote/add’, array(‘poll_id’ => $poll->getId()));

$poll_answers = Mage::getModel(‘poll/poll_answer’)


This should do the trick!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top