I am creating a custom module in Magento. I want to know how to pass data from the .phtml file to the Controller and then to the Model.

Just want to know the structure of passing the data in the magento MVC structure.

有帮助吗?

解决方案

Simple you can call you controller from phtml like

Mage::getBaseUrl()/Modulename/Controllername/methodname

and to call Model

Mage::getModel('modulename/modelname')->methodname()

Example For controller

Mage::getBaseUrl()/priceconfig/index/checkcountryrate?price=$price

Where priceconfig is my module-name and index is my controller name and checkcountryrate is my method

Example For Model

Mage::getModel('catalog/product')->load(1)

Please first read article about how magento MVC works then you can easily understand

Let me know if you have any query

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top