简体   繁体   中英

404 Error Page not found. on Magento New Module on System, Configuration

I created a new module which I will explain below. I can see the new options on the admin. I clicked on role, administrators and saved. I logged out and logged in

However I still see 404 Not found when I want to change the config. http://screencast.com/t/IbLJeVjpxMm

Config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Luisvalencia_Affiliate>
            <version>0.0.1</version>
        </Luisvalencia_Affiliate>
    </modules>
    <global>
        <models>
            <luisvalencia_affiliate>
                <class>Luisvalencia_Affiliate_Model</class>
            </luisvalencia_affiliate>
        </models>
        <helpers>
            <affiliate>
                <class>Luisvalencia_Affiliate_Helper</class>
            </affiliate>
        </helpers>
    </global>
    <frontend>
        <events>
            <controller_action_predispatch>
                <observers>
                    <luisvalencia_affiliate>
                        <class>luisvalencia_affiliate/observer</class>
                        <method>captureReferral</method>
                        <type>singleton</type>
                    </luisvalencia_affiliate>
                </observers>
            </controller_action_predispatch>
        </events>
    </frontend>
</config>

adminhtml.xml

<?xml version="1.0"?>
<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <luisvalenciasection translate="title" module="affiliate">
                                        <title>Luisvalencia Section</title>
                                        <sort_order>0</sort_order>
                                    </luisvalenciasection>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

system.xml

<?xml version="1.0" ?>
<config>
    <tabs>
        <luisvalenciatab translate="label" module="affiliate">
            <label>Luisvalencia Cookie</label>
            <sort_order>0</sort_order>
        </luisvalenciatab>
    </tabs>
    <sections>
        <luisvalenciasection  translate="label" module="affiliate">
            <label>Luisvalencia</label>
            <tab>luisvalenciatab</tab>
            <frontend_type>text</frontend_type>
            <sort_order>0</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <luisvalenciagroup translate="label">
                    <label>Luisvalencia Group</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>0</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <cookie_time translate="label">
                            <label>Set Cookie Time</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>0</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </cookie_time>
                    </fields>
                </luisvalenciagroup>
            </groups>
        </luisvalenciasection>
    </sections>
</config>

Data.php

<?php
class Luisvalencia_Affiliate_Helper_Data extends Mage_Core_Helper_Abstract {
}

Observer.php

<?php
class Luisvalencia_Affiliate_Model_Observer
{
    const COOKIE_KEY_SOURCE = 'luisvalencia_affiliate_source';

    public function captureReferral(Varien_Event_Observer $observer)
    {
        $cookietime = Mage::getStoreConfig('luisvalenciasection/luisvalenciagroup/cookie_time');
        if(Mage::getModel('core/cookie')->get('ref') != 'cj'){
            if( isset($_GET["ref"]) ){
                $ref=$_GET["ref"];
            }
            else{
                $ref='';
            }

            $name_c = 'ref';
            $val_c = $ref;
            $expired = 31556926; /* 1 year */
            $path = '/';

            $cookie = Mage::getSingleton('core/cookie');
            $cookie->set($name_c, $val_c ,(int)$cookietime,$path);
        }
    }
}

Luisvalencia_Affiliate.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Luisvalencia_Affiliate>
            <active>true</active>
            <codePool>community</codePool>
        </Luisvalencia_Affiliate>
    </modules>
</config>

lv

Add this code in config.xml

<resources>
    <affiliate_setup>
    <setup>
        <module>Luisvalencia_Affiliate</module>
    </setup>
    <connection>
        <use>core_setup</use>
    </connection>
    </affiliate_setup>
    <affiliate_read>
    <connection>
        <use>core_read</use>
    </connection>
    </affiliate_read>
    <affiliate_write>
    <connection>
        <use>core_write</use>
    </connection>
    </affiliate_write>
</resources>

after end of </helpers>

And then

create a installer:Luisvalencia/Affiliatesql/affiliate_setup/install-0.0.1.php

code:

<?php

$session = Mage::getSingleton('admin/session');
$session->setReloadAclFlag(true);
$session->refreshAcl();

none of the answers above was needed apparently, I was missing an acl section on adminhtml.xml

            <acl>
                <children>
                    <luisvalenciasection translate="title" module="affiliate">
                        <title>Luisvalencia Section</title>
                    </luisvalenciasection>
                </children>
            </acl>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM