I have added a quantity field as per http://hkpatel201.blogspot.co.uk/2014/03/how-to-add-custom-qty-to-custom-option.html

All is working well. Screenshot of the admin is http://snag.gy/H9zE4.jpg

I know the following code gets me the Option Type ID

$orderItemOptions = $orderItem->getProductOptions();                            
if (isset($orderItemOptions['options'][0]['option_value']))
    $selectedOrderItemOptionId = $orderItemOptions['options'][0]['option_value'];

But my question is how do I get the Option Type based on the ID?

2 Answers 2



foreach ($orderItem->getProductOptions() as $opt) {  
  $optionType = $opt->getType();  

  echo 'Type : '  . $optionType;

To load option by id

$id = 9;
$opt = Mage::getModel('catalog/product_option')->load($id); 

From your code above

$opt = $orderItemOptions['options'][0];
$optionType = $opt->getType();

Try the following code

   $productOptions = $item->getProductOptions();
    foreach($productOptions['options'] as $key=>$value) {
    echo $value['label'];
    echo $value['option_value']

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.