Custom menu gives 404 in magento on server - magento

I created a custom menu in admin tab in magento admin. It was working perfectly on localhost, but when i deployed my code on the server, it is giving a 404 page not found error. What can be the issue there!
<?xml version="1.0"?>
<config>
<modules>
<Inchoo_CoffeeFreak>
<version>0.1.0</version>
</Inchoo_CoffeeFreak>
</modules>
<global>
<blocks>
<coffefreakblock1>
<class>Inchoo_CoffeeFreak_Block</class>
</coffefreakblock1>
<coffefreakblock2>
<class>Inchoo_CoffeeFreak_Block_EditSpecial</class>
</coffefreakblock2>
</blocks>
<helpers>
<coffefreakhelper1>
<class>Inchoo_CoffeeFreak_Helper</class>
</coffefreakhelper1>
</helpers>
</global>
<admin>
<routers>
<samplerouter1>
<use>admin</use>
<args>
<module>Inchoo_CoffeeFreak_AdminControllersHere</module>
<frontName>print</frontName>
<modules>
<sintax after="Inchoo_CoffeeFreak_AdminControllersHere">Mage_Adminhtml</sintax>
</modules>
</args>
</samplerouter1>
</routers>
</admin>
<adminhtml>
<menu>
<mymenu1 translate="title" module="coffefreakhelper1">
<title>PrintInfo</title>
<sort_order>20</sort_order>
<children>
<!-- Note the misleading "module" attribute.
It actualy refers to one of the declared helpers -->
<myitem1 translate="title" module="coffefreakhelper1">
<title>Add/Change Config</title>
<action>samplerouter1/settings</action>
<sort_order>1</sort_order>
</myitem1>
</children>
</mymenu1>
</menu>
</adminhtml>
</config>

Your server may be running on Linux which is case sensitive so you need to check that you module file and folder should be according Magento standard like controller should be IndexController not indexController etc.
and your localhost running on window which is not case sensitive.

Normally this is when you are logged in. Logout and login again. Then it should work.

Assuming that cache is turn off / cleared
1) Logout and log back in again
If you still getting a 404 error
2) Check your server error log, you maybe missing your module helper file

Login In/Out,clear cache, should be the solution.But you can try below points (though it may find foolish).
1) Check your xml contents.(line by line with your localhost xml)
2) Spellings matter (hope <sintax> spelling is correct is your xml )
3) Remove unwanted space (like before <global> tag) and comments.
4) Opening & closing of tags.
5) Proper Indentation (this will help to find your flaw if it is there)
6) Atlast directly copy the same localhost xml file in your server.
I really wish this will help you to find the bug.

Related

Magento Extension causes 404 Error from the Admin Panel

We have a Magento Extension on our website, written by an ex-employee. This extension was written just for this one website, and I am struggling to find out what is going wrong with this extension. Contacting the ex-employee has proven to be (how should I put this), an ineffective method for solving this problem, so I was hoping someone here could help me out.
The extension works fine on the site, but when we click on the extension in the backend, on the Admin Panel, we get a "404 Not Found 1" error.
Is there anything I can do (like changing log file settings) to find out what file is missing and causing this 404?
QUICK UPDATE
After rolling back a load of patches we have noticed that this problem only occurs after patch 5994. Is there anything in patch 5994 that could be causing these problems?
The extension itself has the following files:
\app\code\local\muz\Worldman\controllers\
WorldmanController.php
\app\code\local\muz\Worldman\controllers\Adminhtml\
WorldmanController.php
\app\code\local\muz\Worldman\controllers\etc
config.xml
\app\code\local\muz\Worldman\controllers\Helper
Data.php
I can make changes to the class names in the \app\code\local\muz\Worldman\controllers\Adminhtml\WorldmanController.php and instead of getting a 404 error, I get an actual crash report, stating that Controller file was loaded but class does not exist.
Again, this extension works fine on the site itself. Its just clicking on the extension itself from the Admin Panel menu that causes the 404.
The extension is enabled. I have logged out and back in a hundred times. Indexes have been re-indexed. Caches have been cleared and turned off. Servers have been rebooted. But to no avail.
At this point any suggestions for debugging any Magento extensions would be very much appreciated.
If this helps, here is the config.xml file:
<?xml version="1.0"?>
<config>
<modules>
<muz_Worldman>
<version>1.0.0</version>
</muz_Worldman>
</modules>
<global>
<helpers>
<worldman>
<class>muz_Worldman_Helper</class>
</worldman>
</helpers>
</global>
<frontend>
<routers>
<worldman>
<use>standard</use>
<args>
<module>muz_Worldman</module>
<frontName>worldman</frontName>
</args>
</worldman>
</routers>
<layout>
<updates>
<worldman>
<file>worldman.xml</file>
</worldman>
</updates>
</layout>
</frontend>
<adminhtml>
<menu>
<cms>
<children>
<worldman_adminform translate="title" module="worldman">
<title>Worldman Manager</title>
<action>worldman/adminhtml_worldman</action>
</worldman_adminform>
</children>
</cms>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<cms>
<children>
<worldman_adminform>
<title>worldman Manager</title>
</worldman_adminform>
</children>
</cms>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<worldman>
<file>worldman.xml</file>
</worldman>
</updates>
</layout>
</adminhtml>
</config>
The ACL settings are not set right for the user, that's why you get a 404. Even with the ACL set correctly you might get this error if you do not flush the Magento config cache and log out and then back in again.
From a quick look at your config, it seems like the XML part of the ACL settings is alright, but you might need to check if the file \app\code\local\muz\Worldman\controllers\Adminhtml\WorldmanController.php has a method like this in it:
protected function _isAllowed()
{
return Mage::getSingleton('admin/session')->isAllowed('cms/worldman_adminform');
}
I had a bunch of modules that stopped working because of this missing method after one of Magento's latest patches.
Also, did you try with an admin account where you should automatically have full access?
--------EDIT-------
The patch you mentioned (5994) gave me similar problems with one of my modules. It used frontend routing for the adminhtml-controller, so what I had to do was to remove the XML between <frontend>...</frontend> and replace it with something like this:
<admin>
<routers>
<adminhtml>
<args>
<modules>
<muz_Worldman after="Mage_Adminhtml">muz_Worldman_Adminhtml</muz_Worldman>
</modules>
</args>
</adminhtml>
<worldman>
<use>admin</use>
<args>
<module>muz_Worldman</module>
<frontName>worldman</frontName>
</args>
</worldman>
</routers>
</admin>
and also make sure that the the XML for ACL action - <action>worldman/adminhtml_worldman</action> is right, I had to make some changes to the URL so mine became more like (for you) adminhtml/worldman_adminform.

Overriding adminhtml controller in Magento not working

Sorry for my english.
Just a question. In my magento, when i refresh statistics in Reports / Resfresh statistics, it's okay but it redirects me on the homepage of my website.
I solved this problem by changing two lines code in app/code/core/Mage/adminhtml/controllers/Report/StatisticsController.php.
But it's better to create "an override".
So i decided to create a module in app/code/local/myname/.
I have my file in app/etc/modules myname_all.xml wich contains :
<?xml version="1.0"?>
<config>
<modules>
<MyName_AdminExtras>
<active>true</active>
<codePool>local</codePool>
</MyName_AdminExtras>
Next, I create app/code/local/Myname/AdminExtras/Adminhtml/etc/config.xml which contains
<?xml version="1.0"?>
<config>
<modules>
<MyName_AdminExtras>
<version>0.1.0</version>
</MyName_AdminExtras>
</modules>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<MyName_AdminExtras before="Mage_Adminhtml">MyName_AdminExtras_Adminhtml</MyName_AdminExtras>
</modules>
</args>
</adminhtml>
</routers>
</admin>
And finally, i created a folder named controllers which contains another folder named Report and the file named StatisticsController.php which is calling the base file /app/code/core/Mage/Adminhtml/controllers/Report/StatisticController.php
But it doesn't word. File is not calling by Magento.
What's wrong ?
Hum sorry i found the answer. My folders weren't ok.
I just follow this way :
App/code/local/MyName/AdminExtras/controllers/adminhtml..
instead of
App/code/local/MyName/AdminExtras/Adminhtml/controllers

Magento Change Tab Order in Edit Product Section

I want to change order of tabs in edit product section.For example,categories and inventory tab must be swapped.Overriding Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs block doesn't seem to work.
config.xml
<config>
<global>
<blocks>
<my_module>
<class>Company_Adminhtml_Block</class>
</my_module>
<adminhtml>
<rewrite>
<catalog_product_edit_tabs>Company_Adminhtml_Block_Catalog_Product_Edit_Tabs</catalog_product_edit_tabs>
</rewrite>
</adminhtml>
</blocks>
<global>
</config>
I copied Company_Adminhtml_Block_Catalog_Product_Edit_Tabs into local folder and swapped the category and inventory addTab code.Any pointers?
Make sure you have configured your module correctly. To do this, you can simply call from a controller action.
echo get_class(Mage::getBlockSingleton('adminhtml/catalog_product_edit_tabs'));
It should return Company_Adminhtml_Block_Catalog_Product_Edit_Tabs if you configuration is correct, or Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs if your configuration is failed.
Had the same issue. Flushing the cache helped.

Magento controller override

I am trying to overwrite a controller of an extension....that is overwriting the cart controller.
The extension currently overwriting the cart controller is:
Innoexts/Warehouse/controllers/Checkout/CartController.php
The config entry in the Innoexts module doing this is:
<frontend>
<routers>
<checkout>
<args>
<modules>
<Innoexts_Warehouse before="Mage_Checkout">Innoexts_Warehouse_Checkout</Innoexts_Warehouse>
</modules>
</args>
</checkout>
</routers>
...blah...blah...
</frontend>
The top of the innoext cartcontroller file is:
require_once 'Mage/Checkout/controllers/CartController.php';
class Innoexts_Warehouse_Checkout_CartController extends Mage_Checkout_CartController {
I want to overwrite it with this controller:
Myco/Warehousemod/controllers/Checkout/CartController.php
The top of the controller file is:
require_once 'Innoexts/Warehouse/controllers/Checkout/CartController.php';
class Myco_Warehousemod_Checkout_CartController extends Innoexts_Warehouse_Checkout_CartController {
The config entry ive created is:
<global>
...blah...blah...
<rewrite>
<myco_warehousemod_checkout_cart>
<from><![CDATA[#^/checkout/cart/#]]></from>
<to>/warehousemod/checkout_cart/</to>
</myco_warehousemod_checkout_cart>
</rewrite>
</global>
<frontend>
<routers>
<checkout>
<args>
<modules>
<Myco_Warehousemod before="Innoexts_Warehouse_Checkout">Myco_Warehousemod_Checkout</Myco_Warehousemod>
</modules>
</args>
</checkout>
</routers>
...blah...blah...
</frontend>
I am getting a 404 not found error for the checkout/cart URL now....Can anyone see where im going wrong? Online resources are very different...and confusing!! The issue may be with me trying to overwrite an overwriting controller...??
thanks in advance...
Need to remove the first rewrite:
<rewrite>
<myco_warehousemod_checkout_cart>
<from><![CDATA[#^/checkout/cart/#]]></from>
<to>/warehousemod/checkout_cart/</to>
</myco_warehousemod_checkout_cart>
</rewrite>
I think certain people should stop writing tutorials....cluttering up the web with their half-assed SEO efforts....
This part was used in the old versions of Magento (i think before 1.4), but if you want to extend a controller that has a rewrite like this in the config file, you have to do the same in your config.
<rewrite>
<myco_warehousemod_checkout_cart>
<from><![CDATA[#^/checkout/cart/#]]></from>
<to>/warehousemod/checkout_cart/</to>
</myco_warehousemod_checkout_cart>
</rewrite>
The new versions use only the part with before so you should have something like this:
<routers>
<checkout>
<args>
<modules>
<Myco_Warehousemod before="Innoexts_Warehouse">Myco_Warehousemod_Checkout</Myco_Warehousemod><!-- just the name of the module Innoexts_Warehouse the overridden folder will be taken from the part after the name of your module so Magento will look in app/local/Myco/Warehousemod/controllers/Checkout/* and load all the controllers from there -->
</modules>
</args>
</checkout>
</routers>
Just an additional notes for those who wants to know about confliction between extensions and possible solutions(just like above case), refer to the following links:
http://www.webshopapps.com/blog/2010/11/resolving-magento-extension-conflicts/
http://sweettoothrewards.com/wiki/index.php/Resolving_extension_conflicts
http://magebase.com/magento-tutorials/magento-extension-clashes-winners-and-loosers/
http://www.magestore.com/blog/2011/12/21/magento-methods-to-resolve-the-module-conflicts-in-magento/
This is a little notification on the include path of the controller.
This include path can cause errors if the Magento Compiler mode is turned on.
require_once 'Mage/Checkout/controllers/CartController.php';
Instead of that it is good to use
require_once Mage::getModuleDir('controllers', 'Mage_Checkout').DS.'CartController.php';
It will be safer.

Why is Magento ignoring my frontName?

I'm following the tutorial on:
http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-3-magento-controller-dispatch
I'm creating a module called Rss in package MyPackage, my config looks as so:
<config>
<modules>
<MyPackage_Rss>
<version>0.1.0</version>
</MyPackage_Rss>
</modules>
<frontend>
<routers>
<rss>
<use>standard</use>
<args>
<module>MyPackage_Rss</module>
<frontName>rss</frontName>
</args>
</rss>
</routers>
</frontend>
</config>
In the Admin area, under Configuration I see that the module is Enabled.
I have the IndexController.php setup in:
~/local/MyPackage/Rss/controllers/IndexController.php
However, when I go to my site:
http://mysite/rss
I get a 404.
Any thoughts?
Using latest Magento Enterprise
Thanks in advance
There is already a Mage_Rss module that uses the "rss" front name for itself. Try using a different front name.

Resources