2012-11-17 6 views
0

을 예상대로 작동하지 않습니다 예상대로PrestaShop 버전 모듈이 설치하지만 제품 페이지에 별도의 탭을 추가하는 PrestaShop 버전의 플러그인이

<?php 

// Disable direct addressing to the script: 
if (!defined('_PS_VERSION_')) 
    exit; 

//Create module class: 
class producttab extends Module { 

//Class constructor that contains its configuration: 
public function __construct() 
{ 
    $this->name = "producttab"; //Module name 
    $this->tab = "front_office_features"; //Tab with the module in Prestashop back-office modules list 
    $this->version = "1.0"; // Module version 
    $this->author = "BelVG"; // Module author 
    parent::__construct(); 
    $this->displayName = $this->l("Product Tab"); // Module title 
    $this->description = $this->l("Module creates a new tab on the frontend product page "); // Module description 
} 

//Module installation-method: 
public function install() 
{ 
    return (parent::install() 
      AND $this->registerHook('productTab') //Register productTab hook that will display the tab button 
      AND $this->registerHook('productTabContent') //Register productTabContent hook that will display the tab content 
      ); 
} 

//Module deinstallation-method: 
public function uninstall() 
{ 
    return (parent::uninstall() 
      AND $this->unregisterHook('productTab') 
      AND $this->unregisterHook('productTabContent')); // Delete all hooks, registered by the module 
} 

//Method will be called while performing the "ProductTab" hook (tab buttons generation): 
public function hookProductTab($params) 
{ 
    global $smarty; 
    //Call the template containing the HTML-code ?? our button 
    return $this->display(__FILE__ , 'tpl/productTab.tpl'); 
} 

public function hookProductTabContent($params) 
{ 
    global $smarty; 
    //Transfer the new tab content into template via smatry 
    //(it is optional as far as the content can be assigned directly in the template) 
    $result = Db::getInstance()->executeS('SELECT * FROM ps_cms_lang WHERE id_cms =14'); 

$smarty->assign('content', $result); 
    // Call the template containing the HTML-code of our new tab content: 
    return $this->display(__FILE__ , 'tpl/productTabContent.tpl'); 
} 

} 
?> 

모듈은 작동합니다. 다른 탭을 추가하기 위해 동일한 코드를 적용하려고합니다. 어떤 이유로 새로운 모듈이 설치되지만 탭이 나타나지 않습니다. 내가 빠진 것이 있습니까?

<?php 

// Disable direct addressing to the script: 
if (!defined('_PS_VERSION_')) 
exit; 

//Create module class: 
class jewellerytab extends Module { 

//Class constructor that contains its configuration: 
public function __construct() 
{ 
    $this->name = "jewellerytab"; //Module name 
    $this->tab = "front_office_features"; //Tab with the module in Prestashop back-office modules list 
    $this->version = "1.0"; // Module version 
    $this->author = "Mike Rifgin"; // Module author 
    parent::__construct(); 
    $this->displayName = $this->l("jewellery Tab"); // Module title 
    $this->description = $this->l("Module creates a new tab on the frontend jewellery page "); // Module description 
} 

//Module installation-method: 
public function install() 
{ 
    return (parent::install() 
      AND $this->registerHook('jewelleryTab') //Register jewelleryTab hook that will display the tab button 
      AND $this->registerHook('jewelleryTabContent') //Register jewelleryTabContent hook that will display the tab content 
      ); 
} 

//Module deinstallation-method: 
public function uninstall() 
{ 
    return (parent::uninstall() 
      AND $this->unregisterHook('jewelleryTab') 
      AND $this->unregisterHook('jewelleryTabContent')); // Delete all hooks, registered by the module 
} 

//Method will be called while performing the "jewelleryTab" hook (tab buttons generation): 
public function hookjewelleryTab($params) 
{ 
    global $smarty; 
    //Call the template containing the HTML-code ?? our button 
    return $this->display(__FILE__ , 'tpl/jewelleryTab.tpl'); 
} 

public function hookjewelleryTabContent($params) 
{ 
    global $smarty; 
    //Transfer the new tab content into template via smatry 
    //(it is optional as far as the content can be assigned directly in the template) 
    $result = Db::getInstance()->executeS('SELECT * FROM ps_cms_lang WHERE id_cms =14'); 

$smarty->assign('content', $result); 
    // Call the template containing the HTML-code of our new tab content: 
    return $this->display(__FILE__ , 'tpl/jewelleryTabContent.tpl'); 
} 

} 
?> 

답변

1

jewelleryTab 및 jewelleryTabContent 같은 그러한 후크가 없습니다, 당신은 여기 prestahop 1.5 http://doc.prestashop.com/display/PS15/Hooks+in+PrestaShop+1.5과에 대한 몇 가지 기본 정보에 대한 후크의 목록을 찾을 수 있습니다 (PrestaShop 버전 코어의 일부) productTab 및 productTabContent 작업 할 필요 PrestaShop 버전의 후크는 http://doc.prestashop.com/display/PS14/Understanding+and+using+hooks

또한 데니스에 도달하기 위해 시도 할 수

,

그리고이 문서 후에 데니스 유연한 개발 author of this extension from BelVGextension to add extra product tabs

0

사전 정의 된 후크 만 사용할 수 있습니다.

jewelleryTab 및 jewelleryTabContent 대신 동일한 후크를 사용할 수 있습니다.

잘하면 후크를 다시 사용할 수 있습니다.

public function install() 
{ 
     return (parent::install() 
     AND $this->registerHook('productTab') //Register productTab hook that will display the tab button 
     AND $this->registerHook('productTabContent') //Register productTabContent hook that will display the tab content 
     ); 
} 
1

jewelleryTabjewelleryTabContent 사용자 정의 후크입니다.

{hook h='jewelleryTab'} 
{hook h='jewelleryTabContent'} 
:

당신은 당신의 .tpl 템플릿 파일이 후크를 추가해야