# Extra Element auf Bezahlseite

**URL:** <https://forum.shopware.com/t/extra-element-auf-bezahlseite/71409>\
**Category:** Programmierung\
**Created:** [7. Dezember 2020 um 11:59 UTC](https://forum.shopware.com/t/extra-element-auf-bezahlseite/71409 "2020-12-07T11:59:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![braesident](https://avatars.discourse-cdn.com/v4/letter/b/7993a0/32.png) [@braesident](https://forum.shopware.com/u/braesident)\
**Post date:** [7. Dezember 2020 um 11:59 UTC](https://forum.shopware.com/t/extra-element-auf-bezahlseite/71409/1 "2020-12-07T11:59:46Z")

</div>

Shop 5.6.9

PHP 7.2.34 & 7.4.11

Hallöchen, seit Tagen versuche ich auf der letzten Seite des Bezahlvorgangs unten neben dem ‚Zahlungspflichtig bestellen‘ Button ein Element hinzuzufügen.

Gefühlte 3000 Beiträge später und diverse Ansätze mit Subscribern und Controllern will es mir immer noch nicht gelingen.

Ich denke es fehlt das richtige Event… !? Ich hoffe mir kann da jemand weiter helfen.

EDIT:

- Ich habe nun nochmal das Beispiel aus der&nbsp;[Dokumentation](https://developers.shopware.com/developers-guide/shopware-5-plugin-update-guide/)&nbsp;als neues Plugin bis einschließlich der Config nachgebildet… auch hier wird keine Template Änderung sichtbar. Ein&nbsp;_var\_dump($this-\>templateManager-\>getTemplateDir());_ nach dem Aufruf von addTemplateDir() zeigt mir aber das onPreDispatch der TemplateRegistration.php aufgerufen wird.
- Irgend etwas fehlt… aber ich komm nicht drauf

Aktueller Stand:&nbsp;

```
class MyPlugin extends Plugin
{
    /**
     * {@inheritDoc}
     * @see \Shopware\Components\Plugin::getSubscribedEvents()
     */
    public static function getSubscribedEvents()
    {
        /** Der Übersicht wegen zeigen alle Events auf die selbe Funktion */
        return [
            'Enlight_Controller_Action_PostDispatchSecure_Frontend_Checkout' => 'onPayment',
            'Enlight_Controller_Action_PreDispatch_Frontend_Payment' => 'onPayment',
            'Enlight_Controller_Action_PreDispatch_Frontend_Checkout' => 'onPayment',
        ];
    }

    public function onPayment($args)
    {
        $tplPath = $this->getPath() . '\\Views';
        $view = $args->getSubject()->View();
        $view->addTemplateDir($tplPath);
    }
}

```

MyPlugin/Subscriber/MyPluginTemplateSubscriber.php

```
class MyPluginTemplateSubscriber implements SubscriberInterface
{
    private $pluginDirectory;
    
    private $templateManager;
    
    public function __construct($pluginDirectory, \Enlight_Template_Manager $templateManager)
    {
        $this->pluginDirectory = $pluginDirectory;
        $this->templateManager = $templateManager;
    }

    public static function getSubscribedEvents()
    {
        return [
            'Enlight_Controller_Action_PreDispatch' => 'onPreDispatch',
            'Enlight_Controller_Action_PostDispatch' => 'onPostDispatch',
            'Enlight_Controller_Front_PreDispatch' => 'onFrontPreDispatch',
        ];
    }
    
    /**
     * @param \Enlight_Event_EventArgs $args
     */
    public function onPreDispatch(\Enlight_Event_EventArgs $args)
    {
        $this->templateManager->addTemplateDir($this->pluginDirectory . '\\Views');
    }
    
    public function onPostDispatch(\Enlight_Event_EventArgs $args)
    {
        $this->templateManager->addTemplateDir($this->pluginDirectory . '\\Views');
    }
    
    public function onFrontPreDispatch(\Enlight_Event_EventArgs $args)
    {
        $this->templateManager->addTemplateDir($this->pluginDirectory . '\\Views');
    }
}

```

MyPlugin/Resources/services.xml

```
            %my_plugin.plugin_dir%

```

MyPlugin/Views/frontend/ckeckout/confirm.tpl

```
{extends file="parent:frontend/checkout/confirm.tpl"}

{block name='frontend_checkout_confirm_confirm_table_actions'}
	{$smarty.block.parent}
	Mein Block
{/block}

```

&nbsp;
