0

I'm listening to the catalog_product_attribute_update_after event and I want to get the product that is being updated.

I tried the following ($obs is the observer instance):

    Mage::log("getProduct " . !is_null($obs->getProduct()));
    Mage::log("getEvent " . !is_null($obs->getEvent()->getProduct()));
    Mage::log("getItem " . !is_null($obs->getItem()));
    Mage::log("registry " . !is_null(Mage::registry('product')->getData()));

But checking the logs show me that they all return null!

So how am I suppose to know which product is being updated inside the catalog_product_attribute_update_after observer?

Thanks!

1
$productIds= $obs->getEvent()->getProductIds();
$productsCollection = Mage::getModel('catalog/product')
    ->getCollection()
    ->addAttributeToFilter('entity_id', array('in' => $productIds));

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.