2015-02-07 2 views
0

목록보기에서 ID 대신 공급자 이름 표시를 원합니다. 보기가 자동으로 생성됩니다. 어떻게 변경할 수 있습니까?Prestashop - 대신 공급 업체 이름 표시

public function renderList() 
{ 
    $this->addRowAction('view'); 
    // Adds an Edit button for each result 
    $this->addRowAction('edit'); 

    // Adds a Delete button for each result 
    $this->addRowAction('delete'); 

    $this->simple_header = false; 

    return parent::renderList(); 
} 

및 필드 목록은 다음 하나입니다 :

내가 renderList 옵션에이 코드는

$this->fields_list = array(
     ... 
     'id_product_supplier' => array('title' => $this->l('ID Supplier'), 'align' => 'center', 'class' => 'fixed-width-xs'), 
     ... 
     ); 

내가 대신 아이디 공급자의 이름을 표시하려면, 목록에있는 공급 업체를 필터링 할 수있는 옵션이 있습니다 ...

어떻게해야합니까?

감사합니다.

답변

0

당신은 누구의 컨트롤러는 (기본값의 당신)입니다에 따라 두 가지 방법으로 변경할 수 있습니다 : 당신이 모듈을 사용하는 경우

public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false) 
{ 
    parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop); 

    foreach($this->_list as &row) 
    { 
     $row['new_field'] = 'Hello'; 
     $row['existing_field'] = 'Changed'; 
    } 
} 

: 당신이 당신의 자신의 관리 컨트롤러를 내장하는 경우

public function hookActionAdminProductsListingResultsModifier($args) 
{ 
    $args['list_total'] += 1; 

    foreach($args['list'] as &row) 
     { 
     $row['new_field'] = 'Hello'; 
      $row['existing_field'] = 'Changed'; 
    } 
} 

후크를 사용하는 경우 먼저 등록해야합니다. 또한 훅 이름에서 {AdminProducts} 부분을 제거하십시오.

자세한 내용은 classes/controller/AdminController.php @ Line 2952을 참조하십시오.

Hook::exec('action'.$this->controller_name.'ListingResultsModifier', array(
    'list' => &$this->_list, 
    'list_total' => &$this->_listTotal, 
));