Magento costum module shows 404 - magento

I tried the tutorial on http://www.satollo.net/magento-pdf-invoices-customer-dashboard/comment-page-1#comment-47565.
This allows a user to view invoices as PDF on the frontend of my Magento store. The problem is, when I click on the link which points to Pdfinvoice/index/invoices/order_id/5/ it shows a 404 error.
I registered the module as followed:
(renamed to module to Pdfinvoice to avoid conflict with another module)
<?xml version="1.0"?>
<config>
<modules>
<Pdfinvoice>
<active>true</active>
<codePool>local</codePool>
</Pdfinvoice>
</modules>
</config>
app/etc/modules/Pdfinvoice.xml
I am breaking my head over this.
Maybe the module isn't registered? I've tried googling it, but I can't get it to work.
Does anyone know a solution to this problem?

When you rename the module in the module definition xml, make sure you do the same with your local folder (app/code/local/Pdfinvoice), your config.xml:
app/code/local/Pdfinvoice/etc/config.xml
<config>
<modules>
<Pdfinvoice>
<version>1.0.0</version>
</Pdfinvoice>
</modules>
<frontend>
<routers>
<pdf>
<use>standard</use>
<args>
<module>Pdfinvoice</module>
<frontName>pdfinvoice</frontName>
</args>
</pdf>
</routers>
</frontend>
.. and your new controller:
app/code/local/Pdfinvoice/controllers/IndexController.php
<?php
class Pdfinvoice_IndexController extends Mage_Core_Controller_Front_Action {
public function invoicesAction() {
...
Works flawless, I installed the module in minutes.

Related

404 page in magento for custom module

I am new to magneto. I have created a custom module for webservice. I have done forgotpassword functionality but i am getting 404 page.
My folder structure for controller file:
app/code/local/Blazedream/Oauth/controllers/Customer/AccountController
class Blazedream_Oauth_Customer_AccountController extends Mage_Customer_AccountController
{
public function forgotPasswordPostAction()
{
echo"hiiiii";exit;
}
}
My config file:
<?xml version="1.0"?>
<config>
<modules>
<Blazedream_Oauth>
<version>0.1.0</version>
</Blazedream_Oauth>
</modules>
<frontend>
<routers>
<oauth>
<use>standard</use>
<args>
<modules>
<Blazedream_Oauth before="Mage_Oauth">Blazedream_Oauth</Blazedream_Oauth>
</modules>
</args>
</oauth>
</routers>
</frontend>
</config>
My module is enabled.
My url to run the forgotPasswordPostAction
http://xxxxxxxxxx/xxxxxx/index.php/oauth/customer/account/forgotpasswordpost
I am getting 404 page, i dont know where i had done the mistake.
If i create a accountcontroller file without creating the customer folder inside controllers folder, Then it is executing and print "hiiiiiiiii"
but If i create folder, yhen it displays 404 page..
Can anyone help me to fix this issue?
If you want to use the "Customer" folder that please use below:
Blazedream_Oauth_Customer
<modules>
<Blazedream_Oauth before="Mage_Oauth">Blazedream_Oauth_Customer</Blazedream_Oauth>
</modules>
class Blazedream_Oauth_Customer_AccountController extends Mage_Customer_AccountController
{
// your code
}
I found the issue.
I used wrong url to run, the correct url is
http://xxxxxx/xxxxxxxx/index.php/oauth/customer_account/forgotpasswordpost
Thanks for everyone replies.

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 1 - module controller not working

Tyring to create a module where i can create a product dynamically using catalog->products model, and redirect control to the product's review page. Need only single controller with single action. No blocks, helpers, templates.... nothing required.
But it seems like controller action is not properly routed, there is some mistake in code or configuration ... getting 404 not found error
Trying this url:
http://localhost/magento_test/dynamicproduct/index/index
Namespace: Waqasalieee
Module name: Dynamicproduct
Magento version: 1.7.0.2
Here are the file contents:
local/Waqasalieee/Dynamicproduct/controllers/IndexController.php
<?php
class Waqasalieee_Dynamicproduct_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction() {
die('working in index');
}
}
?>
local/Waqasalieee/Dynamicproduct/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Waqasalieee_Dynamicproduct>
<version>1.0</version>
</Waqasalieee_Dynamicproduct>
</modules>
<frontend>
<routers>
<dynamicproduct>
<use>standard</use>
<args>
<module>Waqasalieee_Dynamicproduct</module>
<frontName>dynamicproduct</frontName>
</args>
</dynamicproduct>
</routers>
</frontend>
</config>
app/etc/modules/Waqasalieee_Dynamicproduct.xml
<?xml version='1.0'?>
<config>
<modules>
<Waqasalieee_Dynamicproduct>
<codepool>local</codepool>
<active>true</active>
</Waqasalieee_Dynamicproduct>
</modules>
</config>
It should show some error or 'working in index' (string) but its giving 404 not found error.
I was having the same sympton and landed here. For me the error was not a erroneous XML config but that the Store Code was actually added to the URL (that's a magento feature, not a bug) and so my controller was only accessible by adding a valid store code to the URL like http://mystore/<storecode>/<controller>/<action>.
In my case http://mage.localhost/en/customer/check
In your config.xml use codePool instead of codepool.
<?xml version='1.0'?>
<config>
<modules>
<Waqasalieee_Dynamicproduct>
<codePool>local</codePool>
<active>true</active>
</Waqasalieee_Dynamicproduct>
</modules>
</config>

Magento admin controller gives 404

From the instructions at Alan's blog, I have added the router in my config.xml:
<?xml version="1.0"?>
<config>
<modules>
<Clean_Integration>
<version>1.0.0</version>
</Clean_Integration>
</modules>
<admin>
<routers>
<wellnesscoach_app_redirect>
<use>admin</use>
<args>
<module>Clean_Integration</module>
<frontName>appsync</frontName>
</args>
</wellnesscoach_app_redirect>
</routers>
</admin>
</config>
And then I have my controller defined here app/code/local/Clean/Integration/Controllers/IndexController.php :
<?php
die('checkpoint1');
class Clean_Integration_IndexController extends Mage_Adminhtml_Controller_Action {
public function indexAction() {
$this->_redirectUrl('/appointments/sync/backend/');
die('checkpoint2');
}
}
When I try to open this url, it goes to the frontend side and throws a 404.
What's causing magento to not pick up this admin router?
<?xml version="1.0"?>
<config>
<modules>
<Clean_Integration>
<version>1.0.0</version>
</Clean_Integration>
</modules>
<admin>
<routers>
<integration>
<use>admin</use>
<args>
<module>Clean_Integration</module>
<frontName>appsync</frontName>
</args>
</integration>
</routers>
</admin>
Should be lower case controllers
app/code/local/Clean/Integration/controllers/IndexController.php
You may also want to put this in Adminhtml folder so that you dont run into issue in the future if you want to add a frontend and a admin controller.
app/code/local/Clean/Integration/controllers/Adminhtml/IndexController.php
One mistake I see you made is putting the controller in a folder called 'Controllers' instead of 'controllers' (case mistake).
For future reference to anyone else with this problem:
If your controller does not use the standard name of IndexController.php, you will still need to name both the file name and the class name within using the ...Controller convention.
So, if your controller lives in the Adminhtml folder, name it ExtensionController.php and name the class within My_Module_Adminhtml_ExtensionController extends ...
Credit to goes to this excellent article. HTH.

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