Magento- How to passing data between model and controller

南楼画角 提交于 2019-12-11 17:26:42

问题


Thanks for previous replies,

I am new to magento framework. can anyone guide me how to get the return values from model to controller. in simple i want to return the values from model folder to controller action.


回答1:


I think this will do what you want

 $collection = Mage::getModel('<module>/<module>')->getCollection();

<module> represents model name




回答2:


In Magento, controller sets values on Models, then Blocks and templates reads them from the those Models. For example, we can set a string hello by using core/session model

Mage::getSingleton('core/session')->setHello('hello');

Then we can get this hello from a block or a template or anywhere else by

Mage::getSingleton('core/session')->getHello();


来源:https://stackoverflow.com/questions/7792518/magento-how-to-passing-data-between-model-and-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!