I've got module: local/Zzepish/Example.
etc/config.xml:
<global>
<models>
<example>
<class>Zzepish_Example_Model</class>
</example>
</models>
<helpers>
<example>
<class>Zzepish_Example_Helper</class>
</example>
</helpers>
<models>
<example>
<class>Zzepish_Example_Model</class>
</example>
</models>
<blocks>
<example>
<class>Zzepish_Example_Block</class>
</example>
</blocks>
</global>
<frontend>
<routers>
<example>
<use>standard</use>
<args>
<module>Zzepish_Example</module>
<frontName>example</frontName>
</args>
</example>
</routers>
</frontend>
app/etc/modules/Zzepish_Example.xml
<modules>
<Zzepish_MyModule>
<active>true</active>
<codePool>local</codePool>
<depends />
</Zzepish_MyModule>
</modules>
controller in Zzepish/Example/controllers/IndexController.php :
class Zzepish_Example_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
echo 'Hello!';
}
}
But, when i go to my_website/example , my_website/example/index/index it redirects me to 404.
problem is in
app/etc/modules/Zzepish_Example.xml update with following
<modules>
<Zzepish_Example>
<active>true</active>
<codePool>local</codePool>
<depends />
</Zzepish_Example>
</modules>
Related
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>
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>
Im trying to rewrite the Mage_Review_Model_Resource_Review_Summary_Collection.
The Module is activated.
The folde structure is the same as in core review.
The problem should be in the xml.
My xml is:
<?xml version="1.0"?>
<config>
<modules>
<LM_Review>
<version>0.1.0</version>
</LM_Review>
</modules>
<frontend>
<routers>
<review>
<args>
<modules>
<lm_review before="Mage_Review">LM_Review</lm_review>
</modules>
</args>
</review>
</routers>
<layout>
<updates>
<lm_review>
<file>lm/review.xml</file>
</lm_review>
</updates>
</layout>
<translate>
<modules>
<LM_Review>
<files>
<default>LM_Review.csv</default>
</files>
</LM_Review>
</modules>
</translate>
</frontend>
<global>
<models>
<review_resource>
<rewrite>
<review_summary_collection>LM_Review_Model_Resource_Review_Summary_Collection</review_summary_collection>
</rewrite>
</review_resource>
</models>
</global>
</config>
LM_All.xml in etc/modules
<LM_Review>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Review />
</depends>
</LM_Review>
The Collection.php in app/code/local/LM/Review/Model/Resource/Review/Summary/Collection.php
class LM_Review_Model_Resource_Review_Summary_Collection extends Mage_Review_Model_Resource_Review_Summary_Collection {
public function addStoreFilter($storeId) {
die('test');
}
}
Your XML is correct. With the above XML in place, if you make the factory method call
Mage::getResourceModel('review/review_summary_collection')
Magento will attempt to instantiate a
LM_Review_Model_Resource_Review_Summary_Collection
That means
Magento can't see your module (no app/etc/module file, or file is inactive, or file is pointing to the wrong code pool)
You do not have a file at LM/Review/Model/Resource/Review/Summary/Collection.php in your code pool
The class defined in Collection.php is not LM_Review_Model_Resource_Review_Summary_Collection
The class defined in Collection.php does not extend Mage_Review_Model_Resource_Review_Summary_Collection
Check the spelling and upper/lower case of your class and path names. This matters to Magento.
I found the problem. Its required to add the resource-model to the xml and not only rewrite it.
<global>
<models>
<review>
<resourceModel>review_resource</resourceModel>
</review>
<review_resource>
<rewrite>
<review_summary_collection>LM_Review_Model_Resource_Review_Summary_Collection</review_summary_collection>
</rewrite>
</review_resource>
</models>
</global>
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>