i'm writing a observer based on this event


public function currentUser(Varien_Event_Observer $observer) {
   $product = $observer->getEvent()->getProduct();


But i can't get the product through the event object which is null, how can i get product through this event?


You can't get the product object through this event because this event is just a call when Edit method is called in product controller.

Controller is called when product is edit.

class Mage_Adminhtml_Catalog_ProductController extends Mage_Adminhtml_Controller_Action

public function editAction()

     Mage::dispatchEvent('catalog_product_edit_action', array('product' =>  $product));
| improve this answer | |

You will be getting the id of the product which is getting edited with the following code and once you get the id you can load the product

public function productEdit($observer){
    $productId = Mage::app()->getRequest()->getParam('id');
    $product = Mage::getModel('catalog/product')->load($productId);
| improve this answer | |
  • i already found a answer alternative way of finding product id as same as your answer, thanks for your reply – hkguile Aug 10 '16 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.