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();
$poll->load($this->my_poll_id);
$action = Mage::getUrl(‘poll/vote/add’, array(‘poll_id’ => $poll->getId()));
$poll_answers = Mage::getModel(‘poll/poll_answer’)
->getResourceCollection()
->addPollFilter($poll->getId())
->load()
->countPercent($poll);
}
This should do the trick!Last Updated on 26 January 2014