Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Core files !modify
 
optick
Member
 
Avatar
Total Posts:  34
Joined:  2008-07-20
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));
        
}
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
insight
Member
 
Total Posts:  58
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!!

 
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.

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