如何在prestashop中重命名自定义模块

问题描述 投票:0回答:2

我已经开发了一个自定义模块,并从后台安装它。最近我有一个更改模块名称的要求。

我尝试了这些步骤。

  1. 卸载我的模块

  2. 重命名我的模块文件夹名称(my_shipping-> shipping_module)

  3. 重命名模块文件夹下的模块文件(my_shipping.php->shipping_module)

  4. 重命名类名和__construct名称

然后我刷新了后台模块的选择,并且在installed modules选项卡下看到了它。(但是在卸载它时,我已经开始了这些步骤。然后我尝试将其卸载。然后它向我显示]

无法卸载模块xxx。未安装模块。

如何重命名我现有的自定义模块?

class Shipping_module extends CarrierModule    
      {
          protected $config_form = false;    
          public function __construct()
          {
              $this->name = 'shipping_module';
              $this->tab = 'shipping_logistics';
              $this->version = '1.0.0';
              $this->author = 'DDD';
              $this->need_instance = 0;  
        }  
      }
php symfony prestashop prestashop-modules
2个回答
0
投票

在我看来,由于某些错误,它没有在步骤1上卸载。

尝试此步骤。

  1. 将其重命名为原来的名称,然后将其卸载并删除(有一个复选框,用于在卸载模块后将其删除)。

  2. 一旦确定已将其删除,请使用新名称,文件夹,类以及模块文件中每次出现的类名称对其进行重命名。

  3. 再次安装模块;保持调试模式为开,以便您可以看到可能出现的任何错误。


0
投票

选项:

  1. 删除/ modules / moduletodelete中的模块文件夹
  2. 转到模块主文件(类),然后尝试运行“卸载”功能。

  3. 如果您想重命名模块,则需要运行尝试下一个代码:

     $this->name = 'custom';
     $this->tab = 'custom';
     $this->version = '0.0.1';
     $this->author = 'custom';
     $this->need_instance = 0;
     $this->add();//or $this->save;
    

第2点的示例:转到/modules/moduletodelete/moduletodelete.php,检查如何调用卸载功能(类似于“ public function uninstall()”),然后尝试运行下一个代码:

$this->[name_of_uninstall()]; //example $this->uninstall();
© www.soinside.com 2019 - 2024. All rights reserved.