Quantcast
Channel: Programmierung - Shopware Community Forum
Viewing all articles
Browse latest Browse all 2871

Plugin für die Einkaufswelten

$
0
0

Hallo Community,

ich erstelle gerade ein Plugin für die Einkaufswelt, in diesem Plugin sollen die Kategorien im Content als Navigation ausgegeben werden.

Mein Problem ist, wenn ich in der Bootstrap.php über $view->assign('lorem', 'Lorem ipsum dolor sit amet'); eine Variable mit einem String belege kommt keine Ausgabe {$lorem} in meiner *.tpl Datei.

Wie muss ich mein Code anpassen damit ich eine Ausgabe bekomme?

System:
Shopware 5.1.1
Professional Edition

Bootstrap.php:

<?php
class Shopware_Plugins_Frontend_EmotionContentNavigation_Bootstrap 
    extends Shopware_Components_Plugin_Bootstrap
{
    public function getCapabilities()
    {
        return array(
            'install' => true,
            'update' => true,
            'enable' => true
        );
    }
 
    public function getLabel()
    {
        return 'Emotion Content Navigation';
    }
 
    public function getVersion()
    {
        return '1.0.0';
    }
 
    public function getInfo()
    {
        return array(
            'version' => $this->getVersion(),
            'autor'       => '',
            'copyright'   => '© 2016 ',
            'label' => $this->getLabel(),
            'supplier' => '',
            'description' => 'Content Navigation',
            'support' => '',
            'link' => ''
        );
    }
 
    public function install()
    {
        $component = $this->createEmotionComponent(array(
                    'name' => 'Content Navigation',
                    'description' => 'Content Navigation',
                    'template' => 'component_content_navigation_dw',
                    'cls' => 'content-navigation-dw'
        ));

        $this->subscribeEvent(
            'Enlight_Controller_Action_PostDispatch_Frontend_Index',
            'onFrontendPostDispatch'
        );

        return true;
    }

    public function onFrontendPostDispatch(Enlight_Event_EventArgs $args)
    {
        $view = $args->getSubject()->View();
        $view->addTemplateDir($this->Path() . 'Views/');
        $view->extendsTemplate('emotion_components/widgets/emotion/components/component_content_navigation_dw.tpl');
        $view->assign('lorem', 'Lorem ipsum dolor sit amet');
    }

}

component_content_navigation_dw.tpl:

{block name="widget_emotion_content_navigation"}
<div class="test_emotion">
    <h2>Test emotion Content Navi</h2>
    <p>{$lorem}</p>
</div>
{/block}


Vielen Dank im Voraus.

Gruß Holger


Viewing all articles
Browse latest Browse all 2871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>