I created a button on my Adminhtml_Sales_Order_View file and i want it to point to my admin html controller but for an unknown reason when i click the button i got a page 404 error in the front end.
this is my /etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<PixelPlusOne_DragonPay>
<version>1.0.0</version>
</PixelPlusOne_DragonPay>>
</modules>
<global>
<models>
<dragonpay>
<class>PixelPlusOne_DragonPay_Model</class>
</dragonpay>
</models>
<helpers>
<dragonpay>
<class>PixelPlusOne_DragonPay_Helper</class>
</dragonpay>
</helpers>
<blocks>
<dragonpay>
<class>PixelPlusOne_DragonPay_Block</class>
</dragonpay>
</blocks>
</global>
<default>
<payment>
<dragonpay>
<model>dragonpay/standard</model>
<active>1</active>
<order_status>pending</order_status>
<title>Dragon Pay</title>
<payment_action>sale</payment_action>
<allowspecific>0</allowspecific>
<sort_order>1</sort_order>
</dragonpay>
</payment>
</default>
<admin>
<routers>
<adminhtml>
<use>admin</use>
<args>
<modules>
<PixelPlusOne_DragonPay before="Mage_Adminhtml">PixelPlusOne_DragonPay_Adminhtml</PixelPlusOne_DragonPay>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<frontend>
<routers>
<dragonpay>
<use>standard</use>
<args>
<module>PixelPlusOne_DragonPay</module>
</args>
</dragonpay>
</routers>
</frontend>
</config>
This is the button i added to my Sales_Order_View
/* UPDATE INCLUDED BY DRAGONPAY PAYMENT MODULE - START */
/**
* This button is added for DragonPay for QUERY API button for manual checking of payment result
*/
if($order->getPayment()->getMethodInstance()->getCode() == 'dragonpay'){
$message = 'Query the Payment Gateway To Check If Any Payments Made?';
$url = Mage::helper('adminhtml')->getUrl('dragonpay/adminhtml_admindragonpay/query/',array('order_id'=>$order->getId()));
$this->addButton('dragonpayapi_query', array(
'label' => '[--DRAGONPAY:Get payment status--]',
'onclick' => "confirmSetLocation('{$message}', '{$url}')",
));
}
/* UPDATE INCLUDED BY DRAGONPAY PAYMENT MODULE - END *
and finally my Adminhtml Controller
<?php
class PixelPlusOne_DragonPay_Adminhtml_AdmindragonpayController extends Mage_Adminhtml_Controller_Action
{
public function queryAction(){
echo "hi";
}
}
?>
Hoping that anybody could help me and i really appreciate the help. Thanks in advance.
Related
Im kinda stuck in my development. Im trying to add a new mass action to the adminpanel for orders, but i always return 404. I have tried multiple methods but never succeeded.. Hope some of you can tell me what i am doing wrong and how to fix it.
My config.xml
<modules>
<plusshop_shipmentcontrol>
<version>0.1.0</version>
</plusshop_shipmentcontrol>
</modules>
<global>
<models>
<shipmentcontrol>
<class>Plusshop_ShipmentControl_Model</class>
</shipmentcontrol>
</models>
</global>
<admin>
<routers>
<shipmentcontrol>
<use>admin</use>
<args>
<module>Plusshop_ShipmentControl</module>
<frontName>shipmentcontrol</frontName>
</args>
</shipmentcontrol>
</routers>
</admin>
<adminhtml>
<events>
<!-- Before rendering event -->
<core_block_abstract_prepare_layout_before>
<observers>
<plusshop_shipmentcontrol_add>
<type>singleton</type>
<class>shipmentcontrol/observer</class>
<method>addMassExport</method>
</plusshop_shipmentcontrol_add>
</observers>
</core_block_abstract_prepare_layout_before>
</events>
</adminhtml>
My Model/Observer.php:
<?php
class Plusshop_ShipmentControl_Model_Observer
{
public function addMassExport(Varien_Event_Observer $observer)
{
$block = $observer->getEvent()->getBlock();
if($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction && $block->getRequest()->getControllerName() == 'sales_order')
{
$block->addItem('shipmentcontrolall', array(
'label' => 'Create all shipments (GLS, DAO)',
'url' => Mage::app()->getStore()->getUrl('*/shipmentcontrol/massactions/index')
));
}
}
}
And finally my MassActionsController.php
<?php
require_once 'Mage/Adminhtml/controllers/Action.php';
class Plusshop_ShipmentControl_MassActionsController extends Mage_Adminhtml_Controller_Action {
public function indexAction() {
// $orderIds = $this->getRequest()->getPost('order_ids', array());
$this->_redirect('adminhtml/sales_order/');
}
}
Really hope some of you can tell what im doing wrong here? Feel like i tried everything but no luck. Did i misunderstood something or what is wrong?
Regards
Kevin.
Replace:
<admin>
<routers>
<shipmentcontrol>
<use>admin</use>
<args>
<module>Plusshop_ShipmentControl</module>
<frontName>shipmentcontrol</frontName>
</args>
</shipmentcontrol>
</routers>
</admin>
with:
<admin>
<routers>
<adminhtml>
<args>
<modules>
<Plusshop_ShipmentControl after="Mage_Adminhtml">Plusshop_ShipmentControl</Plusshop_ShipmentControl>
</modules>
</args>
</adminhtml>
</routers>
</admin>
You should be able to visit your page at: yoururl.com/admin/massactions/index (replace /admin part if you use different path to 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.
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/
I try to override Mage_Customer_AddressController, but my way doesn't work.
Used original documentation from magentocommerce.com and some blog posts (by Inchoo and Pfay) too.
Please explain me, what I'm doing wrong?
module config.xml:
<config>
<modules>
<companyname_General>
<version>1.0.5</version>
</Companyname_General>
</modules>
<global>
<helpers>
<Companyname_general>
<class>Companyname_General_Helper</class>
</Companyname_general>
</helpers>
<blocks>
<catalog>
<rewrite>
<product_list_toolbar>Companyname_General_Block_Catalog_Product_List_Toolbar</product_list_toolbar>
</rewrite>
</catalog>
</blocks>
<rewrite>
<companyname_general_customer_address>
<from><![CDATA[#^/customer/address/#]]></from>
<to>/general/customer_address</to>
</companyname_general_customer_address>
</rewrite>
</global>
<frontend>
<routers>
<customer>
<use>standard</use>
<agrs><companyname_general before="Mage_Customer">Companyname_General</companyname_general></agrs>
</customer>
</routers>
</frontend>
</config>
Companyname_General_AddressController:
<?php
require_once(Mage::getModuleDir('controllers','Mage_Customer').DS.'AddressController.php');
class Companyname_General_Customer_AddressController extends Mage_Customer_AddressController
{
public function testAction()
{
die('works too!');
}
}
ps: Magento Enterprise 1.12
First of all issue in helper Companyname_general should be companyname_general
then helper Mage::helper('companyname_general')
<helpers>
<companyname_general>
<class>Companyname_General_Helper</class>
</companyname_general>
</helpers>
config.xml(Path Is app/code/local/Companyname/General/etc/) code is
<?xml version="1.0" ?>
<config>
<modules>
<Companyname_General>
<version>1.0.5</version>
</Companyname_General>
</modules>
<global>
<helpers>
<general>
<class>Companyname_General_Helper</class>
</general>
</helpers>
<blocks>
<catalog>
<rewrite>
<product_list_toolbar>Companyname_General_Block_Catalog_Product_List_Toolbar</product_list_toolbar>
</rewrite>
</catalog>
</blocks>
</global>
<frontend>
<routers>
<customer>
<args>
<modules>
<general before="Mage_Customer">Companyname_General</general>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
controllers AddressController.php(Path: app/code/local/Companyname/General/controllers )
code is
<?php
require_once(Mage::getModuleDir('controllers','Mage_Customer').DS.'AddressController.php');
class Companyname_General_AddressController extends Mage_Customer_AddressController
{
/**
* Retrieve customer session object
*
* #return Mage_Customer_Model_Session
*/
protected function _getSession()
{
return Mage::getSingleton('customer/session');
}
public function preDispatch()
{
parent::preDispatch();
if (!Mage::getSingleton('customer/session')->authenticate($this)) {
$this->setFlag('', 'no-dispatch', true);
}
}
public function testAction()
{
die('works too!');
}
}
Module file is Companyname_General.xml path is app/etc/modules/
code are
<?xml version="1.0" ?>
<config>
<modules>
<Companyname_General>
<active>true</active>
<codePool>local</codePool>
</Companyname_General>
</modules>
</config>
I am adding in a new mass action for the sales order grid and when I am putting in the url for my action Magento cannot find my controller.
config.xml
<admin>
<routers>
<mymodule>
<use>admin</use>
<args>
<module>Namespace_mymodule</module>
<frontName>frontendname</frontName>
</args>
</mymodule>
</routers>
</admin>
<global>
<events>
<adminhtml_block_html_before>
<observers>
<mymodule>
<class>Namespace_mymodule_Model_Observer</class>
<method>addActions</method>
</mymodule>
</observers>
</adminhtml_block_html_before>
</events>
</global>
observer.php
public function addActions($event)
{
$block = $event->getBlock();
if($block instanceof Mage_Adminhtml_Block_Sales_Order_Grid)
{
$block->getMassactionBlock()->addItem('cpsync', array(
'label' => 'Push Orders to CounterPoint',
'url' => Mage::helper("adminhtml")->getUrl("frontendname/adminhtml_index/push/")
));
}
}
Whenever I try to use my mass action it sends me to a 404 redirect page with url
sitename.com/index.php/frontendname/adminhtml_index/push/key/
I think your config.xml is wrong. In the above config.xml, you havent mentioned about the model, block or helper classes. You had just declared about the module and an event. Here is the basic config.xml that you have to follow. Try to modify your config.xml as below.
<?xml version="1.0"?>
<config>
<modules>
<Test_Helloworld>
<version>0.1.0</version>
</Test_Helloworld>
</modules>
<frontend>
<routers>
<helloworld>
<use>standard</use>
<args>
<module>Test_Helloworld</module>
<frontName>helloworld</frontName>
</args>
</helloworld>
</routers>
<layout>
<updates>
<helloworld>
<file>helloworld.xml</file>
</helloworld>
</updates>
</layout>
</frontend>
<global>
<blocks>
<helloworld>
<class>Test_Helloworld_Block</class>
</helloworld>
</blocks>
<helpers>
<helloworld>
<class>Test_Helloworld_Helper</class>
</helloworld>
</helpers>
</global>
</config>