Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Creating a new controller
 
Fontis
Sr. Member
 
Avatar
Total Posts:  99
Joined:  2007-08-31
Melbourne, Australia
 

I’m attempting to create a new payment method, similar to the existing PayPal Standard, which redirects the customer offsite. I have copied the general flow of the PayPal module but have obviously been using my own namespace and naming conventions, which I believe is causing problems with Magento “finding” my custom controller which does the redirect (or, rather, loads the block which does it).

My custom controller is found at

app/code/local/Fontis/Australia/controllers/PaymateController.php
and has a class definition of
class Fontis_Australia_PaymateController extends Mage_Core_Controller_Front_Action
The method I am trying to call is
public function redirectAction()
I had thought that you’d be able to get to this with “paymate/redirect” or “australia/paymate/redirect” but these pages return a 404 error.

I’ve tried copying all the obvious stuff from the Paypal module (aside from names), including some config settings, but to no avail. Is there any information about how to create new controllers, along with naming? Perhaps just what URL I am meant to call. smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Fontis
Sr. Member
 
Avatar
Total Posts:  99
Joined:  2007-08-31
Melbourne, Australia
 

I have been looking into this further but still have not found out what the problem is. My config file has the following:

<config>
    ...
    <
frontend>
        <
routers>
            <
australia>
                <use>
standard</use>
                <
args>
                    <
module>Fontis_Australia</module>
                    <
frontName>paymate</frontName>
                </
args>
            </
australia>
        </
routers>
    </
frontend>
    ...
</
config>

Is this what I’m supposed to be using?

UPDATE: Got it sorted out - I was just using the wrong URL as I suspected! smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Keints
Jr. Member
 
Total Posts:  5
Joined:  2008-05-21
 

What was the correct URL? I have the same problem.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

Can you show us more of your config file please ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Fontis
Sr. Member
 
Avatar
Total Posts:  99
Joined:  2007-08-31
Melbourne, Australia
 

So, here is my final config.xml file:

<config>
    ...
    <
frontend>
        <
routers>
            <
australia>
                <use>
standard</use>
                <
args>
                    <
module>Fontis_Australia</module>
                    <
frontName>australia</frontName>
                </
args>
            </
australia>
        </
routers>
    </
frontend>
    ...
</
config>

The URL to access this is then “australia/paymate/redirect”. So it breaks down as the following:

frontName/controllerName/actionName

Where
frontName = name listed in config.xml
controllerName = name of controller, where the format is NameController and Name is the controller’s name
actionName = name of action in controller, where the format is nameAction and name is the action’s name

 
Magento Community Magento Community
Magento Community
Magento Community
 
NoStressCommer
Sr. Member
 
Avatar
Total Posts:  106
Joined:  2008-01-17
Prag, Czech republic
 

.

 
Magento Community Magento Community
Magento Community
Magento Community
 
NoStressCommer
Sr. Member
 
Avatar
Total Posts:  106
Joined:  2008-01-17
Prag, Czech republic
 

Hi all,

canyou help me with overriding a controller?  I am working with Sales - I am trying to add new action for printing another docs in pdf from Sales -> Orders ... see attachment

I have created these folders with these files

1) /app/code/local/Nostress/Adminhtml/controllers/Sales/OrderController.php

echo "blabla"// only for testing
require_once 'Mage/Adminhtml/controllers/Sales/OrderController.php'// I have found this line in wiki
class Nostress_Adminhtml_Sales_OrderController extends Mage_Adminhtml_Sales_OrderController
{
//here I would like to add my methods ...
}

2) /app/code/local/Nostress/Adminhtml/etc/config.xml

<?xml version="1.0"?>
<config>

    <
modules>
        <
Nostress_Adminhtml>
            <
version>1.0.0</version>
        </
Nostress_Adminhtml>
    </
modules>
    
    <
admin>
        <
routers>
            <
nostress_adminhtml>
                <use>
admin</use>
                <
args>
                    <
module>Nostress_Adminhtml</module>
                    <
frontName>admin</frontName>
                </
args>
            </
nostress_adminhtml>
        </
routers>
    </
admin

</
config>

3) I have activated my modul in /app/modules/Nostress_All.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <
modules>
        <
Nostress_Adminhtml>
            <
active>true</active>
            <
codePool>local</codePool>
        </
Nostress_Adminhtml>
    
    </
modules>
</
config>

PROBLEM

After clicking in backend at Sales -> Orders -> View order -> Invoice I got 404 error ... any help please? thanks smile

SECOND QUESTION

What is the difference between folders controllers and Controller in /app/code/core/Mage/Adminhtml/ ??

Image Attachments
slozenka.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top