doukong1391
2010-11-18 10:23
浏览 67
已采纳

Magento表单未在自定义模块中发布

I created a new module and a new top level menu item in the Admin section. I also created a few views in the templates/[mymodule] folder, with forms I want to use in my app. The purpose of the module is to contain all the custom functionality for my client's store, firstly a small form to edit product recurring-delivery subscriptions on-the-fly.

I successfully created a non-EAV data model from a multi-table join, and populated the default view (called in index/index and loaded through the menu item) with the records. Next step, to install the "search by email address" form.

My form consists of

<form id="search_form" name="search_form" method="post" action="<?php echo $this->getUrl('editsubs/index/post') ?>">
Search by Email: < input type="text" name="emailsearch" id="emailsearch" />< /form> < button onclick="searchForm.submit()" class="scalable save" type="button">
<script type="text/javascript">
    var searchForm = new varienForm('search_form');
</script>

and I have verified the URL is properly formed and it is trying to post; however the URL editsubs/index/post is not found and Magento redirects to the dashboard.

Could missing items in config.xml cause this behavior or is there some other reason this might be occuring? Something I'm overlooking?

Magento version CE 1.4.1.1. I'm purposely keeping this very bare-bones and NOT building it on top of SaRP or using their forms.

Routers section of config is:

<admin>
        <routers>
            <Editsubscr2>
                <use>admin</use>
                <args>
                    <module>Kindbars_Editsubscr2< /module>
                    <frontName>editsubs</ frontName>
                </args>
            </Editsubscr2>
        </routers>
    </admin>

Thanks in advance!!

Kris

图片转代码服务由CSDN问答提供 功能建议

我在Admin部分创建了一个新模块和一个新的顶级菜单项。 我还在templates / [mymodule]文件夹中创建了一些视图,其中包含我想在我的应用中使用的表单。 该模块的目的是包含我客户的商店的所有自定义功能,首先是一个小型表单,用于即时编辑产品定期交付订阅。

我成功创建了一个非 -EAV数据模型来自多表连接,并使用记录填充默认视图(在索引/索引中调用并通过菜单项加载)。 下一步,安装“通过电子邮件地址搜索”表单。

我的表单包含

 &lt; form id =“search_form  “name =”search_form“method =”post“action =”&lt;?php echo $ this-&gt; getUrl('editsubs / index / post')?&gt;“&gt; 
按电子邮件搜索:&lt;  input type =“text”name =“emailsearch”id =“emailsearch”/&gt;&lt;  /形式&GT;  &LT;  button onclick =“searchForm.submit()”class =“Scalable save”type =“button”&gt; 
&lt; script type =“text / javascript”&gt; 
 var searchForm = new varienForm('search_form'); \  n&lt; / script&gt; 
   
 
 

我已经验证了网址是否正确形成并且正在尝试发布; 但是找不到URL editsubs / index / post ,并且Magento重定向到仪表板。

config.xml中缺少的项目是否会导致此行为或是否存在某些行为 这可能发生的其他原因? 我忽视的东西?

Magento版本CE 1.4.1.1。 我故意保留这些非常简单的东西,而不是在SaRP之上构建它或使用它们的形式。

配置的路由器部分是:

 &lt; admin&gt; 
&lt; routers&gt; 
&lt; Editsubscr2&gt; 
&lt; use&gt; admin&lt; / use&gt; 
&lt; args&gt; 
&lt; module&gt; Kindbars_Editsubscr2&lt;  / module&gt; 
&lt; frontName&gt; editsubs&lt; / frontName&gt; 
&lt; / args&gt; 
&lt; / Editsubscr2&gt; 
&lt; / routers&gt; 
&lt; / admin&gt; 
   
 
 

提前致谢!!

Kris

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dttphb59319 2010-11-18 13:15
    已采纳

    When the admin section redirects back to the dashboard, it is often because there was an exception or an error while loading the page.

    Try enabling logging and checking your logs to see if you had an exception. If that doesn't work, Alan Storm has a plugin to view routes that you may want to try.

    As a slightly murkier possible cause, do you have safe URLs turned on right now? If your admin URLs have long alphanumeric tokens specified, you do. Your form may need to specify a token in order for Magento to allow access to that URL.

    Hope that helps!

    Thanks, Joe


    UPDATE:

    For the "secret key", it looks like URLs should be run through Mage_Adminhtml_Model_Url::getUrl. This function contains a method getSecretKey that seems to append a key based on whether the keys are enabled. Also take a look at Mage_Core_Model_Session::getFormKey, which is referenced by adminhtml/url. This should give you more insight into how those URLs are generated.

    评论
    解决 无用
    打赏 举报
查看更多回答(2条)

相关推荐 更多相似问题