【发布时间】:2016-08-21 16:03:22
【问题描述】:
我想在 PrestaShop 模块的配置页面上添加一个范围滑块。我尝试使用 HelperForm 类来做到这一点,但我不能这样做,如果我写其他类型,例如“textarea”或“复选框”,它工作正常,即使不是真正的标准输入类型,如“颜色” ',但'范围'不起作用
<?php
if (!defined('_PS_VERSION_'))
exit;
class icropper extends Module
{
public function __construct()
{
$this->name = 'icropper';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'AppDev';
$this->need_instance = 1;
$this->ps_versions_compliancy = array('min' => '1.5', 'max' => _PS_VERSION_);
parent::__construct();
$this->displayName = $this->l('icropper');
$this->description = $this->l('Module for Cropping Images');
$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()
{
$filename = _PS_ROOT_DIR_.'/override/cropp.php';
$ext = get_loaded_extensions();
foreach($ext as $i)
{
if($i == "imagick") {
$imgck = $i;
break;
}
}
if (!parent::install()) {
return false;
} elseif (!$imgck) {
$this->context->controller->errors[] = $this->l('In your server does not installed Imagick library');
return false;
} elseif(file_exists($filename)) {
$this->context->controller->errors[] = $this->l('File that override cropping
already exist, please delete it and replace file by yourself');
return false;
}else {
//copy(__DIR__ . '/override/list_footer.tpl', _PS_ROOT_DIR_ . '/override/helpers/admin/templates/list');
return true;
}
}
public function uninstall()
{
if (!parent::uninstall())
return false;
return true;
}
public function getContent()
{
return $this->DisplayForm();
}
public function displayForm(){
$fields_formm[0] = array(
'form' => array(
'legend' => array(
'title' => $this->l('Header'),
'icon' => 'icon-file-text'
),
'input' => array(
array(
'type' => '',
'name'=> 'vania',
'min'=>0,
'max'=>100,
'step'=>1
),
'submit' => array(
'title' => $this->l('Generate')
)
)
)
);
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = 1;
$this->fields_formm = array();
$helper->submit_action = 'submitform';
return $helper->generateForm(array($fields_formm[0]));
}
}
?>
【问题讨论】:
-
还有更多信息吗?代码、示例、错误?
-
如果您在产品、类别等其他模块中找到任何内容,请复制它。但我很确定它们不存在。您必须为此包含正确的 JS 插件。
-
您使用的是哪个版本的 prestashop?
标签: php module smarty prestashop jquery-ui-slider