Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My custom module is not showing in system->configuration->advanced->advanced #795

Closed
aishwaryacedcoss opened this issue Dec 10, 2014 · 15 comments

Comments

@aishwaryacedcoss
Copy link

I have created a module in parallel to magento folder inside the app->code .I have created module.xml,config.xml in the etc folder.Is this is enough for creating the configuration for any module.Then why It is not showing..Please help me....????

@antonmakarenko
Copy link

In order for module to be registered in the Magento instance, you need to perform installation. When you install normally, it will automatically discover all modules and enable them by default (as long as your app/code/Your/Module/etc/module.xml file is correct).

But for an existing Magento instance, you'll need to register it as follows:

  • Edit the app/etc/config.php file and find "modules" section. Add your module there and specify value "1" (enabled)
  • Clean var/cache directory
  • Run command: php -f setup/index.php update

@aishwaryacedcoss
Copy link
Author

Thanx for this,
Now the Problem is this that I have created a simple controller inside app->Controller->Hello
inside that I have write

But then also after giving frontname in url it displays error:-Class Magentozend\Hello\Controller\Hello does not exist";i:1;s:1170:"#0 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/Code/Reader/ClassReader.php(37): ReflectionClass->__construct('Magentozend\Hello...')
Please solve this error.....asap

@aishwaryacedcoss
Copy link
Author

Sometimes when I put frontname in the controller,It give errroe 404 not found...:(

@kandy
Copy link
Contributor

kandy commented Dec 11, 2014

Looks like classes from Magentozend namespace are not autoloading. To do this, please add a namespace to composer.json and rerun composer install.
Example config:

     "psr-4": {
            "Magentozend\\": "app/code/Magentozend"
        }

@aishwaryacedcoss
Copy link
Author

Is there any other way to do this...accept composer.json.....and I have to run this command "composer install." from the root of my magento2 directory????

@aishwaryacedcoss
Copy link
Author

After adding this in my composer.json under the root directory of magento2 parallel to app,
"autoload": {
"psr-4": {
"Magento\Framework": "lib/internal/Magento/Framework/",
"Alankent": "app/code/Alankent"

    }

},

It is giving same error,as above,Please solve this issue ..its urgent..???

@kandy
Copy link
Contributor

kandy commented Dec 11, 2014

Maybe you don't declare route for your module.
see routes.xml fro example

@aishwaryacedcoss
Copy link
Author

I have declared in the etc->frontend->routes.xml

as bt then also...???

@otoolec
Copy link
Contributor

otoolec commented Dec 11, 2014

In one comment it was suggested to add a PSR mapping for "magentozend" but in a response to that I only saw "Alankent" added. To handle all cases, please add the following to your root composer.json file, just after the "psr-4" section:

    "psr-0": {
       "": ["app/code/", "var/generation"]
    }

After adding this you'll need to run composer install again or composer dump-autoload from your root magento 2 directory.

@buskamuza
Copy link
Contributor

One more clarification - when you change composer.json you should run composer update, not composer install.
@aishwaryacedcoss , please, try composer update.

@aishwaryacedcoss
Copy link
Author

I am giving You my module ,Please tell where I am wrong ,I have created the Module by the namespace Alankent
having module.xml file,routes.xml inside etc->frontend,
and controller file inside Controller folder ,
put 1 for module in config.php,and do
"autoload": {
"psr-4": {
"Magento\Framework": "lib/internal/Magento/Framework/",
"Alankent": "app/code/Alankent"

    },
   "psr-0": {
   "": ["app/code/", "var/generation"]
}

in my composer.json of magento2 directory,and run composer update,in the terminal which results,
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
But results in the error:-

Class AlanKent\ShowApplicationState\Controller\ShowApplicationStateFrontController does not exist";i:1;s:1170:"#0 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/Code/Reader/ClassReader.php(38): ReflectionClass->__construct('AlanKent\ShowAp...')
#1 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/ObjectManager/Definition/Runtime.php(63): Magento\Framework\Code\Reader\ClassReader->getConstructor('AlanKent\ShowAp...')
#2 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/Factory.php(186): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('AlanKent\ShowAp...')
#3 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/ObjectManager/ObjectManager.php(87): Magento\Framework\ObjectManager\Factory\Factory->create('AlanKent\ShowAp...')
#4 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/App/Http.php(132): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...')
#5 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/App/Bootstrap.php(265): Magento\Framework\App\Http->launch()
#6 /opt/lampp/htdocs/workspace/magento2/index.php(45): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#7 {main}";s:3:"url";s:32:"/workspace/magento2/showappstate";s:11:"script_name";s:29:"/workspace/magento2/index.php";}

@buskamuza
Copy link
Contributor

@aishwaryacedcoss , you request class in namespace AlanKent, but in autoloader you defined it as Alankent. Please, fix letter case everywhere (in name of class, usage of class, files and directories names) to be consistent and let us know if it helped.

@aishwaryacedcoss
Copy link
Author

Thanku for that..It my mistake...Bt Now also my controller is not echo any thing it looks like in the construct fuction ar any function ang gives error:-
What to do,????
Error log record number: 259577184682:-

a:4:{i:0;s:34:"Incorrect theme identification key";i:1;s:3298:"#0 /opt/lampp/htdocs/workspace/magento2/app/code/Magento/Core/Model/View/Design.php(162): Magento\Framework\View\Design\Theme\FlyweightFactory->create(NULL, 'showapplication...')
#1 /opt/lampp/htdocs/workspace/magento2/app/code/Magento/Core/Model/View/Design.php(226): Magento\Core\Model\View\Design->setDesignTheme(NULL)
#2 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/App/Area.php(267): Magento\Core\Model\View\Design->setDefaultDesignTheme()
#3 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/App/Area.php(225): Magento\Framework\App\Area->_initDesign()
#4 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/App/Area.php(149): Magento\Framework\App\Area->_loadPart('design')
#5 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/View/DesignLoader.php(72): Magento\Framework\App\Area->load('design')
#6 /opt/lampp/htdocs/workspace/magento2/app/code/Magento/Core/App/Action/Plugin/Design.php(56): Magento\Framework\View\DesignLoader->load()
#7 [internal function]: Magento\Core\App\Action\Plugin\Design->aroundDispatch(Object(AlanKent\ShowApplicationState\Controller\ShowApplicationStateFrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#8 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/Interception/Chain/Chain.php(81): call_user_func_array(Array, Array)
#9 /opt/lampp/htdocs/workspace/magento2/var/generation/AlanKent/ShowApplicationState/Controller/ShowApplicationStateFrontController/Interceptor.php(88): Magento\Framework\Interception\Chain\Chain->invokeNext('AlanKent\ShowAp...', 'dispatch', Object(AlanKent\ShowApplicationState\Controller\ShowApplicationStateFrontController\Interceptor), Array, 'storeCheck')
#10 /opt/lampp/htdocs/workspace/magento2/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php(62): AlanKent\ShowApplicationState\Controller\ShowApplicationStateFrontController\Interceptor->AlanKent\ShowApplicationState\Controller\ShowApplicationStateFrontController{closure}(Object(Magento\Framework\App\Request\Http))
#11 [internal function]: Magento\Store\App\Action\Plugin\StoreCheck->aroundDispatch(Object(AlanKent\ShowApplicationState\Controller\ShowApplicationStateFrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#12 /opt/lampp/htdocs/workspace/magento2/var/generation/AlanKent/ShowApplicationState/Controller/ShowApplicationStateFrontController/Interceptor.php(93): call_user_func_array(Array, Array)
#13 /opt/lampp/htdocs/workspace/magento2/var/generation/AlanKent/ShowApplicationState/Controller/ShowApplicationStateFrontController/Interceptor.php(115): AlanKent\ShowApplicationState\Controller\ShowApplicationStateFrontController\Interceptor->___call('dispatch', Array, Array)
#14 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/App/Http.php(133): AlanKent\ShowApplicationState\Controller\ShowApplicationStateFrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#15 /opt/lampp/htdocs/workspace/magento2/lib/internal/Magento/Framework/App/Bootstrap.php(265): Magento\Framework\App\Http->launch()
#16 /opt/lampp/htdocs/workspace/magento2/index.php(45): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#17 {main}";s:3:"url";s:68:"/workspace/magento2/showappstate/showapplicationstatefrontController";s:11:"script_name";s:29:"/workspace/magento2/index.php";}

@aishwaryacedcoss
Copy link
Author

I dont why it is very difficult to create a module in magento2???

@aishwaryacedcoss
Copy link
Author

Thanku thanku ..I have resolved the problem...Now its working....thanku..for the help...every1:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants