Hi,
I arrived 3 weeks ago in a company using a eCommerce website created with Magento 1.9.2 . I am the only web developper, with a small experience.
I had no knowledges about Magento, and a lot of things have been done before I arrived.
I have to add an other webpage for the trainee. I think using a simple CMS page won't be enough, so I tried to create a complet magento module.
I followed some tutorials on internet, I added all the files I theorically need to print a new webpage with a "hello world".
So, in the url, I add the name of the module, but find a 404 error. I searched on internet if some other people had the same issues, but most of the times, they made mistakes. And I don't see were is mine.
There is what I have done:
In design/frontend/shopper(nom du theme)/default/template, I have a new folder "mannequin" with affichage.phtml
<p>hello world</p>
In design/frontend/shopper/default/layout, I have Ajouts_Mannequin.xml
<?xml version="1.0" encoding="UTF-8"?> <layout version="0.1.0"> <Ajouts_Mannequin_index_index> <reference name="content"> <block type="core/template" name="mannequin_affichage" template="mannequin/affichage.phtml"/> </reference> </Ajouts_Mannequin_index_index> </layout>
In code/local, I added folders /Ajouts/Mannequin/controllers et /Ajouts/Mannequin/etc
with in each: indexController.php
<?php class Ajouts_Mannequin_IndexController extends Mage_Core_Controller_Front_Action { public function indexAction() { $this->loadLayout(); $this->renderLayout(); } } ?>
and config.xml
<?xml version="1.0" encoding="UTF-8"?> <config> <module> <Ajouts_Mannequin> <version>0.1.0</version> </Ajouts_Mannequin> </module> <frontend> <routers> <Ajouts_Mannequin> <use>standard</use> <args> <module>Ajouts_Mannequin</module> <frontName>mannequin</frontName> </args> </Ajouts_Mannequin> </routers> <layout> <updates> <Ajouts_Mannequin> <file>Ajouts_Mannequin.xml</file> </Ajouts_Mannequin> </updates> </layout> </frontend> </config>
and finally, I added etc/modules/Ajouts_Mannequin.xml
<?xml version="1.0"?> <config> <modules> <Ajouts_Mannequin> <active>true</active> <codePool>local</codePool> </Ajouts_Mannequin> </modules> </config>
So I added all of these files, tried the url ending with "/mannequin, /mannequin/inde/index, but no result.
After, I came in back => System => Advanced, but i can't find my module.
Thank you
Solved! Go to Solution.
hi @Mric
I checked your code.Some error in your code. In config.xml make the router handle in lower case
<routers> <ajouts_mannequin> <use>standard</use> <args> <module>Ajouts_Mannequin</module> <frontName>mannequin</frontName> </args> </ajouts_mannequin>
</routers>
So in your layout file
<?xml version="1.0" encoding="UTF-8"?> <layout version="0.1.0"> <ajouts_mannequin_index_index> <reference name="content"> <block type="core/template" name="mannequin_affichage" template="mannequin/affichage.phtml"/> </reference> </ajouts_mannequin_index_index> </layout>
Rest for making sure to module work
1. Check the spelling of folder and files
2. Disable cache from admin panel
3. Disabled the compilation too
Have you set right permissions to file and empty the magento's cache ?
hi @Mric
I checked your code.Some error in your code. In config.xml make the router handle in lower case
<routers> <ajouts_mannequin> <use>standard</use> <args> <module>Ajouts_Mannequin</module> <frontName>mannequin</frontName> </args> </ajouts_mannequin>
</routers>
So in your layout file
<?xml version="1.0" encoding="UTF-8"?> <layout version="0.1.0"> <ajouts_mannequin_index_index> <reference name="content"> <block type="core/template" name="mannequin_affichage" template="mannequin/affichage.phtml"/> </reference> </ajouts_mannequin_index_index> </layout>
Rest for making sure to module work
1. Check the spelling of folder and files
2. Disable cache from admin panel
3. Disabled the compilation too
Thank you for replying!
@antuz88, the files are readabled by every user. (644)
@qaisar_satti, I tried to set every names to lower case. Still not working.
Do I have to lower cases in the folders and files too? (Ajouts_Mannequin => ajouts_mannequin?)
Thank you
Could this come from an other module? (There is many bugs on that website. Mangeto Connect isn't working (403 Ôo), some modules makes error popup, ...)
hi @aboisard
i don't said about making folder to lower i said in you config.xml the router node make the lower because in layout handle it is using the lowercase. Don't lowercase the folders. I test thins i didn't find any problem so may be some other problem.
hello @qaisar_satti,
I have to change the names only in the router and the layout then?
You tested it already?
hi @aboisard
yes i tested it rest the code not problem only the layout handle was not rendering properly so i fixed that only its start working on my local machine.
Thank you @qaisar_satti
Could you please make a zip of the files you used? If that's possible, I'd like to be sure I didn't changed any thing;
The problem seems to come from the actual configuration of the website?
Do you have any idea where and what I can surch? Any specific documentation I have to read?
Ho, what is the url you used?
Magento/mannequin/index/index or Magento/mannequin ?
hi @aboisard
this url
Magento/mannequin
also check your module is listed in system > configuration > advanced