I am Having issues when adding menu in admin panel magento - magento

I 've made a file to add my module as: [ File as- Axovel_MenuItem.xml]
<?xml version="1.0"?>
<config>
<modules>
<Axovel_MenuItem>
<active>true</active>
<codePool>local</codePool>
</Axovel_MenuItem>
</modules>
</config>
in folder app/etc/modules/
then i made a configuration file(config.xml) as
<?xml version="1.0"?>
<config>
<modules>
<Axovel_MenuItem>
<version>0.1.0</version>
</Axovel_MenuItem>
</modules>
<global>
<helpers>
<menuitem>
<class>Axovel_MenuItem_Helper</class>
</menuitem>
</helpers>
</global>
<frontend>
<routers>
<menuitem>
<routeurfrontend>
<use>standard</use>
<args>
<module>Axovel_MenuItem</module>
<frontName>menuitem</frontName>
</args>
</routeurfrontend>
</menuitem>
</routers>
</frontend>
<adminhtml>
<layout>
<updates>
<menuitem>
<file>menuitem.xml</file>
</menuitem>
</updates>
</layout>
<acl>
<resources>
<admin>
<children>
<menuitem>
<title>Awesome Menu Item</title>
<children>
<sub_menu1>
<title>Example Menu Item</title>
</sub_menu1>
</children>
</menuitem>
</children>
</admin>
</resources>
</acl>
</adminhtml>
</config>
in folder app/code/local/Axovel/MenuItem/etc/
then i made a Adminhtml Configuration File(adminhtml.xml) as
<?xml version="1.0"?>
<config>
<menu>
<menuitem>
<title>Awesome Menu Item</title>
<sort_order>20</sort_order>
<children>
<sub_menu1>
<title>Example Menu Item</title>
<sort_order>0</sort_order>
<!-- <action>menuitem/index/index</action> -->
</sub_menu1>
</children>
</menuitem>
</menu>
</config>
in folder app/code/local/Axovel/MenuItem/etc/
and made a Helper File(Data.php) as:
<?php
class Axovel_MenuItem_Helper_Data extends Mage_Core_Helper_Abstract
{
}
?>
in folder app/code/local/Axovel/MenuItem/Helper/
I also made a Controller file(IndexController.php) as:
<?php
class Axovel_MenuItem_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
?>
But Not Getting the Desired Results, I am not able to see my custom menu Item
Even i am not able to call my indexController/indexAction directly with Hyperlink as
http://127.0.0.1/magento/index.php/menuitem/index/index
there is something Wrong in config.xml but i am not able to figure it out, can anyone please Help?
Thanks :)

This looks like it is probably a caching issue. If you are new to magento, the cache can be easy to forget and really cause some problems for you. You should try clearing that in the backend or from the command line. cache is found in the var folder and you will want to empty bother the cache folder and the full_page_cache folder.
I don't know if the menu button will work or not because you didn't give any code that would generate a new page or block.

Related

How to add some content in menu item admin panel Magento

I have create some menu and his sub menu in admin panel(it displays me a blank page) so i want to add some input then this input I want to do some SQL query (Save text in db), and this text i want to display it in some sms page. I dont know how.
Menu admin panel
W/Testimony/controllers/Adminhtml/TestimonyController.php
class W_Testimony_Adminhtml_TestimonyController extends Mage_Adminhtml_Controller_Action{
protected function _initAction() {
$this->_title($this->__('Paramétrage'))
->_title($this->__('Témoignage'));
$this->loadLayout()
->_setActiveMenu('testimony/parametrage')
->_addBreadcrumb(Mage::helper('adminhtml')->__('testimony'), Mage::helper('adminhtml')->__('testimony'))
->_addBreadcrumb(Mage::helper('adminhtml')->__('Paramétrage'), Mage::helper('adminhtml')->__('Paramétrage'));
return $this;
}
public function indexAction() {
$this->_initAction()
->renderLayout();
}
}
W/Testimony/etc/adminhtml.xml
<config>
<menu>
<testimony translate="title" module="testimony">
<title>Témoignage</title>
<sort_order>100</sort_order>
<children>
<parametrage translate="title" module="testimony">
<title>Paramétrage</title>
<sort_order>1</sort_order>
<action>adminhtml/testimony/index</action>
</parametrage>
</children>
</testimony>
</menu>
W/Testimony/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<W_Testimony>
<version>0.0.1</version>
</W_Testimony>
</modules>
<adminhtml>
<layout>
<updates>
<testimony>
<file>testimony.xml</file> <!-- I dont know what is this file ?-->
</testimony>
</updates>
</layout>
<acl>
<resources>
<admin>
<children>
<testimony>
<title>testimony Menu Item</title>
<children>
<parametrage translate="title" module="testimony">
<title>param Menu Item</title>
</parametrage>
</children>
</testimony>
</children>
</admin>
</resources>
</acl>
</adminhtml>
<global>
<models>
<w_testimony>
<class>W_Testimony_Model</class>
</w_testimony>
</models>
<helpers>
<testimony>
<class>W_Testimony_Helper</class>
</testimony>
</helpers>
<blocks>
<w_testimony>
<class>W_Testimony_Block</class>
</w_testimony>
<w_testimony_adminhtml>
<class>W_Testimony_Block_Adminhtml</class>
</w_testimony_adminhtml>
</blocks>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<w_testimony after="Mage_Adminhtml">W_Testimony_Adminhtml</w_testimony>
</modules>
</args>
</adminhtml>
</routers>
</admin>
W/Testimony/Helper/Data.php
class W_Testimony_Helper_Data extends Mage_Core_Helper_Abstract{
}
W/Testimony/Model/Testimony.php
class W_Testimony_Model_Testimony extends Mage_Core_Model_Abstract{
public function _construct() {
$this->_isPkAutoIncrement = false;
$this->_init('w_testimony/testimony');
}
}
You can follow this instruction and create page in admin.
Create Module

magento controller not found

I have set up a controller in my module to add an order export tab to my installation:
in config.xml:
<admin>
<routers>
<adminhtml>
<args>
<modules>
<orderexport>abc_Orderexport_index2</orderexport>
</modules>
</args>
</adminhtml>
</routers>
<layout>
<updates>
<orderexport>
<file>orderexport.xml</file>
</orderexport>
</updates>
</layout>
</admin>
in adminhtml.xml:
<?xml version="1.0"?>
<config>
<menu>
<sales>
<children>
<orderexport>
<title>Order Export</title>
<sort_order>20</sort_order>
<action>adminhtml/index2</action>
</orderexport>
</children>
</sales>
</menu>
<acl>
<resources>
<admin>
<children>
<sales>
<children>
<orderexport>
<title>Order Export</title>
<sort_order>20</sort_order>
</orderexport>
</children>
</sales>
</children>
</admin>
</resources>
</acl>
</config>
and in the controllers/Adminhtml/Index2Controller.php file
class abc_Orderexport_Adminhtml_Index2Controller extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
However with all this done, whenever I click on the button "Order Export" it redirects me to the 404 page. That means that Magento cannot find the controller but idk why.
When i rename the controller everywhere from index2 into index (Index2Controller.php to IndexController.php) I am not getting redirected to the 404 page, HOWEVER the Dashboard of the admin panel just reloads.
I really don't know where my error is and Im happy for any hints into the right direction.
Here is what you have to fix:
in config.xml: you have to say that your module should be use in the adminhtml area, and you have to respect the CamelCase, here is how it should look like:
<admin>
<routers>
<adminhtml>
<args>
<modules>
<Abc_Orderexport after="Mage_Adminhtml">Abc_Orderexport_Adminhtml</Abc_Orderexport>
</modules>
</args>
</adminhtml>
</routers>
</admin>
in your controller, again, you must respect CamelCase, i.e. the class name is Abc_Orderexport_Adminhtml_Index2Controller
All this is assuming your folder structure is:
app/
code/
local/
Abc/
Orderexport/
controllers/
Adminhtml/
Index2Controller.php
etc/
config.xml
adminhtml.xml
, exactly, upper/lower case is important
Could you please try the following code and make sure that you module class name and folder structure must be in standard magento
extension structure. config.xml
<admin>
<routers>
<orderexport>
<use>admin</use>
<args>
<modules>
<orderexport>Abc_Orderexport_Index2</orderexport>
<frontName>orderexport</frontName>
</modules>
</args>
<orderexport>
</routers>
<layout>
<updates>
<orderexport>
<file>orderexport.xml</file>
</orderexport>
</updates>
</layout>
</admin>

Access Denied error when accessing catalog_product from custom module and logged in from other than admin

I have created a custom module, in the module when I click Save button sends request to catalog_products save function and save data to my extension's tables only(I have changed core file for this). Url on which I send request is:
localhost/magento/index.php/admin/admin/catalog_product/save/id/71/key5QDhzOH0ZRIgYZIC/?form_key=5QDhzOH0ZRIgYZIC&from_bpstore=yes
I have used ajax to save my data. And it is saving data when logged in from user having role "Administrator" but as I log in from any other user then it gives "Access Denied" error in response. Following is my config.xml for custom module:
<?xml version="1.0"?>
<config>
<modules>
<Bp_BpstoreInfo>
<version>0.1.0</version>
</Bp_BpstoreInfo>
</modules>
<global>
<helpers>
<bpstoreinfo>
<class>Bp_BpstoreInfo_Helper</class>
</bpstoreinfo>
</helpers>
<blocks>
<bpstoreinfo>
<class>Bp_BpstoreInfo_Block</class>
</bpstoreinfo>
</blocks>
</global>
<admin>
<routers>
<bpstoreinfo>
<use>admin</use>
<args>
<module>Bp_BpstoreInfo</module>
<frontName>bpstoreinfo</frontName>
</args>
</bpstoreinfo>
</routers>
</admin>
<adminhtml>
<menu>
<bpstoreinfo module="bpstoreinfo">
<title>Room Prices</title>
<sort_order>77</sort_order>
<action>bpstoreinfo/adminhtml_bpstoreinfobackend</action>
</bpstoreinfo>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<bpstoreinfo>
<title>bpstoreinfo Module</title>
<sort_order>1</sort_order>
</bpstoreinfo>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<bpstoreinfo>
<file>bpstoreinfo.xml</file>
</bpstoreinfo>
</updates>
</layout>
</adminhtml>
</config>
And my controller of custom module is
<?php
class Bp_BpstoreInfo_Adminhtml_BpstoreinfobackendController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->_title($this->__("Booking Prices"));
$this->renderLayout();
}
}
But when Ajax runs it sends data to catalog product module, Is this the problem that I am not able to save my data.
Please help I am totally stuck here. Thanks in Advance.

Magento : Create admin module

I have a problem. I following guideline but it doesn't work. I don't know debug how. Please tell me the way resolve problem.
This is HS_Imagepro.xml in etc/modules/ folder
<?xml version="1.0"?>
<config>
<modules>
<HS_Imagepro>
<active>True</active>
<codePool>core</codePool>
</HS_Imagepro>
</modules>
</config>
This is config.xml in HS/Imagepro/etc folder
<?xml version="1.0"?>
<config>
<modules>
<HS_Imagepro>
<version>0.1.1</version>
</HS_Imagepro>
</modules>
<admin>
<routers>
<adminhtml>
<use>admin</use>
<args>
<modules>
<module>HS_Imagepro</module>
<frontName>imagepro</frontName>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<menu>
<imagepro_menu translate="title" module="imagepro">
<title>ImagePro</title>
<sort_order>9999</sort_order>
<children>
<first_page module="imagepro">
<title>Our First Page</title>
<action>imagepro/index/index</action>
</first_page>
</children>
</imagepro_menu>
</menu>
</adminhtml>
<global>
<helpers>
<imagepro>
<class>HS_Imagepro_Helper</class>
</imagepro>
</helpers>
</global>
</config>
This is IndexController.php in HS/Imagepro/controllers/
<?php
class HS_Imagepro_IndexController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
?>
The result is the page not found.
If The following right guideline, access link http://localhost/magento/index.php/imagepro/ will appear admin login screen.
In ,HS_Imagepro.xml file the test TRUE Should be true.
routing code Wrong in config.xml
<?xml version="1.0"?>
<config>
<modules>
<HS_Imagepro>
<version>0.1.1</version>
</HS_Imagepro>
</modules>
<admin>
<routers>
<!-- Includes our controller, so when we add the adminhtml menu item below, it is found! -->
<adminhtml>
<args>
<modules>
<imagepro before="Mage_Adminhtml">HS_Imagepro_Adminhtml</imagepro>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
Also controller file and path name is wrong
HS/Imagepro/controllers/Adminhtml/ImageproController.php
<?php
class HS_Imagepro_Adminhtml_ImageproController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
?>
Testing url yourhost/magento/index.php/admin/imagepro
More details on http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/custom_module_with_custom_database_table#directory_additions
and frontend module http://www.amitbera.com/create-an-magento-extension-with-custom-database-table/

Magento Module Admin Controller Returns 404 Error

I am creating simple reports module by following this tutorial.When i try to open
http://localhost/dev/admin/adminhtml/report_example/simple
i get 404 error.Any help would be appreciated.Here's what i did
app/etc/modules/Package_Custom.xml
<?xml version="1.0"?>
<config>
<modules>
<Package_Custom>
<active>true</active>
<codePool>local</codePool>
</Package_Custom>
</modules>
</config>
app/code/local/Package/Custom/controllers/Adminhtml/Report/ExampleController.php
<?php
class Package_Custom_Adminhtml_Report_ExampleController extends Mage_Adminhtml_Controller_Action
{
public function _initAction()
{
$this->loadLayout()->_addBreadcrumb(Mage::helper('custom')->__('Custom'),Mage::helper('custom')->__('Custom'));
return $this;
}
}
?>
app/code/local/Package/Custom/etc/adminhtml.xml
<?xml version="1.0"?>
<config>
<menu>
<custom translate="title" module="custom">
<title>Custom</title>
<sort_order>15</sort_order>
<children>
<simple translate="title" module="custom">
<title>Simple Report<</title>
<sort_order>1</sort_order>
<action>adminhtml/report_example/simple</action>
</simple>
</children>
</custom>
</menu>
app/code/local/Package/Custom/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Package_Custom>
<version>1.0.0</version>
</Package_Custom>
</modules>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<custom before="Mage_Adminhtml">Package_Custom_Adminhtml</custom>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
You have to configure acl section in the adminhtml.xml
http://www.ecomdev.org/2010/10/28/defining-acl-resources-custom-and-admin-menu-in-magento.html
Solved the problem.In config.xml
<title>Simple Report<</title>
Should be
<title>Simple Report</title>

Resources