not load controller in magento, why? - magento

config.xml
<?xml version="1.0"?>
<config>
<modules>
<Asgard_New>
<version>1.6.0.0</version>
</Asgard_New>
</modules>
<global>
<models>
<asgardnew>
<class>Asgard_New_Model</class>
</asgardnew>
</models>
<helpers>
<asgardnew>
<class>Asgard_New_Helper</class>
</asgardnew>
</helpers>
</global>
<frontend>
<routers>
<asgardnew>
<use>standard</use>
<args>
<module>Asgard_New</module>
<frontName>new</frontName>
</args>
</asgardnew>
</routers>
</frontend>
</config>
Asgard_New.xml
<?xml version="1.0"?>
<config>
<modules>
<Asgard_New>
<active>true</active>
<codePool>local</codePool>
</Asgard_New>
</modules>
</config>
IndexController.php
<?php
class Asgard_New_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
echo "Hello, magento!!";
}
public function helloAction()
{
echo "Hello, action!!";
}
public function layoutAction()
{
$xml = $this->loadLayout()->getLayout()->getUpdate()->asString();
$this->getResponse()->setHeader("Content-Type", "text/plain")->setBody($xml);
Mage::log($xml, Zend_Log::INFO, 'layout_log', true);
}
public function defaultAction()
{
$this->loadLayout()->renderLayout();
}
}
?>
Modul -> local/Asgard I have folders with same code Test ans New
http://magento/test/index/index
http://magento/new/index/index
Not work, last two days works, but today i try created a own package and theme this is stop working. Why its may happened, guys? Thanks!

Try to replace asgardnew with new
<frontend>
<routers>
<new>
<use>standard</use>
<args>
<module>Asgard_New</module>
<frontName>new</frontName>
</args>
</new>
</routers>
</frontend>

Related

Magento 1: app/code/local not overriding core file

I have copied the "app/code/core/Mage/Customer/controllers/AccountController.php" to "app/code/local/Mage/Customer/controllers/AccountController.php" but it is not overriding the targeted file. what is getting wrong?
Create following files:
1) app/etc/modules/Muk_Account.xml
<?xml version="1.0"?>
<config>
<modules>
<Muk_Account>
<active>true</active>
<codePool>local</codePool>
</Muk_Account>
</modules>
</config>
2) app\code\local\Muk\Account\etc\config.xml
<?xml version="1.0"?>
<config>
<modules>
<Muk_Account>
<version>0.1.0</version>
</Muk_Account>
</modules>
<frontend>
<routers>
<customer>
<use>standard</use>
<args>
<modules>
<Muk_Account before="Mage_Customer">Muk_Account_Customer</Muk_Account>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
3) app\code\local\Muk\Account\controllers\Customer\AccountController.php
<?php
require_once 'Mage/Customer/controllers/AccountController.php';
class Muk_Account_Customer_AccountController extends Mage_Customer_AccountController
{
public function createPostAction()
{
}
}

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 - override Mage_Customer Address controller

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>

creating a module helloworld magento

I followed the tutorial in http://alanstorm.com/magento_controller_hello_world
but I don't know why the link filipeferminiano.com/lojateste/helloworld does't works.
Here is my config.xml
<config>
<modules>
<ffdotcom_Helloworld>
<version>0.1.0</version>
</ffdotcom_Helloworld>
</modules> <frontend>
<routers>
<helloworld>
<use>standard</use>
<args>
<module>ffdotcom_Helloworld</module>
<frontName>helloworld</frontName>
</args>
</helloworld>
</routers>
</frontend>
Create: app/code/local/Ffdotcom/Helloworld/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Ffdotcom_Helloworld>
<version>1.0.0</version>
</Ffdotcom_Helloworld>
</modules>
<frontend>
<routers>
<helloworld>
<use>standard</use>
<args>
<module>Ffdotcom_Helloworld</module>
<frontName>helloworld</frontName>
</args>
</helloworld>
</routers>
</frontend>
</config>
Create: app/code/local/Ffdotcom/Helloworld/controllers/IndexController.php
<?php
class Ffdotcom_Helloworld_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction(){
echo 'hello world';
}
}
Create: app/etc/modules/Ffdotcom_Helloworld.xml
<?xml version="1.0"?>
<config>
<modules>
<Ffdotcom_Helloworld>
<active>true</active>
<codePool>local</codePool>
</Ffdotcom_Helloworld>
</modules>
</config>
The first "f" in your module name must be capitalized in the frontend/routers/helloworld/args xpath.

Overwrite CompareController

I try to override the Core CompareController. Somehow i don't get it done.
I have done some research on the Magento website: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_overload_a_controller
But it did not help override the controller.
local/WP/Compare/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<WP_Compare>
<version>0.1.0</version>
</WP_Compare>
</modules>
<global>
<rewrite>
<WP_Compare_Catalog_Product_Compare>
<from><![CDATA[#^/catalog/product/compare/#]]></from>
<to>/compare/catalog/product/compare/</to>
</WP_Compare_Catalog_Product_Compare>
</rewrite>
</global>
</config>
local/WP/Catalog/controllers/Product/CompareController.php
<?php
require_once "Mage/Catalog/controllers/Product/CompareController.php";
class WP_Compare_Catalog_Product_CompareController extends Mage_Catalog_Product_CompareController
{
public function addAction()
{
echo 'Lets GO!';
}
}
?>
Can someone help me with this issue?
Thank you.
Gr.
Lex
This is the solution for my problem.
<?xml version="1.0"?>
<config>
<modules>
<WP_Compare>
<version>0.1.0</version>
</WP_Compare>
</modules>
<frontend>
<routers>
<catalog>
<use>standard</use>
<args>
<modules>
<WP_Compare before="Mage_Catalog">WP_Compare_Catalog</WP_Compare>
</modules>
</args>
</catalog>
</routers>
</frontend>
</config>
You may be need to do something similar to that into your etc.xml:
<frontend>
<routers>
<customer>
<args>
<modules>
<Mymodule_Customer before="Mage_Customer">Mymodule_Customer</Mymodule_Customer>
</modules>
</args>
</customer>
</routers>
</frontend>

Resources