Skip to main content

Q. How to pass variables from layout to block?

<action method=”setData”><name>category_id</name><value>3</value></action>
In the block, this can be retrieved by..
$categoryId = $this->getCategoryId();
$categoryId = $this->getData(‘category_id’);

By Michael Cristancho

I'm a Digital Commerce and Experience evangelist who enjoys engaging in thought-provoking conversation and mutual exploration. I am a strong believer that learning never ends, and each day brings another opportunity to grow as an individual and professional.