2014-03-31 1 views
0

템플릿 파일에서 사용자 지정 후크를 호출하려고합니다. ps_hook 테이블에 후크를 삽입했습니다. 나는 모듈을 만들어 그것을 고리에 연결했다. 또한 Modules -> Postions -> Module Transplant를 사용하여 모듈을 후크에 접목했습니다.Prestashop에서 템플릿 파일의 후크를 호출 할 수 없습니다.

이것은 mymodule.php 파일입니다.

<?php 
if (!defined('_PS_VERSION_')) 
exit; 

class MyModule extends Module 
{ 
public function __construct() 
{ 
$this->name = 'mymodule'; 
$this->tab = 'front_office_features'; 
$this->version = 1.0; 
$this->author = 'Sarfaraz Raj'; 
$this->need_instance = 0; 

parent::__construct(); 

$this->displayName = $this->l('My module'); 
$this->description = $this->l('Description of my module.'); 

} 

public function install() 
{ 
if (parent::install() == false OR !$this->registerHook('displayDateSlot')) 
return false; 
return true; 
} 
public function hookDisplayDateSlot($params) 
{ 
//global $smarty; 
$this->context->smarty->assign(
    array(
     // 'my_module_name' => Configuration::get('MYMODULE_NAME'), 
     // 'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display'), 
     'my_module_message' => $this->l('This is a simple text message'), 
     'HOOK_DISPLAY_DATESLOT' => Hook::exec('displayDateSlot') 
    ) 
); 

    return $this->display(__FILE__,'mymodule.tpl'); 
} 


public function hookRightColumn($params) 
{ 
return $this->hookDisplayDateSlot($params); 
} 
} 
?> 

난 그냥 내가 'HOOK_DISPLAY_DATESLOT'=> 훅 :: 간부 ('displayDateSlot') 라인을 선언해야 위치를 정확히 알고 싶어요. 내 후크의 이름은 displayDateSlot입니다.

+0

최대한 빨리이 문제를 해결해야하므로 회신 해주십시오. – user3482672

답변

0

다시 'HOOK_DISPLAY_DATESLOT'를 쓰기 => 후크 :: 간부 ('displayDateSlot')

훅을 설정하고 관리 측면를 통해 설치하고 전면의 모습을 볼 수있다 필요가 없습니다.

관련 문제