Overriding Magento Save Method

overridesproductsave

We have a attribute 'short-description' in our product listing page. We want to escape html characters e.g. "&" => "&" , and append information to it when our admin hit 'save' in product editing page. Which file / method should I be looking into?

Best Answer

You shouldn't override the save method.
Use an observer.
You can observe the event catalog_product_save_before.
Your method could look like this:

public function catalogProductSaveBefore($observer) {
    $product = $observer->getEvent()->getProduct();
    $shortDescription = $product->getShortDescription();
    $shortDescription = ...process your short description here
    $product->setShortDescription($shortDescription); 
    Mage::getSingleton('adminhtml/session')->addNotice('your message for admin here');
}

Read more about how event observers work in here.