/**
  * Get Poll Id to show
  *
  * @return int
  */
 public function getPollToShow()
 {
     if ($this->getPollId()) {
         return $this->getPollId();
     }
     // get last voted poll (from session only)
     $pollId = Mage::getSingleton('core/session')->getJustVotedPoll();
     if (empty($pollId)) {
         // get random not voted yet poll
         $votedIds = $this->getVotedPollsIds();
         $pollId = $this->_pollModel->setExcludeFilter($votedIds)->setStoreFilter(Mage::app()->getStore()->getId())->getRandomId();
     }
     $this->setPollId($pollId);
     return $pollId;
 }
예제 #2
0
 /**
  * Get Poll Id to show
  *
  * @return int
  */
 public function getPollToShow()
 {
     if ($this->getPollId()) {
         return $this->getPollId();
     }
     // get last voted poll (from session only)
     $pollId = Mage::getSingleton('core/session')->getJustVotedPoll();
     if (empty($pollId)) {
         // get random not voted yet poll
         $votedIds = $this->getVotedPollsIds();
         $csutomer_id = null;
         if (Mage::getSingleton('customer/session')->isLoggedIn()) {
             $customerData = Mage::getSingleton('customer/session')->getCustomer();
             $csutomer_id = $customerData->getId();
         }
         $pollModel = $this->_pollModel->setExcludeFilter($votedIds)->setStoreFilter(Mage::app()->getStore()->getId())->setCustomerFilter($csutomer_id)->getRandomJ2tId();
         $pollId = $pollModel->getId();
     }
     $this->setPollId($pollId);
     return $pollId;
 }