小编Waq*_*uar的帖子

Magento模块控制器无法正常工作

Tyring创建一个模块,我可以使用catalog-> products模型动态创建产品,并将控制重定向到产品的评论页面.只需单个控制器即可完成单一操作.没有块,助手,模板....没有必要.

但似乎控制器操作没有正确路由,代码或配置中存在一些错误......找不到404错误

试试这个网址:

http://localhost/magento_test/dynamicproduct/index/index
Run Code Online (Sandbox Code Playgroud)

命名空间:Waqasalieee

模块名称:Dynamicproduct

Magento版本: 1.7.0.2

这是文件内容:

本地/ Waqasalieee/Dynamicproduct /控制器/ IndexController.php

<?php
    class Waqasalieee_Dynamicproduct_IndexController extends Mage_Core_Controller_Front_Action
    {
        public function indexAction() {
            die('working in index');
        }
    }
?>
Run Code Online (Sandbox Code Playgroud)

本地/ Waqasalieee/Dynamicproduct的/ etc/config.xml中

<?xml version="1.0"?>
<config>
    <modules>
        <Waqasalieee_Dynamicproduct>
            <version>1.0</version>
        </Waqasalieee_Dynamicproduct>
    </modules>
    <frontend>
        <routers>
            <dynamicproduct>
                <use>standard</use>
                <args>
                    <module>Waqasalieee_Dynamicproduct</module>
                    <frontName>dynamicproduct</frontName>
                </args>
            </dynamicproduct>
        </routers>
    </frontend>

</config>
Run Code Online (Sandbox Code Playgroud)

应用程序的/ etc /模块/ Waqasalieee_Dynamicproduct.xml

<?xml version='1.0'?>
<config>
    <modules>
        <Waqasalieee_Dynamicproduct>
            <codepool>local</codepool>
            <active>true</active>
        </Waqasalieee_Dynamicproduct>
    </modules>
</config>
Run Code Online (Sandbox Code Playgroud)

它应该显示一些错误或'在索引中工作'(字符串)但它给出404找不到错误.

magento magento-1.7

1
推荐指数
1
解决办法
4209
查看次数

标签 统计

magento ×1

magento-1.7 ×1