Try the Demo

Magento Forum

   
Core files !modify
 
optick
Member
 
Avatar
Total Posts:  33
Joined:  2008-07-21
Brasov, Romania
 

hy,

i have the file app\code\core\Mage\Adminhtml\controllers\Catalog\ProductController.php. how can I add my code in this file without modify the source.

Example: - this file contain fuction saveAction

public function saveAction()
    
{
        $storeId        
$this->getRequest()->getParam('store');
        
$redirectBack   $this->getRequest()->getParam('back'false);
        .............................
       include 
'my_code.php';     // here I type / include  my code 
        // it's not recomanded  .... because when I want to  update the magento  I lose my code 
        // know somebody a diferent solution to add my code?
        
.............................
            else 
{
            $this
->_redirect('*/*/', array('store'=>$storeId));
        
}
}

 Signature 

Magento development
ProAlpin.ro

 
Magento Community Magento Community
Magento Community
Magento Community
 
insight
Member
 
Total Posts:  56
Joined:  2008-07-24
 

I just keep a real tight and up to date log of all the changes i make to core files, i try and avoid it but sometimes it inevitable. That way on the next update i can replace the files and watch my magento installation fall apart!!! but at least it falls apart in a structured and well documented approch!!

 Signature 

I’m advertising billabong hoodies for a client!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
J.T.
Moderator
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

You would extend the class so you keep the original class as it is. That’s what inheritance is for.

Or get Beyond Compare and track changes accurately via diff.

 Signature 

It takes two to tango, so don’t blame Magento right away if things go tits-up!

Mage Quick FAQ
Q. Installation problems with localhost/xamp/wamp/whatever and/or missing php extensions, help!
A. Get Zend Server - Community Edition is free and will make things a lot easier on you now and when deploying to production

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top