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

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

我尝试了这些步骤。

  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;  
        }  
      }
zxcvbnmasd1234 回答:如何在prestashop中重命名自定义模块

在我看来,由于某些错误,它并未在第1步中卸载。

尝试此步骤。

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

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

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

,

选项:

  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();
本文链接:https://www.f2er.com/2336194.html

大家都在问