我創建了一個可在管理員中訪問的模塊。在該模塊中,我在.phtml(模板)文件中創建了一個表單,並在通過javascript驗證後,我想將這些值保存在產品表中的數據庫中。我搜查了很多,但我無法打電話給腳本!請指導我如何將呼叫發送到php腳本併成功獲取數據,我必須創建哪些模塊,控制器等來執行此操作?這裏是我的模塊結構,使阿賈克斯呼籲,Ajax調用magento中的php腳本
代碼 - >本地 - > myspace-> mymodule - >(模型,控制器等,助手),我已經包含模板文件在adminhtml->默認 - >默認 - >模板。
config.xml文件:
<?xml version="1.0"?>
<config>
<modules>
<Inchoo_CoffeeFreak>
<version>0.1.0</version>
</Inchoo_CoffeeFreak>
</modules>
<global>
<blocks>
<coffefreakblock1>
<class>Inchoo_CoffeeFreak_Block</class>
</coffefreakblock1>
<coffefreakblock2>
<class>Inchoo_CoffeeFreak_Block_EditSpecial</class>
</coffefreakblock2>
</blocks>
<helpers>
<coffefreakhelper1>
<class>Inchoo_CoffeeFreak_Helper</class>
</coffefreakhelper1>
</helpers>
</global>
<admin>
<routers>
<samplerouter1>
<use>admin</use>
<args>
<module>Inchoo_CoffeeFreak_AdminControllersHere</module>
<frontName>admin</frontName>
<modules>
<sintax after="Inchoo_CoffeeFreak_AdminControllersHere">Mage_Adminhtml</sintax>
</modules>
</args>
</samplerouter1>
</routers>
</admin>
<adminhtml>
<menu>
<mymenu1 translate="title" module="coffefreakhelper1">
<title>PrintInfo</title>
<sort_order>20</sort_order>
<children>
<!-- Note the misleading "module" attribute.
It actualy refers to one of the declared helpers -->
<myitem1 translate="title" module="coffefreakhelper1">
<title>Add configuration</title>
<action>samplerouter1/FreakOut</action>
<sort_order>1</sort_order>
</myitem1>
<myitem2 translate="title" module="coffefreakhelper1">
<title>Change configuration</title>
<action>samplerouter1/FreakOut2</action>
<sort_order>2</sort_order>
</myitem2>
</children>
</mymenu1>
</menu>
</adminhtml>
</config>
您可以將您的代碼 –
你的意思是代碼 - >本地的config.xml - > myspace-> mymodule-> etc-> config.xml? – MJQ
您是否想添加或更新產品? –