1

I need to show the magento poll to any of the pages of magento website. What code should I add to the PHTML files?

2

One way to dispaly poll in different page is using xml. You can use the following code to display pole

<block type="poll/activePoll" name="right.poll">
            <action method="setPollTemplate"><template>poll/active.phtml</template><type>poll</type></action>
            <action method="setPollTemplate"><template>poll/result.phtml</template><type>results</type></action>
        </block>

Another way to display is create a static block and call it in the phtml file. In static block you can put the code

{{block type="poll/poll" template="poll/active.phtml" poll_id="1"}}

And the third way is using php code. I haven't tried it but found somewhere on net.

$action = Mage::getBaseUrl().’poll/vote/add/poll_id/’.$this->getPollId();
$poll = Mage::getModel('poll/poll')->load($this->getPollId());
$poll_answers = Mage::getResourceModel('poll/poll_answer_collection')->addPollFilter($this->getPollId())->getItems();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.