我创建了一个可在管理员中访问的模块。在该模块中,我在 .phtml(template) 文件中创建了一个表单,并在通过 javascript 对其进行验证后,我想将数据库中的值保存在 products 表中。我搜索了很多,但我无法调用脚本!请指导我如何将调用发送到 php 脚本并成功获取数据,我必须创建哪些模块、控制器等来做到这一点?这是我进行ajax调用的模块结构,
code->local->myspace->mymodule->(model,controllers,etc,helper) 我在 adminhtml->default->default->templates 中包含了模板文件。
配置.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>