I want to overload the saveAction method from the core/Mage/Adminhtml/controllers/Catalog/ProductController.php and it won’t work - I have now searched and tried for a complete day :(
Background: I want to change the value of a custom attribute before the saving of the product. I found out, that the _initProductSave sets the attributes and I think, that changing them after the init_ProductSave would be a good point (if anyone knows a better place, please let me know) ...
MAY ANYONE PLEASE HELP ME ... :)
Magento Version: Community Edition version 1.7.0.1 No Extension, no themes installed, I just installed this version completely blank ...
VERSION 1: Overwritting the controller by copying to the local/Mage folder
First of all I tried to copy the file to the app/code/local folder, within the correct struture - but it won't work (I have done this with the Varient.php for local testsystem and the stores.php for correcting the price bug - for both it's working ...)
VERSION 2: Overwritting the controller with an extension
My extension looks like this:
File structure:
code/local/MyOne/MyExtension/controllers/Catalog/ProductController.php
code/local/MyOne/MyExtension/etc/config.xml
etc/modules/MyOne_MyExtension.xml
The files look the following: MyOne_MyExtension.xml:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<MyOne_MyExtension>
<active>true</active>
<codePool>local</codePool>
</MyOne_MyExtension>
</modules>
</config>
code/local/MyOne/MyExtension/etc/config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<MyOne_MyExtension>
<version>1.0.0</version>
</MyOne_MyExtension>
</modules>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<MyOne_MyExtension before="Mage_Adminhtml">MyOne_MyExtension_Catalog_ProductController</MyOne_MyExtension>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
and the last one, code/local/MyOne/MyExtension/controllers/Catalog/ProductController.php:
<?php
require_once 'Mage/Adminhtml/controllers/Catalog/ProductController.php';
class MyOne_MyExtension_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController
{
public function saveAction()
{
// do my stuff
die('reached method');
// after pressing on save, there should no be a white screen ...
}
}
?>
I have googled and read that much, I do not see an error ...
Any help would really be great !!!
Greetings, matthias