Print serialized array values in smarty

I have a MySQL table which have data like this in a column:


and i want to pick one value for example “QuantityUOM” and show in table in admin list. What i am having trouble is data is coming from model and looping through all articles in template and showing data but then this one column have serialized array data from which i want to pick one value and show.

How can i unserialize this serialized data and show value in smarty template?

1 Like

Yes i already searched as you can see the pictures, but it doesn’t seem to be working. That’s why i posted in the forum. :slightly_smiling_face:

“doesn’t seem to be working” is not a qualified problem description. Is there no output at all? Parse error? Shop exception?
Also, are you sure your serialized data is in correct format? I’m getting errors when unserializing it

1 Like

Don’t know why it wasn’t posting so i attached the image. :roll_eyes:

looks like you forgot to unserialize it.
Make var_dumps of your data in every step (before unserializing, after unserializing, foreach item), so you know in every step what your data looks like.

Sorry if i have created confusion but i used the foreach loop like that:

[{foreach from=$item->some_table__oxadditional->value | unserialize item=finalItem}]



you need smarty delimiters around your [{ code }], otherwise smarty does not recognize it.

Also, as already mentioned before: make var_dumps of your data in every step.
If you had done [{$finalItem|@var_dump}], you would know why your foreach does not work.

1 Like