Shaan
October 12, 2021, 7:53am
1
Hi,
eigentlich eine einfache Sache, dachte ich, als ich einen Block eines Plugins überschreiben wollte, da früher schon paar mal gemacht. Aber beim Bonus-Punkte Plugin gelingt es mir einfach nicht. Der Block wird doppelt ausgegeben.
ich habe einmal
/shopware/custom/plugins/SwagBonusSystem/Resources/views/frontend/detail/content buy_container.tpl
mit dem Inhalt:
{extends file='parent:frontend/detail/content/buy_container.tpl'}
{block name='frontend_detail_index_buy_container_base_info'}
{$smarty.block.parent}
{block name='frontend_detail_swag_bonus_system_index_buy_container_base_info'}
{include file='frontend/swag_bonus_system/detail/info.tpl'}
{/block}
{/block}
und im eigenem Theme habe ich unter
/shopware/themes/Frontend/MeinTHEME/frontend/detail/content buy_container.tpl
{extends file='parent:frontend/detail/content/buy_container.tpl'}
{block name='frontend_detail_index_buy_container_base_info'}
{$smarty.block.parent}
{block name='frontend_detail_swag_bonus_system_index_buy_container_base_info'}
BlaBlub
{/block}
{/block}
Im Theme.php ist protected $injectBeforePlugins ist auf false gestellt.
Was übersehe ich hier?
Vielen Dank für die Unterstützung
Shaan
Versuche mal bei deinem THEME den Block frontend_detail_swag_bonus_system_index_buy_container_base_info umzubenennen oder wegzulassen.
Shaan
October 12, 2021, 8:24am
3
Danke für deine Idee.
Ich habe
{block name=‚frontend_detail_swag_bonus_system_index_buy_container_base_info‘}
raus gelöscht - bringt aber nichts.
Der ursprüngliche Block wird immer noch angezeigt.
Ich hatte eher vermuttet, dass ich den Viwes nicht richtig gefolgt bin.
Ich hatte es auch unter
/shopware/themes/Frontend/MeinTheme/frontend/plugins/SwagBonusSystem/frontend/detail/content buy_container.tpl
versucht. Ohne Erfolg.
phil
October 12, 2021, 9:06am
4
Lass mal die Block-Verschachtelung im Theme weg und überschreibe nur direkt den Block des Plugins, die tpl muss dabei den gleichen Pfad wie die Originaldatei im Plugin haben:
{extends file='parent:frontend/plugins/SwagBonusSystem/frontend/detail/content/buy_container.tpl'}
{block name='frontend_detail_swag_bonus_system_index_buy_container_base_info'}
BlaBlub
{/block}
Vgl. auch Shopware Tutorial: Plugin Theme überschreiben und anpassen | 8mylez.com
LG Phil
1 Like
Shaan
October 12, 2021, 1:10pm
5
Hallo Phil!
Ja, es lag an der Verschachtelung, bzw. an dem Block:
{block name='frontend_detail_index_buy_container_base_info'}
So geht’s:
{extends file='parent:frontend/detail/content/buy_container.tpl'}
{block name='frontend_detail_swag_bonus_system_index_buy_container_base_info'}
{/block}
Verstehe ich nicht ganz, aber vielen Dank für die Hilfe.
phil
October 12, 2021, 3:12pm
6
Eigentlich ganz einfach, vgl. Template Inheritance | Smarty . Aber freut mich, dass es jetzt funktioniert
LG Phil