For a custom module I created a new actioncontroller. But it doesn't execute. It's returns only a 404.
I tried already some solutions from stackoverflow, but no one is working for me. :(
Urls I tried to call my action:
http://pharmaprofit.dev/index.php/medipim/sync/
http://pharmaprofit.dev/medipim/sync/
http://pharmaprofit.dev/medipim/sync/index
Can you take a look in my code? Maybe it's just a typo I didn't see.
Crmart/Medipim/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Crmart_Medipim>
<version>0.1.0</version>
</Crmart_Medipim>
</modules>
<frontend>
<routers>
<medipim>
<use>standard</use>
<args>
<module>Crmart_Medipim</module>
<frontName>medipim</frontName>
</args>
</medipim>
</routers>
</frontend>
</config>
Crmart/Medipim/controllers/SyncController.php
class Crmart_Medipim_SyncController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
//
echo 'hello world!';
}
public function nowAction()
{
// ...
}
}
app/etc/modules/Crmart_Medipim.xml
<?xml version="1.0"?>
<config>
<modules>
<Crmart_Medipim>
<active>true</active>
<codePool>local</codePool>
</Crmart_Medipim>
</modules>
</config>
Ok. Fixed!
I had enabled to view storecodes in my url.
So when I enter http://pharmaprofit.dev/nl/medipim/sync/now instead of http://pharmaprofit.dev/medipim/sync/now , it's working!
Plug-in files created correctly check once below steps for you plug-in works.
Check that plugin is successfully registered or not form admin section
Admin ->System->configuration->Advance
check plugin is listed here
open the app/etc/local.xml and check the below line
<disable_local_modules>false</disable_local_modules>
the value must be false otherwise plugin will not work
Related
I am trying to override/extend the Ebizmarts SagePay Suite Ebizmarts_SagePaySuite_Model_Api_Payment model class
My module looks like this:
etc/modules/Sulman_ModifySagePay.xml
<?xml version="1.0"?>
<config>
<modules>
<Sulman_ModifySagePay>
<active>true</active>
<codePool>local</codePool>
<version>1.0</version>
<depends>
<Ebizmarts_SagePaySuite />
</depends>
</Sulman_ModifySagePay>
</modules>
</config>
app/code/local/Sulman/ModifySagePay/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Sulman_ModifySagePay>
<version>0.0.1</version>
</Sulman_ModifySagePay>
</modules>
<global>
<models>
<sagepaysuite>
<rewrite>
<api_payment>Sulman_ModifySagePay_Model_Api_Payment</api_payment>
</rewrite>
</sagepaysuite>
</models>
</global>
</config>
app/code/local/Sulman/ModifySagePay/Model/Api/Payment.php
<?php
class Sulman_ModifySagePay_Model_Api_Payment extends Ebizmarts_SagePaySuite_Model_Api_Payment {
public function _construct(){
Mage::log('in my construct()', null, 'Sulman.log');
}
public function requestPost($url, $data, $returnRaw = false) {
Mage::log('in my requestPost()', null, 'Sulman.log');
}
}
Nothing gets logged and this gives me errors on the checkout page because:
When I check to see if it is instantiated it returns false (if I disable my module it returns the Ebizmarts_SagePaySuite_Model_Api_Payment object):
var_dump(Mage::getModel('sagepaysuite/api_payment'));
Other calls to this model throughout the site also fail.
I'm a little confused as it seems my rewrite is working correctly but it can't seem to find my new model class.
Anyone have any ideas where I'm going wrong?
Thanks
In your app/code/local/Sulman/ModifySagePay/etc/config.xml in the <models></models> section you need to define where your models are located:
<models>
<modifysagepay>
<class>Sulman_ModifySagePay_Model</class>
<modifysagepay>
</models>
I would like to do the above.
Ive overridden many files in the past...block, model, helper....but this one eludes me.
Can anyone see what im doing wrong here:
(ive edited this code...to include some of the recomendations now...)
Heres my folder structure (2 controller locations as a test):
/Idigital/Idgeneral/etc/config.xml
/Idigital/Idgeneral/controllers/Checkout/CartController.php
/Idigital/Idgeneral/controllers/CartController.php
Heres my config.xml:
<?xml version="1.0"?>
<config>
<modules>
<idigital_idgeneral>
<version>0.1.0</version>
</idigital_idgeneral>
</modules>
<global>
<blocks>
<idgeneral><class>Idigital_Idgeneral_Block</class></idgeneral>
</blocks>
</global>
<frontend>
<routers>
<checkout>
<use>standard</use>
<args>
<modules>
<Idigital_Idgeneral before="Mage_Checkout">Idigital_Idgeneral_Checkout</Idigital_Idgeneral>
</modules>
</args>
</checkout>
</routers>
<layout>
<updates>
<idgeneral>
<file>idigital.xml</file>
</idgeneral>
</updates>
</layout>
</frontend>
</config>
Ihave placed my controller file in 2 locations to test.
And heres the top of my FIRST controller file:
require_once 'Mage/Checkout/controllers/CartController.php';
class Idigital_Idgeneral_Checkout_CartController extends Mage_Checkout_CartController
{
public function testAction()
{
var_dump('inside checkout/cart/test');exit;
}
/**
* Add product to shopping cart action
*/
public function addAction()
{
blah...
}
Ans my second controller:
require_once 'Mage/Checkout/controllers/CartController.php';
class Idigital_Idgeneral_CartController extends Mage_Checkout_CartController
{
public function testAction()
{
var_dump('inside cart/test');exit;
}
/**
* Add product to shopping cart action
*/
public function addAction()
{
blah...
}
When i visit: /checkout/cart/add
Im directed to the mage controller...not my local. (i have var_dump stmts in each..so i can see which is ran).
When i visit /checkout/cart/test - i get a 404
When i visit /cart/add or cart/test - i get a 404
when i visit idgeneral/cart/test or idgeneral/cart/add - i get a 404
Create your module folders and files
app/code/local/MyNameSpace/MyModule/etc/config.xml
app/code/local/MyNameSpace/MyModule/controllers/Checkout/CartController.php
app/etc/modules/MyNameSpace_All.xml
Edit /etc/config.xml and Create app/code/local/MyNameSpace/MyModule/etc/config.xml with the following content:
<?xml version="1.0"?>
<config>
<modules>
<MyNameSpace_MyModule>
<version>0.1.0</version>
</MyNameSpace_MyModule>
</modules>
<global>
<!-- This rewrite rule could be added to the database instead -->
<rewrite>
<!-- This is an identifier for your rewrite that should be unique -->
<!-- THIS IS THE CLASSNAME IN YOUR OWN CONTROLLER -->
<mynamespace_mymodule_checkout_cart>
<from><![CDATA[#^/checkout/cart/#]]></from>
<!--
- mymodule matches the router frontname below
- checkout_cart matches the path to your controller
Considering the router below, "/mymodule/checkout_cart/" will be
"translated" to "/MyNameSpace/MyModule/controllers/Checkout/CartController.php" (?)
-->
<to>/mymodule/checkout_cart/</to>
</mynamespace_mymodule_checkout_cart>
</rewrite>
</global>
<!--
If you want to overload an admin controller this tag should be <admin> instead,
or <adminhtml> if youre overloading such stuff (?)
-->
<frontend>
<routers>
<mynamespace_mymodule>
<!-- should be set to "admin" when overloading admin stuff (?) -->
<use>standard</use>
<args>
<module>MyNameSpace_MyModule</module>
<!-- This is used when "catching" the rewrite above -->
<frontName>mymodule</frontName>
</args>
</mynamespace_mymodule>
</routers>
</frontend>
Note: The above didn’t work for me when I override catalog/product controller. I had to use:
<from><![CDATA[#^catalog/product/#]]></from>
<to>mymodule/mycontroller</to>
(notice the missing leading slash)
Since Magento 1.3 you can simply add your module to the frontend router. Rewrites are not neccessary any more:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<MyNameSpace_MyModule>
<version>0.1.0</version>
</MyNameSpace_MyModule>
</modules>
<frontend>
<routers>
<checkout>
<args>
<modules>
<MyNameSpace_MyModule before="Mage_Checkout">MyNameSpace_MyModule</MyNameSpace_MyModule>
</modules>
</args>
</checkout>
</routers>
</frontend>
Please note that before=”Mage_Checkout” will load your controller first if available and fall back to Magento’s if not.
If the controller is in another folder, you’ll have to modify the code:
app/code/local/MyNameSpace/MyModule/controllers/Checkout/CartController.php.
Replace
<MyNameSpace_MyModule before="Mage_Checkout">MyNameSpace_MyModule</MyNameSpace_MyModule>
with
<MyNameSpace_MyModule before="Mage_Checkout">MyNameSpace_MyModule_Checkout</MyNameSpace_MyModule>
Edit 'controllers/Checkout/CartController.php'
Create app/code/local/MyNameSpace/MyModule/controllers/Checkout/CartController.php with the following content: (the only change to indexAction() is adding an error_log() call):
<?php
# Controllers are not autoloaded so we will have to do it manually:
require_once 'Mage/Checkout/controllers/CartController.php';
class MyNameSpace_MyModule_Checkout_CartController extends
Mage_Checkout_CartController
{
# Overloaded indexAction
public function indexAction() {
# Just to make sure
error_log('Yes, I did it!');
parent::indexAction();
}
}
Edit 'app/etc/modules/MyNameSpace_All.xml'
(This is to activate your module)
true
local
Edit 'app/design/frontend/[myinterface]/[mytheme]/layout/checkout.xml' and add the following to use the same update handle as before:
<mynamespace_mymodule_checkout_cart_index>
<update handle="checkout_cart_index"/>
</mynamespace_mymodule_checkout_cart_index>
(Note that these tags seem to be case sensitive. Try using all lowercase if this isn’t working for you)
[by Hendy: When I override catalog/product/view using the method described in this Wiki or here, I didn’t have to do the above. However, when using the 'cms way', I had to update the handle manually.]
The above item did not work for me (2009-02-19 by Jonathan M Carvalho)
I discovered that the file to change is app/design/frontend/[myinterface]/[mytheme]/layout/mymodule.xml
Add the following lines:
Point your browser to /checkout/cart/
In your PHP error log, you should find ‘Yes, I did it!’.
You need to be extra precise with the rewrite regular expression because errors are very hard to find.
<Idigital_Idgeneral before="Mage_Checkout">Idgeneral_Checkout</Idigital_Idgeneral>
Should be
<Idigital_Idgeneral before="Mage_Checkout">Idigital_Idgeneral_Checkout</Idigital_Idgeneral>
or try moving your custom controller up to
../Idigital/Idgeneral/controllers/CartController.php
and use
<Idigital_Idgeneral before="Mage_Checkout">Idigital_Idgeneral</Idigital_Idgeneral>
There is also an error in your <modules> tag location. It should be:
<config>
<modules>
<idigital_idgeneral>
<version>0.1.0</version>
</idigital_idgeneral>
</modules>
<global>
...
</global>
<frontend>
....
</frontend>
...
</config>
i.e <modules> shouldn't be inside <global>
Here's a good tutorial on how to dump the config tree that Magento sees as XML: http://alanstorm.com/magento_config
I'm leaving this here for the next poor developer forced to work with this jalopy. Much of the instructions here are pasted from the magento docs which like its source, is a twisted labyrinth of misdirection. Okay enough complaints...
This worked for me in version 1.8
Create your namespace and module:
/app/code/local/MyNameSpace/MyModule
Create your module config:
/app/code/local/MyNameSpace/MyModule/etc/config.xml
<?xml version="1.0" ?>
<config>
<modules>
<MyNameSpace_MyModule>
<version>0.1.0</version>
</MyNameSpace_MyModule>
</modules>
<frontend>
<routers>
<checkout>
<args>
<modules>
<MyNameSpace_MyModule before="Mage_Checkout">MyNameSpace_MyModule_Checkout</MyNameSpace_MyModule>
</modules>
</args>
</checkout>
</routers>
</frontend>
Create your controller:
/app/code/local/MyNameSpace/MyModule/controllers/Checkout/CartController.php
<?php
require_once Mage::getModuleDir('controllers', 'Mage_Checkout').DS.'CartController.php';
class MyNameSpace_MyModule_Checkout_CartController extends Mage_Checkout_CartController
{
public function indexAction() {
// /var/log/debug.log should log the output
Mage::log('cart index override', null, 'debug.log');
// Call the parent class
parent::indexAction();
}
}
Enable your new module:
/app/etc/modules/MyNameSpace_All.xml
<?xml version="1.0" ?>
<config>
<modules>
<MyNameSpace_MyModule>
<active>true</active>
<codePool>local</codePool>
</MyNameSpace_MyModule>
</modules>
</config>
That's all thats needed. Now go celebrate, you just polished a turd! ;)
This is a little notification on the include path of the controller.
This include path can cause errors if the Magento Compiler mode is turned on.
require_once 'Mage/Checkout/controllers/CartController.php';
Instead of that it is good to use
require_once Mage::getModuleDir('controllers', 'Mage_Checkout').DS.'CartController.php';
It will be safer.
Well...it WONT override the checkout cart controller.
So i used the URL REWRITE in the PRODUCT VIEW...from this link...near the bottom of the article. They say its a proper method...
http://www.excellencemagentoblog.com/magento-add-product-to-cart-ajax
if(!url){
url = jQuery('#product_addtocart_form').attr('action');
}
url = url.replace("checkout/cart","idgeneral/cart");
That worked for me. Allows me to get cracking. Basically calls MY controller..instead of checkout controller.
Thanks for the help ROSCIUS...appreciated.
I also had to change my config....my routers section now looks like this:
<routers>
<!-- THIS PART REGISTERS OUR CONTROLLERS FOLDER FOR USE -->
<idgeneral>
<use>standard</use>
<args>
<module>Idigital_Idgeneral</module>
<frontName>idgeneral</frontName>
</args>
</idgeneral>
<!-- THIS PART WONT WORK TO OVERWRITE OUR MAGE CONTROLLER -->
<checkout>
<use>standard</use>
<args>
<modules>
<Idigital_Idgeneral before="Mage_Checkout">Idigital_Idgeneral_Checkout</Idigital_Idgeneral>
</modules>
</args>
</checkout>
</routers>
I am having problems while overriding a core controller. I want to add a new function but it only works if I do it in the core file (code/core/checkout/controllers/onepagecontroller.php).
I have followed some post, but it's not working. Some of them are:
http://www.magentocommerce.com/boards/viewthread/32979/P0/
http://www.webspeaks.in/2011/03/override-controllers-in-magento.html
www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_overload_a_controller
(I can't add more links, sorry)
I don't know what is happening... maybe you can help me ;).
I'm using magento 1.5 and I have this 3 files:
local -> Arias -> CoreExtended -> etc -> config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Arias_CoreExtended>
<version>0.1.0</version>
</Arias_CoreExtended>
</modules>
<frontend>
<routers>
<checkout>
<args>
<modules>
<Arias_CoreExtended before="Mage_Checkout">Arias_CoreExtended_Checkout</Arias_CoreExtended>
</modules>
</args>
</checkout>
</routers>
</frontend>
</config>
app -> etc -> modules -> Arias_CoreExtended.xml
<?xml version="1.0"?>
<config>
<modules>
<Arias_CoreExtended>
<active>true</active>
<codepool>local</codepool>
</Arias_CoreExtended>
</modules>
</config>
local -> Arias -> CoreExtended -> controllers -> Checkout -> OnepageController.php
<?php
require_once 'Mage/Checkout/controllers/OnepageController.php';
class Arias_CoreExtended_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
public function collectAction()
{
echo 'WTF?';
}
public function indexAction()
{
echo "This controller has been overridden.";
}
}
Thanks in advance for your time, regards.
I would first mirror the same directory structure of the controller you are overwriting, so in this case change: local/Arias/CoreExtended/controllers/Checkout/OnepageController.php to local/Arias/CoreExtended/controllers/OnepageController.php
You should lowercase your namespace/module name and you need to remove _Checkout as it is overwriting the controllers in general, and will look up any that exist in the module to use them instead if not fall back to standard. The correct code would be:
<arias_coreextended before="Mage_Checkout">Arias_CoreExtended</arias_coreextended>
I have used this exact setup with success to overwrite the Onepage controller!
I would try lower casing your namespace/modulename like so:
<arias_coreextended before="Mage_Checkout">Arias_CoreExtended_Checkout</arias_coreextended>
Your approach is mostly correct #satumo. The only thing you should change is this line
<Arias_CoreExtended before="Mage_Checkout">Arias_CoreExtended</Arias_CoreExtended>
So your full configuration have to look like this:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Arias_CoreExtended>
<version>0.1.0</version>
</Arias_CoreExtended>
</modules>
<frontend>
<routers>
<checkout>
<args>
<modules>
<Arias_CoreExtended before="Mage_Checkout">Arias_CoreExtended</Arias_CoreExtended>
</modules>
</args>
</checkout>
</routers>
</frontend>
</config>
I'm building a Controller and when I call an Action I get a 404 Error (everything worked last week!). I'm calling the action using:
http://www.website.com/route/controllername/actionname
eg:
http://www.website.com/abcdef/test/echo
I have investigated the problem (using Mage::log('..')) and found out that the controller is being loaded. The controller's name is fine too. Further investigation revealed that the noRouteAction within my controller is being called.
ie my controller contains:
public function noRouteAction() {
echo "noRoute Action";
}
public function echoAction() {
echo "Echo Action";
}
When I call http://www.website.com/abcdef/test/echo I get "noRoute Action".
Why isn't echoAction being called?
Edit:
The config.xml
<?xml version="1.0"?>
<config>
<modules>
<Abcdef_Web>
<version>1.0.0</version>
</Abcdef_Web>
</modules>
<global>
<helpers>
<abcdef>
<class>Abcdef_Web_Helper</class>
</abcdef>
</helpers>
<blocks>
<abcdef>
<class>Abcdef_Web_Block</class>
</abcdef>
</blocks>
</global>
<frontend>
<routers>
<abcdef>
<use>standard</use>
<args>
<module>Abcdef_Web</module>
<frontName>abcdef</frontName>
</args>
</abcdef>
</routers>
<layout>
<updates>
<abcdef>
<file>abcdef.xml</file>
</abcdef>
</updates>
</layout>
</frontend>
</config>
The controller class file: (TestController.php)
<?php
class Abcdef_Web_TestController extends Mage_Core_Controller_Front_Action {
public function noRouteAction() {
echo "noRoute Action";
}
public function echoAction() {
echo "Echo Action";
}
}
?>
OK found the problem!!!!
It seems that "Add Store Code to Urls" was set to yes, so Magento was expecting:
http://www.website.com/storecode/abcdef/test/echo
rather then:
http://www.website.com/abcdef/test/echo
For those with the same problem. This can be disabled through:
System / Configuration / General / Web / Url Options / Add Store Code to Urls
Note:
I do not remember setting this option to Yes. I've seen some reports that this setting could be changing automatically (4 people reporting it):
http://www.magentocommerce.com/boards/viewthread/192613/
As titled.
But still, users can login to the frontend, and administrator could create user account only in backend.
Another possibility would be overloading the customer/account/create action and just redirect the user to the home page when this action is invoked.
In a first time, just do what was proposed by Ben V. It will remove the possibility to view the registration page.
Then, create a new module in which you will overload the AccountController.php.
1- Create a new folder in app/code/local/ named Mycompany
2- Create a new folder in app/code/local/Mycompany/ named Registrationremove
3- Create app/code/local/Mycompany/Registrationremove/etc/
4- Create app/code/local/Mycompany/Registrationremove/etc/config.xml
Copy and Paste in config.xml :
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Registrationremove>
<version>0.1.0</version>
</Mycompany_Registrationremove>
</modules>
<global>
<rewrite>
<mycompany_registrationremove_customer_account_create>
<from><![CDATA[#^/customer/account/create/$#]]></from>
<to>/registrationremove/customer_account/create</to>
</mycompany_registrationremove_customer_account_create>
<mycompany_registrationremove_customer_account_createPost>
<from><![CDATA[#^/customer/account/createPost/$#]]></from>
<to>/registrationremove/customer_account/createPost</to>
</mycompany_registrationremove_customer_account_createPost>
</rewrite>
</global>
<frontend>
<routers>
<registrationremove>
<use>standard</use>
<args>
<module>Mycompany_Registrationremove</module>
<frontName>registrationremove</frontName>
</args>
</registrationremove>
</routers>
</frontend>
</config>
5- Create app/code/local/Mycompany/Registrationremove/controllers
6- Create app/etc/modules/Mycompany_Registrationremove.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Registrationremove>
<active>true</active>
<codePool>local</codePool>
</Mycompany_Registrationremove>
</modules>
</config>
7- Create app/code/local/Mycompany/Registrationremove/controllers/Customer/AccountController.php
Copy and Paste in AccountController.php:
require_once 'Mage/Customer/controllers/AccountController.php';
class Mycompany_Registrationremove_Customer_AccountController extends Mage_Customer_AccountController
{
public function createAction()
{
$this->_redirect('*/*');
}
public function createPostAction()
{
$this->_redirect('*/*');
}
}
8- Create app/code/local/Mycompany/Registrationremove/Helper/Data.php
Copy and paste in Data.php:
class Mycompany_Registrationremove_Helper_Data extends Mage_Core_Helper_Abstract
{
}
Now, when someone tries to access to customer/account/create/ it should be redirected to the home page.
Hope that helped :)
Hugues.
You could modify the login screen to remove the "Create New Account" button. This way existing users can still log in but they have no way to create new accounts.
The file to modify is /app/design/frontend/default/default/template/customer/form/login.phtml. Around line 41 you'll see <div class="col-1 new-users">. Comment out that entire div to hide the New User section of the login page.
Edit:
There is no way to just disable new user registration like you are asking. I did a little more searching, and all I found were several people with the same idea as mine. In addition to my original suggestion, I would
a) remove the <customer_account_create> section of /app/design/frontend/default/default/layout/custom.xml, and
b) remove the registration-related lines from /app/design/frontend/default/default/template/checkout/onepage/login.phtml.
Ok. I got it worked. Refer to Hugues Solution, there are two amendments:
add app\etc\modules\Mycompany_All.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Registrationremove>
<active>true</active>
<codePool>local</codePool>
</Mycompany_Registrationremove>
</modules>
</config>
modify the file: app/code/local/Mycompany/Registrationremove/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Registrationremove>
<version>0.1.0</version>
</Mycompany_Registrationremove>
</modules>
<global>
<rewrite>
<mycompany_registrationremove_customer_account_create>
<from><![CDATA[#^/customer/account/create/$#]]></from>
<to>/registrationremove/customer_account/create</to>
</mycompany_registrationremove_customer_account_create>
<mycompany_registrationremove_customer_account_createPost>
<from><![CDATA[#^/customer/account/createPost/$#]]></from>
<to>/registrationremove/customer_account/createPost</to>
</mycompany_registrationremove_customer_account_createPost>
</rewrite>
</global>
<frontend>
<routers>
<mycompany_registrationremove>
<use>standard</use>
<args>
<module>Mycompany_Registrationremove</module>
<frontName>registrationremove</frontName>
</args>
</mycompany_registrationremove>
</routers>
</frontend>
</config>
In the above example structure, the controller class name should be changed
from
class Mycompany_Registrationremove_AccountController extends Mage_Customer_AccountController
to
class Mycompany_Registrationremove_Customer_AccountController extends Mage_Customer_AccountController
Does this method works for ver. 1.4.1.1?
Finally I decided to skip all the complicated steps and also modify the register.phtml in \app\design\frontend\base\default\template\customer\form, apart from the files that BenV said.
I deleted the form and changed the title to "User registration disabled" :)
I couldn't get any of the solutions posted here to work, and found I had to use the following syntax in the config.xml (specifically frontend routers syntax):
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Registrationremove>
<version>0.1.0</version>
</Mycompany_Registrationremove>
</modules>
<global>
<rewrite>
<mycompany_registrationremove_customer_account_create>
<from><![CDATA[#^/customer/account/create/$#]]></from>
<to>/registrationremove/customer_account/create</to>
</mycompany_registrationremove_customer_account_create>
<mycompany_registrationremove_customer_account_createPost>
<from><![CDATA[#^/customer/account/createPost/$#]]></from>
<to>/registrationremove/customer_account/createPost</to>
</mycompany_registrationremove_customer_account_createPost>
</rewrite>
</global>
<frontend>
<routers>
<customer>
<args>
<modules>
<Mycompany_Registrationremove before="Mage_Customer">Mycompany_Registrationremove_Customer</Mycompany_Registrationremove>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
There's more info on this method here - http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_overload_a_controller
One could always change the customer router to point to a module without controllers, e.g.
<frontend>
<routers>
<customer>
<args>
<module>MyModule_NullRouting</module>
</args>
</customer>
</routers>
</frontend>
As an extension to liquidity's answer, a couple more changes I'd make to improve this. Firstly the regex doesn't match the url if it does not have a trailing slash eg. customer/account/create. To correct, the "from" nodes should read <![CDATA[#^/customer/account/create(/.*)?$#]]> and <![CDATA[#^/customer/account/createPost(/.*)?$#]]>.
Secondly, I've included an observer that listens for the customer_registration_is_allowed event (this gets called in persistent/customer/form/login.phtml when using the RWD theme from the $this->helper('customer')->isRegistrationAllowed() function):
<events>
<customer_registration_is_allowed>
<observers>
<your_module_set_is_active>
<class>Your_Module_Model_Observers_Customer</class>
<method>disableCustomerRegistration</method>
</your_module_set_is_active>
</observers>
</customer_registration_is_allowed>
</events>
Then in the observer:
class Your_Module_Model_Observers_Customer
{
/**
* Force disable customer registration
*
* #param Varien_Event_Observer $observer Observer
* #return void
*/
public function disableCustomerRegistration($observer)
{
$result = $observer->getResult();
if ($result->getIsAllowed() === true) {
$result->setIsAllowed(false);
}
}
}
This sets allowing registration to false and prevents the registration form showing without any template modifications.
Hope this is helpful!