我是Prestashop开发模块的新手,我使用的是1.7.4.2。我正在尝试开发模块,并且必须在后台的左侧菜单中创建自定义标签。我尝试过Prestashop官方文档(https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/tabs/)中的方法。但是自定义标签在后台并不可见。在这里,我添加我的代码和文件名。谁能帮助我解决我的错误?非常感谢。
我的文件
驱动器订单
-driveorder.php
-logo.png
-控制器
-admin
--- AdminDriveOrder.php
还有一个driveorder.php文件,它是我创建的自定义标签。
<?php
if (!defined('_PS_VERSION_'))
exit;
class driveorder extends Module
{
public function __construct()
{
$this->name = 'driveorder'; /* This is the 'technic' name, this should equal to filename (mycustommodule.php) and the folder name */
$this->tab = 'administration'; /* administration, front_office_features, etc */
$this->version = '1.0.0'; /* Your module version */
$this->author = 'Sertac Bazancir'; /* I guess it was clear */
$this->need_instance = 0; /* If your module need an instance without installation */
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); /* Your compatibility with prestashop(s) version */
$this->bootstrap = true; /* Since 1.6 the backoffice implements the twitter bootstrap */
parent::__construct(); /* I need to explain that? */
$this->displayName = $this->l('Drive Order'); /* This is the name that merchant see */
$this->description = $this->l('Google Drive integration for virtual products.'); /* A short description of functionality of this module */
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); /* This is a popup message before the uninstall */
$this->tabs = array(
array(
'name' => 'Drive Order', // One name for all langs
'class_name' => 'AdminDriveOrder',
'visible' => true,
'parent_class_name' => 'SELL'
)
);
}
public function install(){
if (Shop::isFeatureActive()){
Shop::setContext(Shop::CONTEXT_ALL);
}
$sql = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."drive_product`(
`id_product` INT(10) NOT NULL PRIMARY KEY,
`id_drive` VARCHAR(255) NOT NULL )";
$result = Db::getInstance()->Execute($sql);
if (!parent::install() OR !$result OR !$this->registerHook('actionPaymentConfirmation')){
return false;
}
return true;
}
public function uninstall(){
$sql = "DROP TABLE `"._DB_PREFIX_."drive_product`";
$result = Db::getInstance()->Execute($sql);
if (!parent::uninstall() OR !$result OR !Configuration::deleteByName('driveorder')){
return false;
}
return true;
}
public function hookActionPaymentConfirmation($params){
global $smarty;
}
}
?>
答案 0 :(得分:0)
您的错误在这里:
'parent_class_name' => 'SELL'
尝试一下:
'parent_class_name' => 'AdminParentOrders'
答案 1 :(得分:0)
您还必须命名控制器文件AdminDriveOrderController.php
而不是AdminDriveOrder.php