404 not .found on new module

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>

Solutions

It's seem to be a permission issue in your adminhtml.xml, take a look at xml structure for admin configurations, you seem to missing the <all> and <acl>

<?xml version="1.0"?>
<config>
    <acl>
        <resources>
           <all>
             <title>Allow Everything</title>
           </all>
            <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>
                    <acl>
                        <children>
                            <luisvalenciasection translate="title" module="affiliate"> 
                                <title>Luisvalencia Section</title>
                            </luisvalenciasection>
                        </children>
                    </acl> 
Tags: PHP

Similar questions

404 Page not found error when I try to access Custom module in Magento 2
I have created 2 custom module inside vendor folder .This is my layout structure : Both are enabled . This is my code for routes.xml for HelloWorld module : This is my code in module.xml : This is my registration.php file : This is my controller code : This is my layout code : & Same for another module. I have already executed setup:upgrade com...
404 Page not found error when I try to access Custom module in Magento 2.1
My customer model reposites is In https://github.com/aloha1003/magento-question I put DemoMod dir in /app/code/local and execute bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cahce:flush But open browser on http://localhost/magento/demo/index/index And got 404 page not found error. How could I fix it ?
Page not found 404 when accessing custom module in system configuration
When i try to access my system > configuration > i got an error saying page not found 404 here's my code: config.xml : adminhtml.xml : system.xml:
Can't add custom configuration options for module in backend - 404 page not found
I was following different tutorials from the internet and from books, but none of them works. Let's follow this tutorial (https://code.tutsplus.com/tutorials/custom-back-end-configuration-in-magento--cms-23265) app/etc/modules/Envato_All.xml app/code/local/Envato/CustomConfig/etc/config.xml app/code/local/Envato/CustomConfig/etc/system.xml app/code...
styles-m.css 404 (Not Found) after installing ElasticSuite Module by Smile. | Elasticsearch
After installation of this module: https://github.com/Smile-SA/elasticsuite/ the front-end is now messed up. Installed using composer. Magento ver. 2.2.4 with ElasticSuite 2.6.x latest release. In the console I get: GET http://www.example.co.uk/static/version1540202793/frontend/Venustheme/body_fitness_child/en_GB/css/styles-m.css 404 (Not Found) I ...
Magento 2 Custom Admin module 404 Not Found
I have been struggling with this error all day, I have tried all the solutions on Internet, but it keeps showing 404 Error when I click the link on my custom menu. Here is my code /app/code/Vendor/Module/etc/adminhtml/menu.xml Controller /app/code/Vendor/Module/Controller/Adminhtml/ConfigMenu/SiftSetup.php routes.xml /app/code/Vendor/Module/etc/adm...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.