I am using an extension, Blue Jalappeno Order Export for exporting orders, which works great. I modified one of the output format options to work for our fulfillment company and it is working well for us.
Now we need another export that uses a different format. I have the format fairly nailed down.
My problem is with calling the new massAction in the order grid.
This works to show the new action #2 in the pull down.
class Webshopapps_Ordermanager_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareMassaction()
{
parent::_prepareMassaction();
if (Mage::getStoreConfig("order_export/export_orders/active")) {
$this->getMassactionBlock()->addItem('ordermanager', array(
'label'=> Mage::helper('sales')->__('Export orders IFS'),
'url' => $this->getUrl('*/sales_order_export/csvexport'),
));
}
if (Mage::getStoreConfig("order_export/export_orders2/active")) {
$this->getMassactionBlock()->addItem('ordermanager2', array(
'label'=> Mage::helper('sales')->__('Export orders QB'),
'url' => $this->getUrl('*/sales_order_export/qbexport'),
));
}
}
}
The first, working export still works. The second does show up and allows me to select and submit it but behaves differently. The url for the first never changed (/admin/sales_order/index) but the download box pops up. The url for the second changes to admin/sales_order_export/qbexport/ and presents a white screen
What I'd like it to do is call a different method in the same controller. Or pass a parameter to one method.
What I'm trying:
I added a method in the same controller used for the first addItem.
class Webshopapps_Ordermanager_Sales_Order_ExportController extends Mage_Adminhtml_Controller_Action
{
public function csvexportAction() // First working mass action
{
$orders = $this->getRequest()->getPost('order_ids', array());
switch(Mage::getStoreConfig('order_export/export_orders/output_type')){
case 'Multi':
$file = Mage::getModel('webshopapps_ordermanager/export_multi')->exportOrders($orders);
$this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
break;
case 'Standard':
$file = Mage::getModel('webshopapps_ordermanager/export_csv')->exportOrders($orders);
$this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
break;
}
}
public function qbexportAction()
{
$orders = $this->getRequest()->getPost('order_ids', array());
switch(Mage::getStoreConfig('order_export/export_orders/output_type2')){
case 'Qb':
$file = Mage::getModel('webshopapps_ordermanager/export_qb')->exportOrders($orders);
$this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
break;
case 'Standard':
$file = Mage::getModel('webshopapps_ordermanager/export_csv')->exportOrders($orders);
$this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
break;
case 'Mscrm':
$file = Mage::getModel('webshopapps_ordermanager/export_mscrm')->exportOrders($orders);
$this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
break;
}
}
And the config.xml. I have looked and do not understand what makes the first massaction call the correct controller and action, but not the second. A glitch in my understanding that I need corrected.
<config>
<modules>
<Webshopapps_Ordermanager>
<version>0.0.1</version>
</Webshopapps_Ordermanager>
</modules>
<global>
<models>
<webshopapps_ordermanager>
<class>Webshopapps_Ordermanager_Model</class>
</webshopapps_ordermanager>
</models>
<helpers>
<webshopapps_ordermanager>
<class>Webshopapps_Ordermanager_Helper</class>
</webshopapps_ordermanager>
</helpers>
<blocks>
<adminhtml>
<rewrite>
<sales_order_grid>Webshopapps_Ordermanager_Block_Sales_Order_Grid</sales_order_grid>
</rewrite>
</adminhtml>
</blocks>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<Webshopapps_Ordermanager before="Mage_Adminhtml">Webshopapps_Ordermanager</Webshopapps_Ordermanager>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<translate>
<modules>
<Webshopapps_Ordermanager>
<files>
<default>Webshopapps_Ordermanager.csv</default>
</files>
</Webshopapps_Ordermanager>
</modules>
</translate>
<default>
<ordermanager>
<condition_name>order_export</condition_name>
</ordermanager>
</default>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<order_export>
<title>Export Orders</title>
</order_export>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</adminhtml>
</config>
Related
I'm trying to develop an extension that would add a form on the Admin side of Magento, but, for some reason, I can't seem to be able to even get Magento Administration to load when my module is installed. I'm at the very beginning of the development, and I'm stuck on an error that has been reported several times on StackOverflow. Unfortunately, none of the answers seem to help in my case.
The error I get is *Fatal error: Class 'Mage_Mycompany_Logviewer_Helper_Data' not found in C:\XAMPP\htdocs\magento\app\Mage.php on line 546*. That should mean that Magento can't find the helper class, but it's there and its name matches the one it's looking for (except for the "Mage_" at the beginning, that I never used in any other extension anyway).
Update 2012/07/29
The error occurs as soon as I log in into Magento Admin. When I click "Login", all I get is an error page, nothing is rendered.
Here's the content of all the files I have so far.
config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Logviewer>
<version>0.1.0</version>
</Mycompany_Logviewer>
</modules>
<global>
<models>
<logviewer>
<class>Mycompany_Logviewer_Model</class>
</logviewer>
</models>
<blocks>
<logviewer>
<class>Mycompany_Logviewer_Block</class>
</logviewer>
</blocks>
<helpers>
<logviewer>
<class>Mycompany_Logviewer_Helper</class>
</logviewer>
</helpers>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<mycompany_logviewer after="Mage_Adminhtml">Mycompany_Logviewer_Adminhtml</mycompany_logviewer>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<menu>
<mycompany translate="title" module="mycompany_logviewer">
<title>Mycompany</title>
<sort_order>90</sort_order>
<children>
<form translate="title" module="mycompany_logviewer">
<title>Form</title>
<sort_order>10</sort_order>
<action>adminhtml/logviewer</action>
</form>
</children>
</mycompany>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<mycompany>
<title>Mycompany</title>
<sort_order>90</sort_order>
<children>
<form>
<title>Form</title>
<sort_order>10</sort_order>
</form>
</children>
</mycompany>
</children>
</admin>
</resources>
</acl>
</adminhtml>
</config>
Data.php (Helper)
class Mycompany_Logviewer_Helper_Data extends Mage_Core_Helper_Abstract
{
}
LogviewerController.php (Controller)
class Mycompany_Logviewer_Adminhtml_LogviewerController extends Mage_Adminhtml_Controller_Action
{
/**
* View form action
*/
public function indexAction() {
$this->loadLayout();
$this->_setActiveMenu('Mycompany/form');
$this->_addBreadcrumb(Mage::helper('Mycompany_Logviewer')->__('Form'), Mage::helper('Mycompany_Logviewer')->__('Form'));
$this->renderLayout();
}
/**
* Check allow or not access to ths page
*
* #return bool - is allowed to access this menu
*/
protected function _isAllowed()
{
return Mage::getSingleton('admin/session')->isAllowed('Mycompany/form');
}
}
Mycompany_Logviewer.xml (configuration file)
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Logviewer>
<active>true</active>
<codePool>local</codePool>
</Mycompany_Logviewer>
</modules>
</config>
All the above have been copied from an example I found online, I just replaced the Namespace and the Module name with Mycompany and Logviewer, respectively. I'm pretty sure it's something obvious I forgot, but I can't figure out what it could be. Thanks for the help.
The first thing that jumps out is that you are registering a module with the name of Procedo_Logviewer - when in fact it should be Mycompany_Logviewer
So, Mycompany_Logviewer.xml should be as follows:
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Logviewer>
<active>true</active>
<codePool>local</codePool>
</Mycompany_Logviewer>
</modules>
</config>
Clear cache after changing
EDIT
Looking more closely at your controller, I can also see that you are calling your helper like so:
Mage::helper('Mycompany_Logviewer')
You should be calling your helper like this instead:
Mage::helper('logviewer')
EDIT 2
Another issue is present in your config.xml
module="mycompany_logviewer"
Should be
module="logviewer"
This correlates to the helper node you declared in your xml i.e.
<helpers>
<logviewer>
<class>Mycompany_Logviewer_Helper</class>
</logviewer>
</helpers>
I had similar problem. Solution was putting company name in like this:
<helpers>
<Mycompany_Logviewer>
<class>Mycompany_Logviewer_Helper</class>
</Mycompany_Logviewer>
</helpers>
$myHelper= Mage::helper('Mycompany_Logviewer');
Edit 4/4/12
I STILL HAVE ONE QUESTION:
I solved my issue but it adds my option at the top of the list. How can I sort it to my my option to the bottom of the list?
Please see answer for contents of my working config.xml file...
I'm looking for in depth help here because I've been at this for quite a while now and seem to be getting nowhere.
Background
I was looking to make a printable RMA form for our customers to make it easier on them to Return/Exchange items.
I did this with the help of this extension: http://www.magentocommerce.com/magento-connect/admin-order-printing-extension.html
(Please download this to see the directory structure if needed)
It adds a button to the order and then I went in and edited the form/form layout so that it was an RMA (or has RMA content).
Everything is working great, however, we have to go into each order and press the button in order for it to print.
We really need a Mass Action in order to make it more efficient and useful.
Problem
I've tried to different ways to get this to work but I really need help on this. Most recently I've tried to follow this tutorial (http://www.blog.magepsycho.com/adding-new-mass-action-to-admin-grid-in-magento/) using the second method of events but I can't seem to get this to work.
Can someone please explain in more depth (this last method I've tried) so that I can get it working with this module???
I've added this in the config.xml(according to the tutorial)
<events>
<core_block_abstract_prepare_layout_before>
<observers>
<orderprint_core_block_abstract_prepare_layout_before>
<class>orderprint/observer</class>
<method>addRmaAction</method>
</orderprint_core_block_abstract_prepare_layout_before>
</observers>
</core_block_abstract_prepare_layout_before>
</events>
And in Nastnet/OrderPrint/Model/Observer.php I've added this (according to the tutorial)
<?php class Nastnet_OrderPrint_Model_Observer {
public function addRmaAction($observer) {
$block = $observer->getEvent()->getBlock();
if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
&& $block->getRequest()->getControllerName() == 'sales_order')
{
$block->addItem('pdfrma_order', array(
'label' => 'Print RMA',
'url' => Mage::app()->getStore()->getUrl('nastnet/controller/action'),
));
}
} }
(Sorry for the messy code above - the only way I could get it highlighted)
EDIT 1 (4/2/12)
This is my module's config.xml file. I've had to go with the rewrite/override method as of right now (deleting my attempts at using events). If you see anything, including the exact structure of what it would need to be please let me know...
Minus the <config> tags:
<modules>
<Nastnet_OrderPrint>
<version>0.1.3</version>
</Nastnet_OrderPrint>
</modules>
<global>
<blocks>
<adminhtml>
<rewrite>
<sales_order_grid>Nastnet_OrderPrint_Block_Sales_Order_Grid</sales_order_grid> <!-- WORKIING METHOD -->
<sales_order_view>Nastnet_OrderPrint_Block_Sales_Order_View</sales_order_view>
</rewrite>
</adminhtml>
</blocks>
<rewrite>
<Nastnet_OrderPrint_OrderController>
<from><![CDATA[#/\w+/sales_order/print/#]]></from>
<to>/orderprint/order/print/</to>
</Nastnet_OrderPrint_OrderController>
</rewrite>
<models>
<Nastnet_OrderPrint>
<class>Nastnet_OrderPrint_Model</class>
</Nastnet_OrderPrint>
</models>
<pdf>
<order>
<default>Nastnet_OrderPrint/order_pdf_items_order_default</default>
<grouped>Nastnet_OrderPrint/order_pdf_items_order_grouped</grouped>
</order>
</pdf>
</global>
<admin>
<routers>
<Nastnet_OrderPrint>
<use>admin</use>
<args>
<module>Nastnet_OrderPrint</module>
<!-- This is used when "catching" the rewrite above -->
<frontName>orderprint</frontName>
</args>
</Nastnet_OrderPrint>
</routers>
I've figured out the correct handles and everything in order for this to work (with the help of this article: http://mydons.com/simple-example-using-magento-event-observer/)
In the config.xml file, I had to make new <adminhtml> handles after the <config> handles. This got me to the right "depth". Here is the entire config.xml file minus the <config> handles (cause it won't paste correctly):
<modules>
<Nastnet_OrderPrint>
<version>0.1.3</version>
</Nastnet_OrderPrint>
</modules>
<adminhtml>
<events>
<core_block_abstract_prepare_layout_before>
<observers>
<Nastnet_OrderPrint_Model_Observer>
<type>singleton</type>
<class>Nastnet_OrderPrint_Model_Observer</class>
<method>addRmaAction</method>
</Nastnet_OrderPrint_Model_Observer>
</observers>
</core_block_abstract_prepare_layout_before>
</events>
</adminhtml>
<global>
<blocks>
<adminhtml>
<rewrite>
<sales_order_view>Nastnet_OrderPrint_Block_Sales_Order_View</sales_order_view>
</rewrite>
</adminhtml>
</blocks>
<rewrite>
<Nastnet_OrderPrint_OrderController>
<from><![CDATA[#/\w+/sales_order/print/#]]></from>
<to>/orderprint/order/print/</to>
</Nastnet_OrderPrint_OrderController>
</rewrite>
<models>
<Nastnet_OrderPrint>
<class>Nastnet_OrderPrint_Model</class>
</Nastnet_OrderPrint>
</models>
<pdf>
<order>
<default>Nastnet_OrderPrint/order_pdf_items_order_default</default>
<grouped>Nastnet_OrderPrint/order_pdf_items_order_grouped</grouped>
</order>
</pdf>
</global>
<admin>
<routers>
<Nastnet_OrderPrint>
<use>admin</use>
<args>
<module>Nastnet_OrderPrint</module>
<!-- This is used when "catching" the rewrite above -->
<frontName>orderprint</frontName>
</args>
</Nastnet_OrderPrint>
</routers>
</admin>
This is the part that I needed and it is finally correct here:
<adminhtml>
<events>
<core_block_abstract_prepare_layout_before>
<observers>
<Nastnet_OrderPrint_Model_Observer>
<type>singleton</type>
<class>Nastnet_OrderPrint_Model_Observer</class>
<method>addRmaAction</method>
</Nastnet_OrderPrint_Model_Observer>
</observers>
</core_block_abstract_prepare_layout_before>
</events>
</adminhtml>
It points to my observer file (based on the correct event) here: app/code/local/Nastnet/OrderPrint/Model/Observer.php. This obviously then holds my addRmaAction.
I STILL HAVE ONE QUESTION:
This puts my option at the top of the list. How can I sort it to my my option to the bottom of the list?
Contents of Observer.php
<?php
class Nastnet_OrderPrint_Model_Observer
{
public function addRmaAction($observer)
{
$block = $observer->getEvent()->getBlock();
if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
&& $block->getRequest()->getControllerName() == 'sales_order')
{
$block->addItem('rmamassprint', array(
'label' => 'Print Return/Exchange',
'url' => Mage::app()->getStore()->getUrl('orderprint/order/pdfRma'),
));
}
}
}
For starters did you confirm whether or not your observer is being called? Just by adding a Mage::log("Observer called");
and watching the system.log file..
Here is the working tutorial for adding mass action to Sales > Order Grid:
http://www.blog.magepsycho.com/adding-new-mass-action-to-admin-grid-in-magento/
Try the 2nd approach(using event-observer method) which seems to be more upgrade proof way.
Thanks
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/
I am following this tutorial
http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-5-magento-models-and-orm-basics.
As per this tutorial,when i pass a value with url like(http://localhost/dev/weblog/index/testModel/id/1), I am getting error like this
Fatal error: Call to a member function load() on a non-object in app\code\local\Srivats\Weblog\controllers\IndexController.php on line 10
This is my index controller code
<?php
class Srivats_Weblog_IndexController extends Mage_Core_Controller_Front_Action
{
public function testModelAction()
{
$params = $this->getRequest()->getParams();
$blogpost = Mage::getModel('weblog/blogpost');
echo("Loading the blogpost with an ID of ".$params['id']);
$blogpost->load($params['id']);
$data = $blogpost->getData();
var_dump($data);
}
}
Blogpost.php file
<?php
class Srivats_Weblog_Model_Mysql4_Blogpost extends Mage_Core_Model_Mysql4_Abstract
{
protected function _construct()
{
$this->_init('weblog/blogpost','blogpost_id');
}
}
Here is my config file
<?xml version="1.0" encoding="utf-8"?>
<config>
<global>
<modules>
<srivats_weblog>
<version>1.0.0</version>
</srivats_weblog>
</modules>
<models>
<weblog_mysql4>
<class>Srivats_Weblog_Model_Mysql4</class>
<resourceModel>weblog_mysql4</resourceModel>
</weblog_mysql4>
</models>
</global>
<frontend>
<routers>
<weblog>
<use>standard</use>
<args>
<module>Srivats_Weblog</module>
<frontName>weblog</frontName>
</args>
</weblog>
</routers>
</frontend>
</config>
system.log shows
Warning: include() [function.include]:
Failed opening 'Mage\Weblog\Model\Blogpost.php' for inclusion
(include_path='app\code\local;E:\dev\app\code\community;app\code\core;E:\dev\lib;.;C:\php\pear')
in lib\Varien\Autoload.php on line 93
Here is the link to all files https://gist.github.com/cf99e4277599954f38d4
I think this line $blogpost->load($params['id']); causing trouble.What i am missing.Any pointers?
Ahh in you config you should have
<global>
<models>
<weblog>
<class>Srivats_Weblog_Model</class>
<resourceModel>weblog_mysql4</resourceModel>
</weblog>
</model>
</global>
you already have for mysql4 resource add this on top of that. You should have
<models>
<weblog>
<class>Srivats_Weblog_Model</class>
<resourceModel>weblog_mysql4</resourceModel>
</weblog>
<weblog_mysql4>
<class>Srivats_Weblog_Model_Mysql4</class>
</weblog_mysql4>
</models>
Your real problem is that the line:
$blogpost = Mage::getModel('weblog/blogpost');
Is not returning an object and so $blogpost is just NULL.
Is the blogpost model class file actually created in app/code/local/Srivats/Weblog/Model/Blogpost.php
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!