{block name='productdetails-tabs' append}
<div class="container">
{block name='productdetails-clp'}
{row class="clp"}
{col}<h3 class="clp" id="clp">{lang key='CLP' section='mnnetzwerk_clp_info'} - {$Artikel->cName}</h3>{/col}
{/row}
{/block}
</div>
{/block}
Auch in der tpl oder wo muss ich das implementierenHängt halt davon ab, wo du das aufrufst, da müsste $plugin definiert sein, damit es geht.
Code:// i.e. within Bootstrap.php in the boot method: $plugin = $this->getPlugin();
{block name='productdetails-tabs' append}
<div class="container clpbox"> {block name='productdetails-clp'}
{row class="clp clphead"}
{col cols=12}
<h3 class="clp" id="clp">{lang key='CLP' section='mnnetzwerk_clpinfo'} - {$Artikel->cName}</h3>
{/col}
{/row}
{row class="clp"}
{col cols=12 lg=4 class='clp1b'}Piktogramm(e){/col}
{col cols=12 lg=8 class='clp1'} {/col}
{/row}
{row class="clp bg-light"}
{col cols=12 lg=4 class='clp1b'}Signalwort{/col}
{col cols=12 lg=8 class='clp1'} {/col}
{/row}
{row class="clp"}
{col cols=12 lg=4 class='clp1b'}Gefahrenhinweise{/col}
{col cols=12 lg=8 class='clp1'}
{assign var="string" value=$Artikel->FunktionsAttribute.hsentences} //// Eigenes Feld aus Clp_Hsentences
{assign var=hsentences value=","|explode:$string}
{foreach from=$hsentences item=foo}{lang key={$foo} section='CLP'}<br>
{/foreach}
{/col}
{/row}
{row class="clp bg-light"}
{col cols=12 lg=4 class='clp1b'}Sicherheitshinweise{/col}
{col cols=12 lg=8 class='clp1'} {/col}
{/row}
{row class="clp"}
{col cols=12 lg=4 class='clp1b'}Besondere Kennzeichnung bestimmter Gemische{/col}
{col cols=12 lg=8 class='clp1'}Besondere Kennzeichnung bestimmter Gemische{/col}
{/row}
{/block}
</div>
{/block}
<Setting type="text" initialValue="Piktogramm" sort="1" conf="Y">
<Name>Eigenes Feld Piktogramme</Name>
<Description>Eigenes Feld Piktogramme</Description>
<ValueName>Clp_Piktogramm</ValueName>
</Setting>
<Setting type="text" initialValue="Signalwort" sort="1" conf="Y">
<Name>Eigenes Feld Signalwort</Name>
<Description>Eigenes Feld Signalwort</Description>
<ValueName>Clp_Signalwort</ValueName>
</Setting>
<Setting type="text" initialValue="Hsentences" sort="1" conf="Y">
<Name>Eigenes Feld Hsentences</Name>
<Description>Eigenes Feld Hsentences</Description>
<ValueName>Clp_Hsentences</ValueName>
</Setting>
<Setting type="text" initialValue="Psentences" sort="1" conf="Y">
<Name>Eigenes Feld Psentences</Name>
<Description>Eigenes Feld Psentences</Description>
<ValueName>Clp_Psentences</ValueName>
</Setting>
<Setting type="text" initialValue="EUHSentences" sort="1" conf="Y">
<Name>Eigenes Feld EUHSentences</Name>
<Description>Eigenes Feld EUHSentences</Description>
<ValueName>Clp_EUHSentences</ValueName>
</Setting>
<Setting type="text" initialValue="sensiblerstoff" sort="1" conf="Y">
<Name>Eigenes Feld Sensible Stoffe</Name>
<Description>Eigenes Feld sensiblerstoff</Description>
<ValueName>Clp_sensiblerstoff</ValueName>
</Setting>
<?php declare(strict_types=1);
namespace Plugin\my_plugin_id;
use JTL\Events\Dispatcher;
use JTL\Plugin\Bootstrapper;
use JTL\Smarty\JTLSmarty;
class Bootstrap extends Bootstrapper
{
public function boot(Dispatcher $dispatcher)
{
parent::boot($dispatcher);
$dispatcher->listen('shop.hook.' . \HOOK_SMARTY_INC, function (array $args) {
/** @var JTLSmarty $smarty */
$smarty = $args['smarty'];
$smarty->assign('myCustomVariable', $this->getPlugin()->getConfig()->getValue('myCustomOption'));
});
}
}
Danke das war es !Minimalbeispiel:
Code:<?php declare(strict_types=1); namespace Plugin\my_plugin_id; use JTL\Events\Dispatcher; use JTL\Plugin\Bootstrapper; use JTL\Smarty\JTLSmarty; class Bootstrap extends Bootstrapper { public function boot(Dispatcher $dispatcher) { parent::boot($dispatcher); $dispatcher->listen('shop.hook.' . \HOOK_SMARTY_INC, function (array $args) { /** @var JTLSmarty $smarty */ $smarty = $args['smarty']; $smarty->assign('myCustomVariable', $this->getPlugin()->getConfig()->getValue('myCustomOption')); }); } }
Dann könntest du in deinem Template auf die Smarty-Variable $myCustomVariable zugreifen, die den Wert der Option "myCustomOption" hat.
Nein.gibt er eigentlichen eine andere Möglichkeit Sprachvariablen außer über die info.xml zu definieren?
<?php
use JTL\Events\Dispatcher;
use JTL\Plugin\Bootstrapper;
use JTL\Smarty\JTLSmarty;
use JTL\Session\Frontend;
......
if ( file_exists( $datei ) ) // Prüfen ob Datei auf dem Server verfügbar ist
{
.....
} else {
$plug_error = "Die Datei steht nicht zum Download zur Verfügung!"; .
}
//---- TEMPLATE VARS
global $smarty;
$smarty->assign('plug_error', $plug_error);
?>
{row}
{col}
{$plug_error}
{/col}
{/row}