setId('ekomi_reviews'); $this->setDefaultSort('time'); $this->setDefaultDir('desc'); $this->setUseAjax(true); $this->setSaveParametersInSession(true); } protected function _prepareCollection() { #$data = Mage::helper('ekomimeetsmage'); #$review = Mage::helper('ekomimeetsmage/review'); $resource = Mage::getSingleton('core/resource'); $collection = Mage::getModel('ekomimeetsmage/rating_cache')->getCollection(); $collection ->getSelect() ->joinInner( array('type'=>$resource->getTableName('eav_entity_type')), '(type.entity_model="catalog/product")' ) ->joinInner( array('attribute'=>$resource->getTableName('eav_attribute')), '(attribute.attribute_code="name" AND attribute.entity_type_id=type.entity_type_id)' ) ->joinInner( array('varchar'=>$resource->getTableName('catalog_product_entity_varchar')), '(attribute.attribute_id=varchar.attribute_id AND main_table.product_id = varchar.entity_id)' ) ->where('varchar.store_id = ?', 0); $this->setCollection($collection); return parent::_prepareCollection(); } protected function _prepareMassaction() { $this->setMassactionIdField('state'); $this->getMassactionBlock()->setFormFieldName('state'); $this->getMassactionBlock() ->addItem( 'activate_items', array( 'label'=> $this->getEkomiHelper()->__('Activate'), 'url' => $this->getUrl('*/grid/activate_review', array('' => '')), 'confirm' => Mage::helper('ekomimeetsmage')->__('Are you sure?') ) ) ->addItem( 'deactivate_items', array( 'label'=> $this->getEkomiHelper()->__('Deactivate'), 'url' => $this->getUrl('*/grid/deactivate_review', array('' => '')), 'confirm' => $this->getEkomiHelper()->__('Are you sure?') ) ); return $this; } protected function _prepareColumns() { $this->addColumn( 'ekomi_rating_cache_id', array( 'header' => $this->getEkomiHelper()->__('ID'), 'align' => 'center', 'width' => '50px', 'filter' => false, 'sortable' => true, 'index' => 'ekomi_rating_cache_id', ) ); $this->addColumn( 'time', array( 'header' => $this->getEkomiHelper()->__('Time'), 'align' => 'left', 'width' => '150px', 'filter' => false, 'sortable' => true, 'index' => 'time', 'type' => 'date', 'frame_callback' => array($this, 'decorateTime') ) ); $this->addColumn( 'state', array( 'header' => $this->getEkomiHelper()->__('Status'), 'align' => 'left', 'width' => '120', 'filter_index' => 'state', 'index' => 'state', 'type' => 'text', 'filter' => false, 'sortable' => true, 'frame_callback' => array($this, 'decorateStatus') ) ); $this->addColumn( 'rating', array( 'header' => $this->getEkomiHelper()->__('Rating'), 'align' => 'left', 'width' => '70px', 'filter_index' => 'rating', 'index' => 'rating', 'type' => 'text', 'filter' => false, 'sortable' => true, 'frame_callback' => array($this, 'decorateRating') ) ); $this->addColumn( 'value', array( 'header' => $this->getEkomiHelper()->__('Product name'), 'align' => 'left', 'width' => '250px', 'index' => 'value', 'filter_index' => 'value', 'sortable' => true, // 'frame_callback' => array($this, 'decorateProduct') , ) ); $this->addColumn( 'feedback', array( 'header' => $this->getEkomiHelper()->__('Review'), 'align' => 'left', 'width' => '', 'filter' => false, 'sortable' => false, 'index' => 'feedback', ) ); if (Mage::helper('ekomimeetsmage')->isMultistore()) { // @todo store information } return parent::_prepareColumns(); } public function decorateRating($value, $row, $column, $isExport) { func_get_args(); $html = ""; $html .= "