# Backend Plugin erstellen - brauche Hilfe

**URL:** https://forum.shopware.com/t/backend-plugin-erstellen-brauche-hilfe/37549
**Category:** Programmierung
**Created:** [18. Juni 2016 um 08:12 UTC](https://forum.shopware.com/t/backend-plugin-erstellen-brauche-hilfe/37549 "2016-06-18T08:12:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![uweheldt](https://avatars.discourse-cdn.com/v4/letter/u/ea5d25/32.png) [@uweheldt](https://forum.shopware.com/u/uweheldt)
#### Post date: [18. Juni 2016 um 08:12 UTC](https://forum.shopware.com/t/backend-plugin-erstellen-brauche-hilfe/37549/1 "2016-06-18T08:12:40Z")

</div>

Moin,

ich versuche in SW5 ein Backend-Plugin mit Menüpunkt zu erstellen. Das Plugin lässt sich installieren und der Menüpunkt erscheint auch. Allerdings sobald ich auf den Memüpunkt klicke, kommt nur das “… wird geladen…”&nbsp;und das wars. Das bleibt dann da und nichts passiert mehr. Was stimmt da nicht? Der Code ist anbei…

Bootstrap.php

```
 true,
				'enable' => true,
				'update' => true
			);
		}

		/**
		 * Plugin install method
		 */
		public function install() {

			if(!$this->assertVersionGreaterThen("4.3.0"))
				throw new Enlight_Exception("This Plugin needs min shopware 4.3.0");

			$this->createMenu();
			$this->subscribeEvents();
			

			return array('success' => true, 'invalidateCache' => array('config', 'frontend', 'backend', 'proxy'));
		}

		/**
		 * Plugin uninstall method
		 */
		public function uninstall() {
			return array('success' => true, 'invalidateCache' => array('config', 'frontend', 'backend', 'proxy'));
		}

		/**
		 * activates the plugin
		 */
		public function enable() {
			Shopware()->Db()->exec('UPDATE s_core_menu SET active=1 WHERE name = "TestUwe"');

			return true;
		}

		/**
		 * deactivates the plugin
		 */
		public function disable() {
			Shopware()->Db()->exec('UPDATE s_core_menu SET active=0 WHERE name = "TestUwe"');

			return true;
		}

		/**
		 * get label for this plugin
		*/
		public function getLabel() {
			return 'TestUwe';
		}

		/**
		 * Get version tag of this plugin to display in manager
		 */
		public function getVersion() {
			return '4.01.01';
		}

		/**
		 * get the main info for the plugin
		 */
		public function getInfo() {
			return array (
				'version' => $this->getVersion(),
				'autor' => 'Uwe Heldt',
				'copyright' => 'Uwe Heldt',
				'label' => $this->getLabel(),
				'support' => 'http://www.piloten-training.com',
				'link' => 'http://www.piloten-training.com'
			);
		}

		/**
		 * create menu entries for this plugin
		 */
		protected function createMenu() {
			$parent = $this->createMenuItem(array (
				'label' => 'TestUwe',
				'controller' => 'TestUwe',
				'class' => 'sprite-credit-cards',
				'action' => 'index',
				'active' => 1,
				'parent' => $this->Menu()->findOneBy('label', 'Marketing')
			));
		}

		/**
		 * create Events/Hooks for the plugin
		 */
		protected function subscribeEvents() {
			// Events für Backend- und Frontend-Controller
			$this->subscribeEvent('Enlight_Controller_Dispatcher_ControllerPath_Backend_TestUwe', 'onGetControllerPathBackend');		
		}

		/**
		 * get the backend controller path
		 */
		public function onGetControllerPathBackend(Enlight_Event_EventArgs $args) {
			$this->Application()->Template()->addTemplateDir($this->Path() . 'Views/');

			return $this->Path() . '/Controllers/Backend/TestUwe.php';
		}
		
	}
?>

```

&nbsp;

TestUwe.php

```
View()->addTemplateDir(dirname( __FILE__ ) . "/Views/");
        parent::init();
    }

		/**
		 * index action is called if no other action is triggered
		 */
		public function indexAction()
		{
			$this->View()->loadTemplate("backend/Test_Uwe/app.js");
		}
	}
?>

```

app.js

```
//{block name="backend/test_uwe/application"}
	Ext.define('Shopware.apps.TestUwe', {
		name: 'Shopware.apps.TestUwe',
		extend: 'Enlight.app.SubApplication',
		loadPath: '{url action=load}',
		bulkLoad: true,
		defaultController: 'Main',
		controllers: [
			'Main'
		],
		launch: function() {
			var me = this;

			var controller = me.getController('Main');

			return controller.mainWindow;
		}
	});
//{/block}

```

&nbsp;

main.js

```
// {namespace name=backend/TestUwe/controller}
// {block name=backend/TestUwe/controller/main}
Ext.define('Shopware.apps.TestUwe.controller.Main', {

    extend: 'Ext.app.Controller',

    mainWindow: null,

    init: function () {
        var me = this;

        me.mainWindow = me.getView('list.Window').create({ }).show();

        me.callParent(arguments);
    }
});
// {/block}

```

product.js

```
Ext.define('Shopware.apps.TestUwe.view.list.Product', {
    extend: 'Shopware.grid.Panel',
    alias: 'widget.product-listing-grid',
    region: 'center',

    configure: function() {
        return {
            detailWindow: 'Shopware.apps.TestUwe.view.detail.Window'
        };
    }
});

```

window.js

```
Ext.define('Shopware.apps.TestUwe.view.list.Window', {
    extend: 'Shopware.window.Listing',
    alias: 'widget.product-list-window',
    height: 450,
    title : '{s name=window_title}Product listing{/s}',

    configure: function() {
        return {
            listingGrid: 'Shopware.apps.TestUwe.view.list.Product',
            listingStore: 'Shopware.apps.TestUwe.store.Product'
        };
    }
});

```

product.js

```
Ext.define('Shopware.apps.TestUwe.view.detail.Product', {
    extend: 'Shopware.model.Container',
    padding: 20,

    configure: function() {
        return {
            controller: 'TestUwe'
        };
    }
});

```

&nbsp;

---

<div class="post-metadata">

### Author: ![uweheldt](https://avatars.discourse-cdn.com/v4/letter/u/ea5d25/32.png) [@uweheldt](https://forum.shopware.com/u/uweheldt)
#### Post date: [19. Juni 2016 um 15:56 UTC](https://forum.shopware.com/t/backend-plugin-erstellen-brauche-hilfe/37549/2 "2016-06-19T15:56:39Z")

</div>

Irgendwelche Ideen woran das liegen kann? Ich bin ein wenig ratlos&nbsp;

danke im voraus&nbsp;

---

<div class="post-metadata">

### Author: ![DanielNogel](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@DanielNogel](https://forum.shopware.com/u/DanielNogel)
#### Post date: [19. Juni 2016 um 16:21 UTC](https://forum.shopware.com/t/backend-plugin-erstellen-brauche-hilfe/37549/3 "2016-06-19T16:21:53Z")

</div>

Hi,

zwei Kleinigkeiten, die mir aufgefallen sind: In den Views muss es „test\_uwe“ heißen, bei dir steht da „Test\_Uwe“. Weiterhin muss der Controller keine indexAction haben, das macht Shopware automatisch, wenn du von&nbsp;Shopware\_Controllers\_Backend\_ExtJs ableitest.

Weiß aber nicht, ob es wirklich daran liegt - aber die sind mir jetzt aufgefallen 🙂

Besten Gruß,

Daniel

---

<div class="post-metadata">

### Author: ![uweheldt](https://avatars.discourse-cdn.com/v4/letter/u/ea5d25/32.png) [@uweheldt](https://forum.shopware.com/u/uweheldt)
#### Post date: [19. Juni 2016 um 17:46 UTC](https://forum.shopware.com/t/backend-plugin-erstellen-brauche-hilfe/37549/4 "2016-06-19T17:46:18Z")

</div>

Das wars leider auch nicht. Gibt es eine Möglichkeit zu sehen woran es liegt? Logfiles oder sowas? Firebug usw habe ich schon. Da steht nichts&nbsp;

---

<div class="post-metadata">

### Author: ![simkli](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/simkli/32/13124_2.png) [@simkli](https://forum.shopware.com/u/simkli)
#### Post date: [19. Juni 2016 um 19:31 UTC](https://forum.shopware.com/t/backend-plugin-erstellen-brauche-hilfe/37549/5 "2016-06-19T19:31:08Z")

</div>

> [@uweheldt schrieb:](https://forum.shopware.com/profile/23649/uweheldt "uweheldt")
> 
> Das wars leider auch nicht. Gibt es eine Möglichkeit zu sehen woran es liegt? Logfiles oder sowas? Firebug usw habe ich schon. Da steht nichts&nbsp;

Ja eine Möglichkeit wäre, dass du [die Browserkonsole öffnest](http://webmasters.stackexchange.com/a/77337)&nbsp;&nbsp;und prüfst, ob nach dem Klick im Backend eine Fehlermeldung dort erschient. Wenn ja poste sie hier und wir können dir vlt. weiterhelfen&nbsp; ![Wink](http://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/wink.png "Wink")
