我安装了Prestashop 1.7.2.1,我正在尝试为它编写模块。
一般来说,我只想测试bootstrap(4?)支持。
我在log.levels = {
DEBUG: Symbol('debug'),
INFO: Symbol('info'),
WARN: Symbol('warn'),
};
log(log.levels.DEBUG, 'debug message');
log(log.levels.INFO, 'info message');
的模块中创建了一个钩子,它加载了以下智能模板:
displayTop
但不幸的是,这并没有为我的模块添加正确的bootstrap css样式。
这是我模块的构造函数:
<div class="alert alert-primary" role="alert">
This is a primary alert—check it out!
</div>
我用谷歌搜索我需要使用class TuxInModCarType extends Module
{
function __construct()
{
$this->csvUtil = new CsvUtil(buildCsvArray());
$this->ret = new RetObj();
$this->name = 'tuxinmodcartype';
$this->tab = 'quick_bulk_update';
$this->version = '0.1';
$this->author = 'Kfir Ozer';
$this->bootstrap = true;
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_);
parent::__construct();
$this->displayName = 'Tux-In Car Type';
$this->description = 'With this module, you will be able to specify car types for products';
$this->confirmUninstall = $this->l('Are you sure you want to uninstall');
if (!Configuration::get('MYMODULE_NAME'))
$this->warning = $this->l('No name provided');
}
,但实际上$this->bootstrap=true;
不包含bootstrap属性。
我使用以下功能安装我的模块:
public function install(){
ModuleCore
}
和return (parent::install() && $this->loadSqlFile(__DIR__.DIRECTORY_SEPARATOR.'sql'.
DIRECTORY_SEPARATOR.'install.sql') &&
$this->registerHook('displayBackOfficeHeader') &&
$this->registerHook('displayAdminProductsExtra') &&
$this->registerHook('displayTop'));
如下代码:
hookDisplayTop
这里 public function hookDisplayTop() {
$this->context->controller->addJquery();
$this->context->controller->bootstrap=true;
$this->context->controller->addCSS($this->_path.'/css/displaytop.css');
$this->context->controller->addJS($this->_path.'/js/displaytop.js');
return $this->display(__FILE__,'/displayTop.tpl');
}
我找到了一个$this->context->controller
变量,但它也没有改变任何东西。
任何想法?
答案 0 :(得分:1)
Bootstrap 4至少在查看documentation时没有alert-primary
课程。我将你的html片段注入了prestashop演示页面,但我没有得到任何样式。但是,使用任何其他alert-success
,alert-info
等都会显示正确的样式。