2012-07-26 5 views
1

adminhtml의 그리드에서 검토 할 수있는 주문을 나열하는 모듈을 만들었습니다.격자보기에서 상세보기로 주문 번호 받기

격자보기에서 상세보기로 orderId를 전달해야하는데 어떻게해야할지 모르겠다.

여기 여기 내 Grid.php

{ 
public function __construct() { 
    parent::__construct(); 
    $this->setId('moderationGrid'); 
    // This is the primary key of the database 
    $this->setDefaultSort('increment_id'); 
    $this->setDefaultDir('ASC'); 
    $this->setSaveParametersInSession(true); 
} 

protected function _prepareCollection() { 
    $collection = Mage::getModel('sales/order')->getCollection(); 
    $this->setCollection($collection); 
    return parent::_prepareCollection(); 
} 

protected function _prepareColumns() { 
    $this->addColumn('increment_id', array(
     'header' => Mage::helper('sales')->__('Order Number'), 
     'align'  =>'center', 
     'index'  => 'increment_id', 
    )); 

    $this->addColumn('created_at', array(
     'header' => Mage::helper('sales')->__('Purchase Date'), 
     'align'  => 'center', 
     'index'  => 'created_at', 
     'type'  => 'datetime', 
    )); 

    $this->addColumn('action', array(
     'header' => Mage::helper('moderation')->__('Action'), 
     'align'  => 'center', 
     'type'  => 'action', 
     'getter' => 'getId', 
     'actions' => array(
      array(
       'caption' => Mage::helper('sales')->__('Review'), 
       'url'  => array('base'=>'*/adminhtml_moderation/view'), 
       'field' => 'increment_id' 
      ) 
       ), 
       'filter' => false, 
       'sortable' => false, 
       'index'  => 'stores', 
       'is_system' => true, 
    )); 

    return parent::_prepareColumns(); 
} 

입니다 그리고 나의보기 Form.php

class Moderation_Block_Adminhtml_Moderation_View_Form extends Mage_Adminhtml_Block_Widget_Form 
{  
    protected function _construct() 
    { 
     parent::_construct(); 
     $this->setTemplate('moderation/form.phtml'); 
    } 


    public function getOrder() 
    {  
     $moderationId  = $this->getRequest()->getParam('increment_id'); 
     $order = Mage::getModel('sales/order')->load(); 
    } 
} 

답변

2

당신은 당신의 grid.php에 하나 개 이상의 사용자 정의 기능을 구현하기 위해 (힌트를 : 규칙에 의해하지라는 이름의이 파일을 자본 "G"해야 - Grid.php) : 필요

public function getRowUrl($row) 
{ 
    return $this->getUrl('*/*/edit', array(
     'id'=>$row->getId()) 
    ); 
} 

그러면 모든 행마다 다른 클래스 URL이 제공됩니다. 게시 할 때 Mage_Adminhtml_Block_Catalog_Product_Grid 라인 (320)

+0

내 Grid.php에서 참조 룩

, 그냥 오타를 대문자로한다. 답변 주셔서 감사합니다. 나는 php와 Magento에 새로운 두 사람이다. 두 번이나. –

0

난 그냥 그것을 유지하는 세션 변수를 만들 것입니다.

Mage::getModel('core/session')->setSomeVariable($id); 

다음으로 당깁니다.

Mage::getModel('sales/order')->load(Mage::getModel('core/session')->getSomeVariable();