Shopware 5.2 plugin - bare template überschreiben

Hallo,

versuch mal auf deinem Windows System die Funktion setTemplateDir in der Datei …shopware\engine\Library\Enlight\Template\Manager.php mit folgenden Code zu ersetzen,

   /**
     * Set template directory
     *
     * @param string|array $template_dir directory(s) of template sources
     * @return Smarty current Smarty instance for chaining
     */
    public function setTemplateDir($template_dir)
    {
        
        $template_dir = (array) $template_dir;

        foreach ($template_dir as $k => $v) {
            $template_dir[$k] = $this->resolveTemplateDir($v, $k);
            if ($template_dir[$k] === false) {
                unset($template_dir[$k]);
            }
        }

         /**
         * Filter all directories which includes the new shopware themes.
         */
        $themeDirectories = array_filter($template_dir, function ($themeDir) {
              if(stripos($themeDir, DIRECTORY_SEPARATOR . ‚Themes‘ . DIRECTORY_SEPARATOR . ‚Frontend‘ . DIRECTORY_SEPARATOR)){
                return $themeDir;
            }
        });

        /**
         * If no shopware theme assigned, we have to use the passed inheritance
         */
        if (empty($themeDirectories)) {

            return parent::setTemplateDir($template_dir);
        }
        /**
         * Select the plugin directories and the bare theme which used
         * as base theme for all extensions
         */
        $pluginDirs = array_diff($template_dir, $themeDirectories);

        if(sizeof($pluginDirs)> 0){
               $inheritance = $this->buildInheritance($themeDirectories, $pluginDirs);
                $inheritance = $this->unifyDirectories($inheritance);
                 return parent::setTemplateDir($inheritance);    
                     
        }else{
            return parent::setTemplateDir($themeDirectories);
        }
 
      
    }

 

Im Orginal wird bei Pfaden nur auf \ von Linux Dateisytemen geprüft. Dadurch wird das Plugin-Dir nicht in den Templatepfad gesetzt und Shopware lädt das Template aus dem Bare Template.

Es ist allerdings in Hack. da die Orginal Shopware Datei verändert wird. Bei einem Update kann das dann wieder weg (überschrieben) sein. Also nur zum Testen unter Windows. Bei mir geht es.

Grüße

Frank