Page not found in custom module in magento - magento

Im getting a error of:
404 Error
Page not found.
Everything looks ok, i already cleared cache, logout and login again from the backend and also reset permissions, but still getting this error.
My code:
etc/modules:
Cloud_Freeshipping.xml
<?xml version="1.0"?>
<config>
<modules>
<Cloud_Freeshipping>
<active>true</active>
<codePool>community</codePool>
</Cloud_Freeshipping>
</modules>
</config>
app/code/community/Cloud/Freeshipping/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Cloud_Freeshipping>
<version>1.0.0</version>
</Cloud_Freeshipping>
</modules>
<global>
<helpers>
<cloud_freeshipping>
<class>Cloud_Freeshipping_Helper</class>
</cloud_freeshipping>
</helpers>
</global>
</config>
app/code/community/Cloud/Freeshipping/etc/adminhtml.xml
<?xml version="1.0"?>
<config>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<cloud_freeshipping translate="title">
<title>FreeShipping Notification</title>
</cloud_freeshipping>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
app/code/community/Cloud/Freeshipping/etc/system.xml
<?xml version="1.0"?>
<config>
<tabs>
<cloud_freeshipping translate="label">
<label>Free Shipping Notification</label>
<sort_order>1</sort_order>
</cloud_freeshipping>
</tabs>
<sections>
<cloud_freeshipping translate="label">
<tab>cloud_freeshipping</tab>
<label>Configuration</label>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<basic_config translate="label">
<label>Basic Config</label>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<total_cart translate="label">
<label>Valor de Envio</label>
<frontend_type>text</frontend_type>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>Selecione o total do valor para free shipping</comment>
</total_cart>
</fields>
</basic_config>
</groups>
</cloud_freeshipping>
</sections>
</config>
app/code/community/Cloud/Freeshipping/Helper/Data.php
class Cloud_Freeshipping_Helper_Data extends Mage_Core_Helper_Abstract
{
}

In file app/code/community/Cloud/Freeshipping/etc/adminhtml.xml, try to add <all> tag before <admin> like this:
<?xml version="1.0"?>
<config>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<system>
<children>
<config>
<children>
<cloud_freeshipping translate="title">
<title>FreeShipping Notification</title>
</cloud_freeshipping>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
Then logout and login to admin again.

Related

Move magento module from navigation menu to a tab in the admin configuration

I have a widget grid type module, which i want to move into magento system config.
I have added the following into my system.xml:
<config>
<sections>
<customesetup>
<groups>
<serialnumbervalidator>
<label>Serial Numbers</label>
<sort_order>20</sort_order>
<expanded>1</expanded>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<frontend_class>complex</frontend_class>
<frontend_model>mymodule/adminhtml_serial</frontend_model>
</serialnumbervalidator>
</groups>
</customesetup>
</sections>
</config>
but apparently it shows nothing. as the Block extends Mage_Adminhtml_Block_Widget_Grid_Container .
If anyone can point me where to look for my answer this would be great (Did searches and did not find anything useful).
You have to modify your config.xml, to show this up in System Configuration section.
<adminhtml>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<YOUR_MODULE translate="title">
<title><![CDATA[MY TITLE]]></title>
<sort_order>2100</sort_order>
</YOUR_MODULE>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
[...]
</adminhtml>
And in your system.xml :
<config>
<tabs>
<YOUR_MODULE_tab translate="label" module="YOUR_MODULE">
<label>YOUR_MODULE</label>
<sort_order>150</sort_order>
<class>container_admin_img</class> /*optionnal*/
</YOUR_MODULE_tab>
</tabs>
<sections>
<customesetup>
<groups>
<serialnumbervalidator>
<label>Serial Numbers</label>
<sort_order>20</sort_order>
<expanded>1</expanded>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<frontend_class>complex</frontend_class>
<frontend_model>mymodule/adminhtml_serial</frontend_model>
</serialnumbervalidator>
</groups>
</customesetup>
</sections>
</config>
Hope this helps.
Take a look at Alan Storm's No Frills Magento Layout book, or on his website : http://alanstorm.com/category/magento

Magento - How to create new admin page

I'm using Magento 1.9.0.1 and i've created a new extension in which i've added a new tab in the admin panel take a look at the picture.
Here is what i have in my files.
In: /app/code/community/VivasIndustries/SmsNotification/etc/config.xml:
<?xml version="1.0"?>
<config>
<modules>
<VivasIndustries_SmsNotification>
<version>0.1.0</version>
</VivasIndustries_SmsNotification>
</modules>
<global>
<models>
<smsnotification>
<class>VivasIndustries_SmsNotification_Model</class>
</smsnotification>
</models>
<events>
<sales_order_save_after>
<observers>
<vivasindustries_smsnotification>
<class>smsnotification/observer</class>
<method>orderSaved</method>
</vivasindustries_smsnotification>
</observers>
</sales_order_save_after>
</events>
<helpers>
<smsnotification>
<class>VivasIndustries_SmsNotification_Helper</class>
</smsnotification>
<adminhtml>
<rewrite>
<data>VivasIndustries_SmsNotification_Helper_Adminhtml_Data</data>
</rewrite>
</adminhtml>
</helpers>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<VivasIndustries_SmsNotification before="Mage_Adminhtml">VivasIndustries_SmsNotification_Adminhtml</VivasIndustries_SmsNotification>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
Here is what i have in: /app/code/community/VivasIndustries/SmsNotification/etc/adminhtml.xml:
<?xml version="1.0"?>
<config>
<menu>
<vivassms translate="title" module="smsnotification">
<title>SMS Center</title>
<sort_order>110</sort_order>
<children>
<sendsms translate="title" module="smsnotification">
<title>Send SMS</title>
<action>adminhtml/magesms_sendsms</action>
<sort_order>1</sort_order>
</sendsms>
<settings>
<title>Settings</title>
<action>adminhtml/system_config/edit/section/vivas/</action>
<sort_order>10</sort_order>
</settings>
<about translate="title" module="smsnotification">
<title>About</title>
<action>adminhtml/smsnotification_about</action>
<sort_order>11</sort_order>
</about>
</children>
</vivassms>
</menu>
<acl>
<resources>
<admin>
<children>
<vivassms>
<title>SMS</title>
<children>
<sendsms translate="title" module="smsnotification">
<title>Send SMS</title>
</sendsms>
<settings>
<title>Settings</title>
<children>
<smsprofile translate="title" module="smsnotification">
<title>Edit user account</title>
</smsprofile>
</children>
</settings>
<about translate="title" module="smsnotification">
<title>About</title>
</about>
</children>
</vivassms>
<system>
<children>
<config>
<children>
<vivassms translate="title" module="smsnotification">
<title>Vivas SMS</title>
</vivassms>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
I've added these three children tabs to the created new tab SMS Center but when i click on the About tab i got error 404 ON MY FRONTEND. This is awkward. Why i got redirected to the frontend ?
Can you please help me out to create a simple new custom page in the admin panel where i want to add a simple text?
Thanks in advance!
Seems like Magento recognizes your module is telling it "Check me for admin" controllers, but that Magento doesn't find any. The best way to figure out what Magento thinks your controller file should be named (as well as which folder it should be located in) is to add some temporary debugging to _validateControllerClassName
protected function _validateControllerClassName($realModule, $controller)
{
$controllerFileName = $this->getControllerFileName($realModule, $controller);
if (!$this->validateControllerFileName($controllerFileName)) {
var_dump($controllerFileName); //add this line
return false;
}
This will dump out every file Magento checks for a controller. Look for the line with your module name in it, and compare paths between where your file is located and where Magento thinks it should be located.

Magento is adding Mage as class prefix when I access role permission in admin

Fatal error on admission permission: Fatal error: Class 'Mage_Mypack_Mymodule_Helper_Data' not found in /path/to/magento/app/Mage.php on line 516
My config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mypack_Mymodule>
<version>0.1.0</version>
</Mypack_Mymodule>
</modules>
<global>
<models>
<mymodule>
<class>Mypack_Mymodule_Model</class>
</mymodule>
</models>
<helpers>
<mypack_mymodule>
<class>Mypack_Mymodule_Helper</class>
</mypack_mymodule>
</helpers>
</global>
</config>
My admin.xml
<?xml version="1.0"?>
<config>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<mmmymodle translate="title" module="Mypack_Mymodle">
<title>Mu module permission</title>
</mmmymodle>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
<mmmymodle translate="title" module="Mypack_Mymodle">
should be
<mmmymodle translate="title" module="mypack_mymodule">
Also, you should check if your module is enabled or not. (app/etc/modules/Mypack_Mymodule.xml)

How to add my extension to Magento Admin Menu Sidebar?

I am working on creating my very first community extension. It is a very simple one and is already working. I would like to learn how to add my extension to the admin area that will allow the customer to disable or enable it. What do I need to add to my module to be able to do this? Any help would be great!
Here is my code:
app/etc/modules/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Module_Name>
<!-- Whether our module is active: true or false -->
<active>true</active>
<!-- Which code pool to use: core, community or local -->
<codePool>community</codePool>
</Module_Name>
</modules>
</config>
etc/system.xml
<?xml version="1.0"?>
<config>
<sections>
<module translate="label" module="modulename">
<label>Your Module Name</label>
<tab>tab_id_where_you_want_to_add_your_section</tab>
<frontend_type>text</frontend_type>
<sort_order>980</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<groups>
<modulename>
<label>Your Group Title</label>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<comment translate="label comment">
<label>Your Field Title</label>
<comment>Your Comment</comment>
<frontend_type>text</frontend_type>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</comment>
</fields>
</modulename>
</groups>
</your_module>
</sections>
</config>
etc/adminhtml.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<menu>
<modulename translate="title" module="shipping">
<title>Module</title>
<sort_order>15</sort_order>
<children>
<modulename translate="title" module="modulename">
<title>Drop Down Shipping</title>
<sort_order>1</sort_order>
<action>adminhtml/shipping/index</action>
</example>
</children>
</modulename>
</menu>
<layout>
<updates>
<modulename>
<file>shipping.xml</file>
</modulename>
</updates>
</layout>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<modulename translate="title" module="shipping">
<title>Your Module Name</title>
</modulename>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Module_Name>
<version>0.0.1</version>
</Module_Name>
</modules>
<frontend>
<layout>
<updates>
<modulename>
<file>shipping.xml</file>
</modulename>
</updates>
</layout>
</frontend>
<global>
<helpers>
<modulename>
<class>Module_Name_Helper</class>
</modulename>
</helpers>
</global>
</config>
My theme Layout XML File:
<?xml version="1.0"?>
<layout version="0.1.0">
<checkout_cart_index>
<reference name="head">
<action method="addCss"><stylesheet>css/module/shipping.css</stylesheet></action>
</reference>
<reference name="checkout.cart.shipping">
<action method="setTemplate"><template>module/shipping.phtml</template></action>
</reference>
</checkout_cart_index>
</layout>
Helper/Data.php
<?php
class Module_Name_Data extends Mage_Core_Helper_Abstract
{
}
It is not quite clear from your question if you want to add node to main admin menu (horizontal one with fly-out sub-menus) or sidebar menu of System\Configuration screen. Below are instructions how to add section, group and field to Magento configuration screen.
First you need the etc/system.xml file to your module:
<?xml version="1.0"?>
<config>
<sections>
<your_module translate="label" module="your_module_shortcode">
<label>Your Module Name</label>
<tab>tab_id_where_you_want_to_add_your_section</tab>
<frontend_type>text</frontend_type>
<sort_order>980</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<groups>
<your_group_name>
<label>Your Group Title</label>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<fields>
<your_field_name translate="label comment">
<label>Your Field Title</label>
<comment>Your Comment</comment>
<frontend_type>text</frontend_type>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</your_field_name>
</fields>
</your_group_name>
</groups>
</your_module>
</sections>
</config>
And then add the following section to your etc/adminhtml.xml. It adds your newly created section to ACL so you will be able to control admin roles that can access it:
<config>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<your_module translate="title" module="your_module_shortcode">
<title>Your Module Name</title>
</your_module>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
The enable and disable module feature is already exist in System >> Configuration >> ADVANCE >> Advance.
BTW if you want to add Menu in the System >> Configuration page, this article may help you http://alanstorm.com/custom_magento_system_configuration.
And if you got an error, check again whether everything is ok or not.

Magento : Overriding Config Controller?

Can any one please tell me how to override config controller in magento. I have attatched my config code below :
<config>
<modules>
<Adodis_Themechooser>
<version>0.1.0</version>
</Adodis_Themechooser>
</modules>
<adminhtml>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<Adodis_Themechooser>
<title>Themechooser Module</title>
<sort_order>10</sort_order>
</Adodis_Themechooser>
<system>
<children>
<config>
<children>
<themechooser>
<title>Themechooser</title>
</themechooser>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</adminhtml>
<global>
<adminhtml>
<rewrite>
<themechooser_config>
<from><![CDATA[#^/admin/system_config/#]]></from>
<to>/themechooser/config/</to>
</themechooser_config>
</rewrite>
</adminhtml>
<models>
<themechooser>
<class>Adodis_Themechooser_Model</class>
</themechooser>
</models>
<helpers>
<themechooser>
<class>Adodis_Themechooser_Helper</class>
</themechooser>
</helpers>
</global>
</config>
An override of the config controller means you will be dealing with all presses of the Save Config button, not just your own themechooser page. That method of override means that no other module could ever make a compatible override of their own, and the "from/to" syntax is outdated anyway. Also an override is not needed at all, you're only interested in the saving of one field and that can be found through a backend_model.
Your module probably has an etc/system.xml file,
<config>
<sections>
<themechooser>
<groups>
<themechooser>
<fields>
<example translate="label">
<label>This is a text field</label>
<frontend_type>text</frontend_type>
<backend_model>themechooser/config_example</backend_model>
<show_in_default>1</show_in_default>
</example>
</fields>
</themechooser>
</groups>
</themechooser>
</sections>
</config>
Note the backend_model. Now make the class that fits themechooser/config_example,
class Adodis_Themechooser_Model_Config_Example extends Mage_Core_Model_Config_Data {
protected function _afterSave() {
$value = $this->getValue();
// $value is the text in the text field
}
}
All that remains is to use $value to set the frontend theme. The field can be any type, it does not have to be text.

Resources