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>
Related
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.
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
When the user types his email and password at login page or checkout page he is redirected to login page always without any error message in screen and log files (php log and magento log). The dashboard is only acessible when the user creates a new account.
Magento 1.8.1 (migrated from 1.8.0)
Ultimo theme
Please try this.
Step 1: Web_Customer.xml - Enabling custom module:
<?xml version=”1.0″?>
<config>
<modules>
<Web_Customer>
<active>true</active>
<codePool>local</codePool>
</Web_Customer>
</modules>
</config>
Step 2: config.xml – Configuration for our module:
<?xml version=”1.0″?>
<config>
<modules>
<Web_Customer>
<version>0.0.1</version>
</Web_Customer>
</modules>
<frontend>
<routers>
<customer><!– Name of core module to be overridden–>
<args>
<modules>
<Web_Customer before=”Mage_Customer”>Web_Customer</Web_Customer><!– Tell Magento to call our custom module before the Mage/Checkout module –>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
Step 3: Add the following code to line 139 just after the opening of loginPostAction() in AccountController.php
<?php
require_once(“Mage/Customer/controllers/AccountController.php”);
class Web_Customer_AccountController extends Mage_CUstomer_AccountController{
public function loginPostAction()
{
// generate form_key if missing or invalid
if (!($formKey = $this->getRequest()->getParam(‘form_key’, null)) || $formKey != Mage::getSingleton(‘core/session’)->getFormKey()) {
$this->getRequest()->setParams(array(‘form_key’ =>Mage::getSingleton(‘core/session’)->getFormKey()));
}
//Note*
// rest code is same as from Mage/Customer/controllers/AccountController.php
}
}
?>
Delete the folder var/cache and var/session.
If the domain name has changed make sure that you also change the cookie domain in the database.
I need to override a method in a Magento core file, I am pretty sure I have done it the correct way and it is working on someone else's machine, but it's just not working on my own machine. We have the same environment. It's pretty weird I couldn't find out why and I have checked the file permissions, still don't see any light in solving the problem. Wonder has anyone run into the same problem? I am running 1.7
Many thanks!
--Update--
My custom block class (app/code/local/Company/Cms/Block/Page.php)
require_once("Mage/Cms/Block/Page.php");
class Company_Cms_Block_Page extends Mage_Cms_Block_Page
{
protected function _prepareLayout()
{
// my code
}
}
app/code/local/Company/Cms/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Company_Cms>
<version>0.0.1</version>
</Company_Cms>
</modules>
<global>
<blocks>
<cms>
<rewrite>
<page>Company_Cms_Block_Page</page>
</rewrite>
</cms>
</blocks>
</global>
</config>
app/etc/modules/Company_Cms.xml
<?xml version="1.0"?>
<config>
<modules>
<Company_Cms>
<active>true</active>
<codePool>local</codePool>
</Company_Cms>
</modules>
</config>
This custom module isn't being executed at all as nothing changes unless I change code in core block class.
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.