# Plugin für Shopware 4 und 5 kompatibel programmieren

**URL:** <https://forum.shopware.com/t/plugin-fur-shopware-4-und-5-kompatibel-programmieren/28105>\
**Category:** Programmierung\
**Created:** [13. Juni 2015 um 01:16 UTC](https://forum.shopware.com/t/plugin-fur-shopware-4-und-5-kompatibel-programmieren/28105 "2015-06-13T01:16:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![benda](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@benda](https://forum.shopware.com/u/benda)\
**Post date:** [13. Juni 2015 um 01:16 UTC](https://forum.shopware.com/t/plugin-fur-shopware-4-und-5-kompatibel-programmieren/28105/1 "2015-06-13T01:16:47Z")

</div>

Hallo, ist es möglich ein Frontend Plugin für Shopware 4 und 5 zu programmieren? Wenn ja muss man auf etwas achten? Kurze Nebenfrage. Wie gibt man die Kopatibilität im Bootstrap.php an.

---

<div class="post-metadata">

**Author:** ![Creatixx](https://avatars.discourse-cdn.com/v4/letter/c/c67d28/32.png) [@Creatixx](https://forum.shopware.com/u/Creatixx)\
**Post date:** [13. Juni 2015 um 01:29 UTC](https://forum.shopware.com/t/plugin-fur-shopware-4-und-5-kompatibel-programmieren/28105/2 "2015-06-13T01:29:55Z")

</div>

Hi, ja klar ist möglich! In den [DevDocs](https://developers.shopware.com/developers-guide/shopware-5-plugin-update-guide/) gibts ein paar Beispiele dazu. Gruß

---

<div class="post-metadata">

**Author:** ![benda](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@benda](https://forum.shopware.com/u/benda)\
**Post date:** [13. Juni 2015 um 21:01 UTC](https://forum.shopware.com/t/plugin-fur-shopware-4-und-5-kompatibel-programmieren/28105/3 "2015-06-13T21:01:59Z")

</div>

Vielen dank für den Link Creatixx. Ich hatte nur bei der deutschen Dev Seite geschaut. Plugin funktioniert mit Shopware 4 und 5. Ein Problem hab ich noch. Ich probiere für die 5er Version die Css des Plugin mit der von Shopware zusammenzufassen/einzufügen. Hab nur Code-Beispiele für Less gefunden und es adaptiert. Leider funktioniert es nicht. ------------------------------ [code]\<?php use Doctrine\Common\Collections\ArrayCollection;

class Shopware\_Plugins\_Frontend\_BenroeNotificationbar\_Bootstrap extends Shopware\_Components\_Plugin\_Bootstrap  
{  
…

```
public function install()
{
    $this->createForm(); $this-\>subscribeEvents(); return true; } public function onCollectCssFiles() { $cssDir = \_\_DIR\_\_ . '/Views/frontend/\_public/src/css/'; return new ArrayCollection(array( $cssDir . 'jquery.messagebar.css' )); } ... [/code] ------------------------------ Ordnerstruktur: engine/Shopware/Plugins/Local/Frontend/BenroeNotificationbar/Views/responsive/frontend/\_public/src/css/jquery.messagebar.css
```

---

<div class="post-metadata">

**Author:** ![Creatixx](https://avatars.discourse-cdn.com/v4/letter/c/c67d28/32.png) [@Creatixx](https://forum.shopware.com/u/Creatixx)\
**Post date:** [13. Juni 2015 um 22:44 UTC](https://forum.shopware.com/t/plugin-fur-shopware-4-und-5-kompatibel-programmieren/28105/4 "2015-06-13T22:44:17Z")

</div>

Das wäre der korrekte Teil für die Bootstrap.php `public function install() { ... // Register your custom Less files, so that they are processed into CSS and included on your template $this-\>subscribeEvent( 'Theme\_Compiler\_Collect\_Plugin\_Less', 'addLessFiles' ); ... } ... /\*\* \* Provide the file collection for Less \*/ public function addLessFiles(Enlight\_Event\_EventArgs $args) { $less = new \Shopware\Components\Theme\LessDefinition( //configuration array(), //less files to compile array( \_\_DIR\_\_ . '/Views/responsive/frontend/\_public/src/less/all.less' ), //import directory \_\_DIR\_\_ ); return new Doctrine\Common\Collections\ArrayCollection(array($less)); }` zu finden auch in den DevDocs [hier](https://developers.shopware.com/developers-guide/shopware-5-plugin-update-guide/).

---

<div class="post-metadata">

**Author:** ![benda](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@benda](https://forum.shopware.com/u/benda)\
**Post date:** [13. Juni 2015 um 22:50 UTC](https://forum.shopware.com/t/plugin-fur-shopware-4-und-5-kompatibel-programmieren/28105/5 "2015-06-13T22:50:15Z")

</div>

Ich möchte aber eine normale CSS Datei verwenden. Funktioniert das damit auch?

---

<div class="post-metadata">

**Author:** ![Creatixx](https://avatars.discourse-cdn.com/v4/letter/c/c67d28/32.png) [@Creatixx](https://forum.shopware.com/u/Creatixx)\
**Post date:** [13. Juni 2015 um 22:55 UTC](https://forum.shopware.com/t/plugin-fur-shopware-4-und-5-kompatibel-programmieren/28105/6 "2015-06-13T22:55:19Z")

</div>

Ja geht, aber du musst glaube ich die .css in .less umbenennen damit der Less-Compiler sauber durchläuft.

---

<div class="post-metadata">

**Author:** ![benda](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@benda](https://forum.shopware.com/u/benda)\
**Post date:** [13. Juni 2015 um 23:40 UTC](https://forum.shopware.com/t/plugin-fur-shopware-4-und-5-kompatibel-programmieren/28105/7 "2015-06-13T23:40:36Z")

</div>

:thumbup: funktioniert super. Zur Info es funktioniert auch mit einer css Datei.
