Skip to main content
added 1 character in body; edited title
Source Link
blob
  • 455
  • 4
  • 14

magento 1.9 doesn't save attribute value on sales_order_save_aftersales_order_place_after

When the event sales_order_save_aftersales_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();
      }
  }

magento 1.9 doesn't save attribute value on sales_order_save_after

When the event sales_order_save_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();
      }
  }

magento 1.9 doesn't save attribute value on sales_order_place_after

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();
      }
  }
Source Link
blob
  • 455
  • 4
  • 14

magento 1.9 doesn't save attribute value on sales_order_save_after

When the event sales_order_save_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();
      }
  }