Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Retrieving object from multidimensional array

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Vassago
Smarty n00b


Joined: 16 May 2017
Posts: 1

PostPosted: Tue May 16, 2017 4:40 pm    Post subject: Retrieving object from multidimensional array Reply with quote

Greetings,

I'm new to Smarty and PHP and I'm trying to access the object "emotionlink" from the following part of code:

Code:
Array
(
    [id] => 4
    [name] => The Great Night
    [description] =>
    [metaTitle] =>
    [metaDescription] =>
    [metaKeywords] =>
  [link]=>shopware.phpcontroller=listing&action=manufacturer&sSupplier=4
    [image] => http://app.dev/media/image/70/ff/d6/thegreatnight.png
    [attributes] => Array
        (
            [core] => Shopware\Bundle\StoreFrontBundle\Struct\Attribute Object
                (
                    [storage:protected] => Array
                        (
                            [id] => 3
                            [supplierID] => 4
                            [emotionlink] => testing-landing-page
                        )

                )

        )

    [website] => http://app.dev/the-great-night/
)
1


Went through the documentation (Smarty 2) but nothing seems to be working. Any suggestions?

Thank you for your patience. Smile
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue May 16, 2017 10:16 pm    Post subject: Reply with quote

According to https://git.euroblaze.de:50090/nebiz/zett-project/blob/0365ec4cd02cec5fc6fae7b952499b2ba73633fb/shopware/engine/Shopware/Bundle/StoreFrontBundle/Struct/Attribute.php you have to use Attribute::get('name') to access the "Attribute::$storage".
Code:
{$var.attributes.core->get('emotionlink')}

Pity they do not implement ArrayAccess or simple magic calls.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP