Custom Combobox Template Extjs Backend

Hallo,

ich versuche im Backendplugin ein Customtemplate für die Combobox zu nutzen. Und zwar soll jedes Item im Dropdown eine andere Schriftart bekommen.

return me.fontField = Ext.create('Ext.form.ComboBox', {
            fieldLabel: 'Schriftart',
            store: me.createStore(),
            queryMode: 'local',
            displayField: 'name',
            valueField: 'style',
			tpl: Ext.create('Ext.XTemplate',
							'',
								'{name}',
							''
			),
			listeners:{
                scope: this,
                select: me.onFontChange,
            }
        });

so versuche ich es aktuell. Problem ist Shopware wirft nun sofort einen Fehler, wenn ich die Einkaufswelten aufrufe im Backend (Plugin ist eine Erweiterung der Einkaufswelten)

Ups! Ein Fehler ist aufgetreten!

Die nachfolgenden Hinweise sollten Ihnen weiterhelfen.

Syntax Error in template "/var/www/shop2/engine/Shopware/Plugins/Community/Backend/TBCounterBannerEmotionElement/Views/emotion_components/backend/emotion-components-counter.js" on line 86 "'<div class="x-boundlist-item" style="font-family: Indie Flower;">{name}</div>'," unknown tag "name" in engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 657
Stack trace:

#0 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(443): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag "na...', 86)
#1 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(2393): Smarty_Internal_TemplateCompilerBase->compileTag('name', Array)
#2 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r37()
#3 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(37)
#4 engine/Library/Smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(10, '</div>',\r\n'</tp...')
#5 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(192): Smarty_Internal_SmartyTemplateCompiler->doCompile('Ext.define('Sho...')
#6 engine/Library/Smarty/sysplugins/smarty_internal_compile_include.php(146): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Enlight_Template_Default))
#7 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(475): Smarty_Internal_Compile_Include->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL)
#8 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(249): Smarty_Internal_TemplateCompilerBase->callTagCompiler('include', Array, Array)
#9 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(2388): Smarty_Internal_TemplateCompilerBase->compileTag('include', Array)
#10 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r36()
#11 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(36)
#12 engine/Library/Smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(10, '\n')
#13 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(192): Smarty_Internal_SmartyTemplateCompiler->doCompile('\n{include file=...')
#14 engine/Library/Smarty/sysplugins/smarty_internal_compile_block.php(195): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Smarty_Internal_Template))
#15 engine/Library/Smarty/sysplugins/smarty_internal_compile_block.php(255): Smarty_Internal_Compile_Block::compileChildBlock(Object(Smarty_Internal_SmartyTemplateCompiler), 'backend/Emotion...')
#16 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(475): Smarty_Internal_Compile_Blockclose->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL)
#17 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(249): Smarty_Internal_TemplateCompilerBase->callTagCompiler('blockclose', Array, Array)
#18 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(2493): Smarty_Internal_TemplateCompilerBase->compileTag('blockclose', Array)
#19 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r58()
#20 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(58)
#21 engine/Library/Smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(10, '\n')
#22 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(192): Smarty_Internal_SmartyTemplateCompiler->doCompile('/**\n * Shopware...')
#23 engine/Library/Smarty/sysplugins/smarty_internal_template.php(187): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Enlight_Template_Default))
#24 engine/Library/Smarty/sysplugins/smarty_internal_templatebase.php(155): Smarty_Internal_Template->compileTemplateSource()
#25 engine/Library/Enlight/View/Default.php(274): Smarty_Internal_TemplateBase->fetch()
#26 engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(216): Enlight_View_Default->render(Object(Enlight_Template_Default))
#27 engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(242): Enlight_Controller_Plugins_ViewRenderer_Bootstrap->renderTemplate(Object(Enlight_Template_Default))
#28 engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(136): Enlight_Controller_Plugins_ViewRenderer_Bootstrap->render()
#29 [internal function]: Enlight_Controller_Plugins_ViewRenderer_Bootstrap->onPostDispatch(Object(Enlight_Controller_ActionEventArgs))
#30 engine/Library/Enlight/Event/Handler/Default.php(91): call_user_func(Array, Object(Enlight_Controller_ActionEventArgs))
#31 engine/Library/Enlight/Event/EventManager.php(214): Enlight_Event_Handler_Default->execute(Object(Enlight_Controller_ActionEventArgs))
#32 engine/Library/Enlight/Controller/Action.php(202): Enlight_Event_EventManager->notify('Enlight_Control...', Object(Enlight_Controller_ActionEventArgs))
#33 engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('indexAction')
#34 engine/Library/Enlight/Controller/Front.php(223): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp))
#35 engine/Shopware/Kernel.php(180): Enlight_Controller_Front->dispatch()
#36 vendor/symfony/http-kernel/HttpCache/HttpCache.php(487): Shopware\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 engine/Shopware/Components/HttpCache/AppCache.php(255): Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(Object(Symfony\Component\HttpFoundation\Request), true, NULL)
#38 vendor/symfony/http-kernel/HttpCache/HttpCache.php(258): Shopware\Components\HttpCache\AppCache->forward(Object(Symfony\Component\HttpFoundation\Request), true)
#39 engine/Shopware/Components/HttpCache/AppCache.php(103): Symfony\Component\HttpKernel\HttpCache\HttpCache->pass(Object(Symfony\Component\HttpFoundation\Request), true)
#40 shopware.php(117): Shopware\Components\HttpCache\AppCache->handle(Object(Symfony\Component\HttpFoundation\Request))
#41 {main}

Scheinbar hat er kein Zugriff auf den {name}. Laut Docs von Extjs 4.1 soll es aber so eigentlich gehen. Was mache ich hier falsch?

 

LG

Vielleicht {$name} ?

@R4M schrieb:

Vielleicht {$name} ?

Nein leider nicht. Dann spuckt er zwar kein Fehler mehr aber dann wäre es ja eine Smartyvariable. Sprich immer leer 

Für alle Interessierten hier die Lösung:

Das ganze wird durch die {} als Smarty interpretiert => Lösung: {literal}{name}{/literal}

 

Vielen Dank an Philipp M. (Facebook)

1 „Gefällt mir“