Question

i am trying to develop a custom module regarding reviews, reviews are shown in a list according to votes given to it by customers, for that purpose i altered the magento review table and inserted a new field called votes.

now the problem is that i am trying to sort the reviews according to the votes assigned to it but the reviews are ordered in the last updated review i.e the review which got last vote regardless of positive or negative, is shown on the top. my code;

$this->_reviewsCollection = Mage::getModel('review/review')->getCollection()
                    ->addStoreFilter(Mage::app()->getStore()->getId())
                    ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
                    ->addEntityFilter('product', $this->getProduct()->getId())
                    //->addOrder('votes','DESC');
                    //->setOrder('votes', 'DESC');
                    //$_reviewsCollection->getSelect()->order('main_table.votes DESC');
                    //->setDateOrder();
                    ->unshiftOrder('votes', 'DESC')

the different sorting methods i tried are also here (commented) Thanks in advance.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top