2

我刚刚发现了新版本的 presashop (1.7.0)。

我想使用另一种 javascript,而不是 homeslider 模块默认提出的那个。

class Ps_ImageSlider extends Module implements WidgetInterface
{
    public function hookdisplayHeader($params)
    {
        $this->context->controller->registerStylesheet('modules-homeslider', 'modules/'.$this->name.'/css/homeslider.css', ['media' => 'all', 'priority' => 150]);
        $this->context->controller->registerJavascript('modules-responsiveslides', 'modules/'.$this->name.'/js/responsiveslides.min.js', ['position' => 'bottom', 'priority' => 150]);
        $this->context->controller->registerJavascript('modules-homeslider', 'modules/'.$this->name.'/js/homeslider.js', ['position' => 'bottom', 'priority' => 150]);
    }
}

但是,我不能在我的主题中超载它!

你有什么程序可以推荐给我吗?

谢谢。

4

1 回答 1

4

又是我 !

因此,在 Prestashop 的根目录下,存在一个名为:“./override/modules”的文件。我们只需添加一个文件夹“ps_imageslider”和一个文件“ps_imageslider.php”,然后输入以下代码:

<?php
class Ps_ImageSliderOverride extends Ps_ImageSlider{
   public function hookdisplayHeader($params)
   {
       $this->context->controller->registerStylesheet('modules-homeslider', 'modules/'.$this->name.'/css/homeslider.css', ['media' => 'all', 'priority' => 150]);
       $this->context->controller->registerJavascript('modules-YOUR_JS', 'modules/'.$this->name.'/js/YOUR_JS.js', ['position' => 'bottom', 'priority' => 150]);
       $this->context->controller->registerJavascript('modules-homeslider', 'modules/'.$this->name.'/js/homeslider.js', ['position' => 'bottom', 'priority' => 150]);
   }
}

最后,您必须清空缓存。

对不起我的英语(我是法语 xD)。

再见!

于 2016-11-15T16:11:44.110 回答