3 added 3 characters in body
source | link

Using the sales_order_place_after event in my custom Observer.
I have the quote_item_id value (example 324).
How to get the corresponding item_id value from the sales_flat_order_item table?

I am able to successfully use getCollection method, but it returns the order item as an array.
($sales_order_item_id in below example)

How to get the rawstring value? Eg 224 in example table
(in an efficient manner)

class Custom_Model_Observer {
 public function booking(Varien_Event_Observer $observer) {
    $OrderId = $observer->getEvent()->getOrder()->getId(); //order entity id        
    $QuoteObject = Mage::getSingleton('checkout/session')->getQuote(); //quote object

    foreach ($QuoteObject->getAllVisibleItems() as $item) {

      //get the quote item id - in example $quote_itemId = 324
      $quote_itemId = $item->getData('item_id');

      //get data from sales_flat_order_item table
      $sales_order_item_id = Mage::getModel('sales/order_item')
       ->getCollection()
       ->addFieldToFilter('quote_item_id', $quote_itemId)
       ->getData('item_id');
     //do more stuff here

    }
  }
}

Example sales_flat_order_item table:

sales_flat_order_item table

Using the sales_order_place_after event in my custom Observer.
I have the quote_item_id value (example 324).
How to get the corresponding item_id value from the sales_flat_order_item table?

I am able to successfully use getCollection method, but it returns the order item as an array.
($sales_order_item_id in below example)

How to get the raw value? Eg 224 in example table
(in an efficient manner)

class Custom_Model_Observer {
 public function booking(Varien_Event_Observer $observer) {
    $OrderId = $observer->getEvent()->getOrder()->getId(); //order entity id        
    $QuoteObject = Mage::getSingleton('checkout/session')->getQuote(); //quote object

    foreach ($QuoteObject->getAllVisibleItems() as $item) {

      //get the quote item id - in example $quote_itemId = 324
      $quote_itemId = $item->getData('item_id');

      //get data from sales_flat_order_item table
      $sales_order_item_id = Mage::getModel('sales/order_item')
       ->getCollection()
       ->addFieldToFilter('quote_item_id', $quote_itemId)
       ->getData('item_id');
     //do more stuff here

    }
  }
}

Example sales_flat_order_item table:

sales_flat_order_item table

Using the sales_order_place_after event in my custom Observer.
I have the quote_item_id value (example 324).
How to get the corresponding item_id value from the sales_flat_order_item table?

I am able to successfully use getCollection method, but it returns the order item as an array.
($sales_order_item_id in below example)

How to get the string value? Eg 224 in example table
(in an efficient manner)

class Custom_Model_Observer {
 public function booking(Varien_Event_Observer $observer) {
    $OrderId = $observer->getEvent()->getOrder()->getId(); //order entity id        
    $QuoteObject = Mage::getSingleton('checkout/session')->getQuote(); //quote object

    foreach ($QuoteObject->getAllVisibleItems() as $item) {

      //get the quote item id - in example $quote_itemId = 324
      $quote_itemId = $item->getData('item_id');

      //get data from sales_flat_order_item table
      $sales_order_item_id = Mage::getModel('sales/order_item')
       ->getCollection()
       ->addFieldToFilter('quote_item_id', $quote_itemId)
       ->getData('item_id');
     //do more stuff here

    }
  }
}

Example sales_flat_order_item table:

sales_flat_order_item table

2 added 2 characters in body
source | link

Using the 'sales_order_place_after'sales_order_place_after event in my custom Observer.
I have the 'quote_item_id'quote_item_id value (example 324).
How to get the corresponding 'item_id'item_id value from the sales_flat_order_itemsales_flat_order_item table?

I am able to successfully use getCollection method, but it returns the order item as an array.
($sales_order_item_id in below example)

How to get the raw value? Eg 224 in example table
(in an efficient manner)

class Custom_Model_Observer {
 public function booking(Varien_Event_Observer $observer) {
    $OrderId = $observer->getEvent()->getOrder()->getId(); //order entity id        
    $QuoteObject = Mage::getSingleton('checkout/session')->getQuote(); //quote object

    foreach ($QuoteObject->getAllVisibleItems() as $item) {

      //get the quote item id - in example $quote_itemId = 324
      $quote_itemId = $item->getData('item_id');

      //get data from sales_flat_order_item table
      $sales_order_item_id = Mage::getModel('sales/order_item')
       ->getCollection()
       ->addFieldToFilter('quote_item_id', $quote_itemId)
       ->getData('item_id');
     //do more stuff here

    }
  }
}

Example sales_flat_order_item table:

sales_flat_order_item table

Using the 'sales_order_place_after' event in my custom Observer.
I have the 'quote_item_id' value (example 324).
How to get the corresponding 'item_id' value from the sales_flat_order_item table?

I am able to successfully use getCollection method, but it returns the order item as an array.
($sales_order_item_id in below example)

How to get the raw value? Eg 224 in example table
(in an efficient manner)

class Custom_Model_Observer {
 public function booking(Varien_Event_Observer $observer) {
    $OrderId = $observer->getEvent()->getOrder()->getId(); //order entity id        
    $QuoteObject = Mage::getSingleton('checkout/session')->getQuote(); //quote object

    foreach ($QuoteObject->getAllVisibleItems() as $item) {

      //get the quote item id - in example $quote_itemId = 324
      $quote_itemId = $item->getData('item_id');

      //get data from sales_flat_order_item table
      $sales_order_item_id = Mage::getModel('sales/order_item')
       ->getCollection()
       ->addFieldToFilter('quote_item_id', $quote_itemId)
       ->getData('item_id');
     //do more stuff here

    }
  }
}

Example sales_flat_order_item table:

sales_flat_order_item table

Using the sales_order_place_after event in my custom Observer.
I have the quote_item_id value (example 324).
How to get the corresponding item_id value from the sales_flat_order_item table?

I am able to successfully use getCollection method, but it returns the order item as an array.
($sales_order_item_id in below example)

How to get the raw value? Eg 224 in example table
(in an efficient manner)

class Custom_Model_Observer {
 public function booking(Varien_Event_Observer $observer) {
    $OrderId = $observer->getEvent()->getOrder()->getId(); //order entity id        
    $QuoteObject = Mage::getSingleton('checkout/session')->getQuote(); //quote object

    foreach ($QuoteObject->getAllVisibleItems() as $item) {

      //get the quote item id - in example $quote_itemId = 324
      $quote_itemId = $item->getData('item_id');

      //get data from sales_flat_order_item table
      $sales_order_item_id = Mage::getModel('sales/order_item')
       ->getCollection()
       ->addFieldToFilter('quote_item_id', $quote_itemId)
       ->getData('item_id');
     //do more stuff here

    }
  }
}

Example sales_flat_order_item table:

sales_flat_order_item table

1
source | link

How to get value from sales_flat_order_item table using quote_item_id?

Using the 'sales_order_place_after' event in my custom Observer.
I have the 'quote_item_id' value (example 324).
How to get the corresponding 'item_id' value from the sales_flat_order_item table?

I am able to successfully use getCollection method, but it returns the order item as an array.
($sales_order_item_id in below example)

How to get the raw value? Eg 224 in example table
(in an efficient manner)

class Custom_Model_Observer {
 public function booking(Varien_Event_Observer $observer) {
    $OrderId = $observer->getEvent()->getOrder()->getId(); //order entity id        
    $QuoteObject = Mage::getSingleton('checkout/session')->getQuote(); //quote object

    foreach ($QuoteObject->getAllVisibleItems() as $item) {

      //get the quote item id - in example $quote_itemId = 324
      $quote_itemId = $item->getData('item_id');

      //get data from sales_flat_order_item table
      $sales_order_item_id = Mage::getModel('sales/order_item')
       ->getCollection()
       ->addFieldToFilter('quote_item_id', $quote_itemId)
       ->getData('item_id');
     //do more stuff here

    }
  }
}

Example sales_flat_order_item table:

sales_flat_order_item table