Magento Custom Frontend控制器始终显示404错误

时间:2016-07-25 13:53:31

标签: php magento cpanel

我在magento中有自定义前端控制器。它重定向并执行过滤器。它在localhost上工作正常,但Ajax post url总是在我的服务器上返回404。尝试访问url / categoryfilter / save / doFilter /总是在我的服务器上显示404。

代码如下:  JS Ajax请求

jQuery(function(){
    jQuery('.vendorCat').click(function(){
        var dataAttr = jQuery(this).attr("data-id");
        jQuery.ajax({
            type: "POST",
            url: <?php echo "'".Mage::getUrl('categoryfilter/save/doFilter')."'" ?>,
            data: { 'dataAttr': dataAttr },
            success: function(data) {
                location.reload();
            }
        });
        return false;
    });
});

saveController.php

    <?php
class VendorPage_CategoryFilter_SaveController extends Mage_Core_Controller_Front_Action
{
    public function doFilterAction(){
         $filterData = $_POST['dataAttr'];
        include_once( 'app/Mage.php' );
        Mage::getSingleton('core/session')->setData("vendorCategoryFilter",$filterData);
    }
}
?>

config.xml中

  <?xml version="1.0"?>
    <config>
        <modules>
            <VendorPage_Categoryfilter>
                <version>0.1.0</version>
            </VendorPage_Categoryfilter>
        </modules>
        <global>
            <blocks>
                <categoryfilter>
                    <class>VendorPage_Categoryfilter_Block</class>
                </categoryfilter>
            </blocks>
            <helpers>
                <categoryfilter>
                    <class>VendorPage_Categoryfilter_Helper</class>
                </categoryfilter>
            </helpers>
        </global>
        <frontend>
            <routers>
                <categoryfilter>
                    <use>standard</use>
                    <args>
                        <module>VendorPage_Categoryfilter</module>
                        <frontName>categoryfilter</frontName>
                    </args>
                </categoryfilter>
            </routers>
        </frontend>
    </config>

widget.xml

    <?xml version="1.0"?>
<widgets>
    <categoryfilter type="categoryfilter/widget_form" translate="label description" module="categoryfilter">
        <name>Create Filter</name>
        <description>Adds a Form to allow the User to Create a new Filter</description>
        <parameters>

            <template>
                <visible>0</visible>
                <value>vendorpage/categoryfilter/form.phtml</value>
            </template>
        </parameters>
    </categoryfilter>
</widgets>

尝试了很多事情。无法得到解决方案。

0 个答案:

没有答案