Reputation: 100
class NameSpace_Module_Model_Observer
{
public function catalogProductSaveAfter(Varien_Event_Observer $observer)
{
$product = $observer->getProduct()->getId();
echo $product;
$model = Mage::getModel('testimonial/select')
->setProductId($product)
->setTestimonialId(10)
->save();
}
}
Here above echo $product work fine, means my call is coming in observer event. Now while i m saving - nothing is added in database. I have tried lots of thing, but nothing helped till.
Upvotes: 0
Views: 4931
Reputation: 1579
Check your logs in var/log/[system|exception}.log
.
Additionally wrap your database call in a try/catch.
try{
$model = Mage::getModel('testimonial/select')
->setProductId($product)
->setTestimonialId(10)
->save();
catch (Exception $e) {
Mage::logException($e);
}
Upvotes: 1