Prestashop 1.6自定义模块未在前端显示 [英] Prestashop 1.6 custom module not displaying up on front end
本文介绍了Prestashop 1.6自定义模块未在前端显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的模块未在前端显示,我正在关注此链接doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module在prestashop 1.6中创建自定义模块。我已经检查了位置,清除并禁用了缓存,卸载并重新安装了模块,但到目前为止没有任何效果。 ps config.xml是自动生成的。
My module is not displaying on the frontend , I was following this link doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module to create a custom module in prestashop 1.6.I've checked the position , cleared and disabled the cache , uninstalled and reinstalled the module but nothing worked so far . p.s the config.xml was generated automatically.
这是我的mymodule.php代码
here is my mymodule.php code
<?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 = 'Zeeshan Abbas';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.5','max' => '1.6');
$this->dependencies = array('blockcart');
parent::__construct();
//it is not 1 it is L ok
$this->displayName = $this->l('My module');
$this->description = $this->l('Description of my module');
$this->confirmUninstall = $this->l('are you sure you want to uninstall?? ');
if (!Configuration::get('MYMODULE_NAME'))
$this->warning = $this->l('No name provided');
}
public function install() {
if (Shop::isFeatureActive())
Shop::setContext(Shop::CONTEXT_ALL);
return parent::install() &&
$this->registerHook('leftColumn') &&
$this->registerHook('header') &&
Configuration::updateValue('MYMODULE_NAME','my friend');
}
public function uninstall()
{
if (!parent::uninstall() ||
!Configuration::deleteByName('MYMODULE_NAME'))
return false;
return true;
}
/*public function install()
{
if (parent::install() == false)
return false;
return true;
}*/
}
?>
这是我的mymodule.tpl
here is my mymodule.tpl
<!-- Block mymodule -->
<div id="mymodule_block_left" class="block">
<h4>Welcome!</h4>
<div class="block_content">
<p>Hello,
{if isset($my_module_name) && $my_module_name}
{$my_module_name}
{else}
World
{/if}
!
</p>
<ul>
<li><a href="{$my_module_link}" title="Click this link">Click me!</a></li>
</ul>
</div>
</div>
<!-- /Block mymodule -->
推荐答案
hookDisplayHeader
和 hookLeftColumn
方法丢失。
public function hookDisplayLeftColumn($params)
{
$this->context->smarty->assign(
array(
'my_module_name' => Configuration::get('MYMODULE_NAME'),
'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display')
)
);
return $this->display(__FILE__, 'mymodule.tpl');
}
public function hookDisplayHeader()
{
$this->context->controller->addCSS($this->_path.'css/mymodule.css', 'all');
}
这篇关于Prestashop 1.6自定义模块未在前端显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文