Shopware pflügt manchmal mit einer komischen Mischung aus Objekten und Arrays durch das Template, beispielweise auf den Herstellerseiten:
Shopware\Bundle\StoreFrontBundle\Struct\Product\Manufacturer Object
(
[id:protected] => 1
[name:protected] => Anton Schneider
[description:protected] =>
[metaTitle:protected] =>
[metaDescription:protected] =>
[metaKeywords:protected] =>
[link:protected] => https://dev.wibros.eu/anton-schneider/
[coverFile:protected] => https://cdn.cuckoopalace.com/media/vector/4c/76/c3/schneider.svg
[attributes:protected] => Array
(
[core] => Shopware\Bundle\StoreFrontBundle\Struct\Attribute Object
(
[storage:protected] => Array
(
[id] => 1
[supplierID] => 1
[wan] => AS
[wib_class] => schneider
)
)
)
) |
Leider unterstützt Smarty die in php mittlerweile gültige Syntax get()['arraykey'] nicht.
{$manufacturer.getAttributes()['core']->get("wib_class")} |
führt also zu einem Parse Error. Um jetzt doch an wib_class zu kommen muss man einen komischen Spagat machen:
{assign var="attr" value=$manufacturer->getAttributes()} {assign var="class" value=$attr.core->get("wib_class")} |
Bleibt die Frage: Warum?