When the event sales_order_place_after
is triggered the new quantity value is not inserted, what is the problem? How to update quantity or other attributes when this event is triggered? I need to update attribute after a user place an order.
The config.xml
file is OK. I already checked if the event is triggered.
public function save_product_frontend($observer = null) {
$event = $observer->getEvent();
$order = $event->getOrder();
$items = $order->getAllItems();
foreach ($items as $item) {
$product = Mage::getModel("catalog/product")->load( $item->getProductId() );
$stockitem = Mage::getModel('cataloginventory/stock_item')->loadByProduct( $product );
$stockitem->setQty( 100 );
$stockitem->save();
}
}